]> git.bitcoin.ninja Git - ldk-java/blob - ts/bindings.c
7e3fde6e763aae39ff5b7c4391c7de1ccfaf5fe8
[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_UnexpectedPaths;
225                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
226                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
227                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
228                 case 27: return LDKBolt12SemanticError_MissingSignature;
229         }
230         abort();
231 }
232 static inline int32_t LDKBolt12SemanticError_to_js(LDKBolt12SemanticError val) {
233         switch (val) {
234                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
235                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
236                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
237                 case LDKBolt12SemanticError_MissingAmount: return 3;
238                 case LDKBolt12SemanticError_InvalidAmount: return 4;
239                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
240                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
241                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
242                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
243                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
244                 case LDKBolt12SemanticError_MissingDescription: return 10;
245                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
246                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
247                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
248                 case LDKBolt12SemanticError_MissingQuantity: return 14;
249                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
250                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
251                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
252                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
253                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
254                 case LDKBolt12SemanticError_MissingPayerId: return 20;
255                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
256                 case LDKBolt12SemanticError_MissingPaths: return 22;
257                 case LDKBolt12SemanticError_UnexpectedPaths: return 23;
258                 case LDKBolt12SemanticError_InvalidPayInfo: return 24;
259                 case LDKBolt12SemanticError_MissingCreationTime: return 25;
260                 case LDKBolt12SemanticError_MissingPaymentHash: return 26;
261                 case LDKBolt12SemanticError_MissingSignature: return 27;
262                 default: abort();
263         }
264 }
265 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
266         switch (ord) {
267                 case 0: return LDKCOption_NoneZ_Some;
268                 case 1: return LDKCOption_NoneZ_None;
269         }
270         abort();
271 }
272 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
273         switch (val) {
274                 case LDKCOption_NoneZ_Some: return 0;
275                 case LDKCOption_NoneZ_None: return 1;
276                 default: abort();
277         }
278 }
279 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
280         switch (ord) {
281                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
282                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
283                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
284         }
285         abort();
286 }
287 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
288         switch (val) {
289                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
290                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
291                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
292                 default: abort();
293         }
294 }
295 static inline LDKChannelShutdownState LDKChannelShutdownState_from_js(int32_t ord) {
296         switch (ord) {
297                 case 0: return LDKChannelShutdownState_NotShuttingDown;
298                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
299                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
300                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
301                 case 4: return LDKChannelShutdownState_ShutdownComplete;
302         }
303         abort();
304 }
305 static inline int32_t LDKChannelShutdownState_to_js(LDKChannelShutdownState val) {
306         switch (val) {
307                 case LDKChannelShutdownState_NotShuttingDown: return 0;
308                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
309                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
310                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
311                 case LDKChannelShutdownState_ShutdownComplete: return 4;
312                 default: abort();
313         }
314 }
315 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
316         switch (ord) {
317                 case 0: return LDKConfirmationTarget_OnChainSweep;
318                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
319                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
320                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
321                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
322                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
323                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
324         }
325         abort();
326 }
327 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
328         switch (val) {
329                 case LDKConfirmationTarget_OnChainSweep: return 0;
330                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
331                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
332                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
333                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
334                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
335                 case LDKConfirmationTarget_OutputSpendingFee: return 6;
336                 default: abort();
337         }
338 }
339 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
340         switch (ord) {
341                 case 0: return LDKCreationError_DescriptionTooLong;
342                 case 1: return LDKCreationError_RouteTooLong;
343                 case 2: return LDKCreationError_TimestampOutOfBounds;
344                 case 3: return LDKCreationError_InvalidAmount;
345                 case 4: return LDKCreationError_MissingRouteHints;
346                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
347         }
348         abort();
349 }
350 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
351         switch (val) {
352                 case LDKCreationError_DescriptionTooLong: return 0;
353                 case LDKCreationError_RouteTooLong: return 1;
354                 case LDKCreationError_TimestampOutOfBounds: return 2;
355                 case LDKCreationError_InvalidAmount: return 3;
356                 case LDKCreationError_MissingRouteHints: return 4;
357                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
358                 default: abort();
359         }
360 }
361 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
362         switch (ord) {
363                 case 0: return LDKCurrency_Bitcoin;
364                 case 1: return LDKCurrency_BitcoinTestnet;
365                 case 2: return LDKCurrency_Regtest;
366                 case 3: return LDKCurrency_Simnet;
367                 case 4: return LDKCurrency_Signet;
368         }
369         abort();
370 }
371 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
372         switch (val) {
373                 case LDKCurrency_Bitcoin: return 0;
374                 case LDKCurrency_BitcoinTestnet: return 1;
375                 case LDKCurrency_Regtest: return 2;
376                 case LDKCurrency_Simnet: return 3;
377                 case LDKCurrency_Signet: return 4;
378                 default: abort();
379         }
380 }
381 static inline LDKDirection LDKDirection_from_js(int32_t ord) {
382         switch (ord) {
383                 case 0: return LDKDirection_NodeOne;
384                 case 1: return LDKDirection_NodeTwo;
385         }
386         abort();
387 }
388 static inline int32_t LDKDirection_to_js(LDKDirection val) {
389         switch (val) {
390                 case LDKDirection_NodeOne: return 0;
391                 case LDKDirection_NodeTwo: return 1;
392                 default: abort();
393         }
394 }
395 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
396         switch (ord) {
397                 case 0: return LDKHTLCClaim_OfferedTimeout;
398                 case 1: return LDKHTLCClaim_OfferedPreimage;
399                 case 2: return LDKHTLCClaim_AcceptedTimeout;
400                 case 3: return LDKHTLCClaim_AcceptedPreimage;
401                 case 4: return LDKHTLCClaim_Revocation;
402         }
403         abort();
404 }
405 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
406         switch (val) {
407                 case LDKHTLCClaim_OfferedTimeout: return 0;
408                 case LDKHTLCClaim_OfferedPreimage: return 1;
409                 case LDKHTLCClaim_AcceptedTimeout: return 2;
410                 case LDKHTLCClaim_AcceptedPreimage: return 3;
411                 case LDKHTLCClaim_Revocation: return 4;
412                 default: abort();
413         }
414 }
415 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
416         switch (ord) {
417                 case 0: return LDKIOError_NotFound;
418                 case 1: return LDKIOError_PermissionDenied;
419                 case 2: return LDKIOError_ConnectionRefused;
420                 case 3: return LDKIOError_ConnectionReset;
421                 case 4: return LDKIOError_ConnectionAborted;
422                 case 5: return LDKIOError_NotConnected;
423                 case 6: return LDKIOError_AddrInUse;
424                 case 7: return LDKIOError_AddrNotAvailable;
425                 case 8: return LDKIOError_BrokenPipe;
426                 case 9: return LDKIOError_AlreadyExists;
427                 case 10: return LDKIOError_WouldBlock;
428                 case 11: return LDKIOError_InvalidInput;
429                 case 12: return LDKIOError_InvalidData;
430                 case 13: return LDKIOError_TimedOut;
431                 case 14: return LDKIOError_WriteZero;
432                 case 15: return LDKIOError_Interrupted;
433                 case 16: return LDKIOError_Other;
434                 case 17: return LDKIOError_UnexpectedEof;
435         }
436         abort();
437 }
438 static inline int32_t LDKIOError_to_js(LDKIOError val) {
439         switch (val) {
440                 case LDKIOError_NotFound: return 0;
441                 case LDKIOError_PermissionDenied: return 1;
442                 case LDKIOError_ConnectionRefused: return 2;
443                 case LDKIOError_ConnectionReset: return 3;
444                 case LDKIOError_ConnectionAborted: return 4;
445                 case LDKIOError_NotConnected: return 5;
446                 case LDKIOError_AddrInUse: return 6;
447                 case LDKIOError_AddrNotAvailable: return 7;
448                 case LDKIOError_BrokenPipe: return 8;
449                 case LDKIOError_AlreadyExists: return 9;
450                 case LDKIOError_WouldBlock: return 10;
451                 case LDKIOError_InvalidInput: return 11;
452                 case LDKIOError_InvalidData: return 12;
453                 case LDKIOError_TimedOut: return 13;
454                 case LDKIOError_WriteZero: return 14;
455                 case LDKIOError_Interrupted: return 15;
456                 case LDKIOError_Other: return 16;
457                 case LDKIOError_UnexpectedEof: return 17;
458                 default: abort();
459         }
460 }
461 static inline LDKInboundHTLCStateDetails LDKInboundHTLCStateDetails_from_js(int32_t ord) {
462         switch (ord) {
463                 case 0: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd;
464                 case 1: return LDKInboundHTLCStateDetails_Committed;
465                 case 2: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill;
466                 case 3: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail;
467         }
468         abort();
469 }
470 static inline int32_t LDKInboundHTLCStateDetails_to_js(LDKInboundHTLCStateDetails val) {
471         switch (val) {
472                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd: return 0;
473                 case LDKInboundHTLCStateDetails_Committed: return 1;
474                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill: return 2;
475                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail: return 3;
476                 default: abort();
477         }
478 }
479 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
480         switch (ord) {
481                 case 0: return LDKLevel_Gossip;
482                 case 1: return LDKLevel_Trace;
483                 case 2: return LDKLevel_Debug;
484                 case 3: return LDKLevel_Info;
485                 case 4: return LDKLevel_Warn;
486                 case 5: return LDKLevel_Error;
487         }
488         abort();
489 }
490 static inline int32_t LDKLevel_to_js(LDKLevel val) {
491         switch (val) {
492                 case LDKLevel_Gossip: return 0;
493                 case LDKLevel_Trace: return 1;
494                 case LDKLevel_Debug: return 2;
495                 case LDKLevel_Info: return 3;
496                 case LDKLevel_Warn: return 4;
497                 case LDKLevel_Error: return 5;
498                 default: abort();
499         }
500 }
501 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
502         switch (ord) {
503                 case 0: return LDKNetwork_Bitcoin;
504                 case 1: return LDKNetwork_Testnet;
505                 case 2: return LDKNetwork_Regtest;
506                 case 3: return LDKNetwork_Signet;
507         }
508         abort();
509 }
510 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
511         switch (val) {
512                 case LDKNetwork_Bitcoin: return 0;
513                 case LDKNetwork_Testnet: return 1;
514                 case LDKNetwork_Regtest: return 2;
515                 case LDKNetwork_Signet: return 3;
516                 default: abort();
517         }
518 }
519 static inline LDKOutboundHTLCStateDetails LDKOutboundHTLCStateDetails_from_js(int32_t ord) {
520         switch (ord) {
521                 case 0: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd;
522                 case 1: return LDKOutboundHTLCStateDetails_Committed;
523                 case 2: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess;
524                 case 3: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure;
525         }
526         abort();
527 }
528 static inline int32_t LDKOutboundHTLCStateDetails_to_js(LDKOutboundHTLCStateDetails val) {
529         switch (val) {
530                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd: return 0;
531                 case LDKOutboundHTLCStateDetails_Committed: return 1;
532                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess: return 2;
533                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure: return 3;
534                 default: abort();
535         }
536 }
537 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
538         switch (ord) {
539                 case 0: return LDKPaymentFailureReason_RecipientRejected;
540                 case 1: return LDKPaymentFailureReason_UserAbandoned;
541                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
542                 case 3: return LDKPaymentFailureReason_PaymentExpired;
543                 case 4: return LDKPaymentFailureReason_RouteNotFound;
544                 case 5: return LDKPaymentFailureReason_UnexpectedError;
545         }
546         abort();
547 }
548 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
549         switch (val) {
550                 case LDKPaymentFailureReason_RecipientRejected: return 0;
551                 case LDKPaymentFailureReason_UserAbandoned: return 1;
552                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
553                 case LDKPaymentFailureReason_PaymentExpired: return 3;
554                 case LDKPaymentFailureReason_RouteNotFound: return 4;
555                 case LDKPaymentFailureReason_UnexpectedError: return 5;
556                 default: abort();
557         }
558 }
559 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
560         switch (ord) {
561                 case 0: return LDKRecipient_Node;
562                 case 1: return LDKRecipient_PhantomNode;
563         }
564         abort();
565 }
566 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
567         switch (val) {
568                 case LDKRecipient_Node: return 0;
569                 case LDKRecipient_PhantomNode: return 1;
570                 default: abort();
571         }
572 }
573 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
574         switch (ord) {
575                 case 0: return LDKRetryableSendFailure_PaymentExpired;
576                 case 1: return LDKRetryableSendFailure_RouteNotFound;
577                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
578         }
579         abort();
580 }
581 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
582         switch (val) {
583                 case LDKRetryableSendFailure_PaymentExpired: return 0;
584                 case LDKRetryableSendFailure_RouteNotFound: return 1;
585                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
586                 default: abort();
587         }
588 }
589 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
590         switch (ord) {
591                 case 0: return LDKSecp256k1Error_IncorrectSignature;
592                 case 1: return LDKSecp256k1Error_InvalidMessage;
593                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
594                 case 3: return LDKSecp256k1Error_InvalidSignature;
595                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
596                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
597                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
598                 case 7: return LDKSecp256k1Error_InvalidTweak;
599                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
600                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
601                 case 10: return LDKSecp256k1Error_InvalidParityValue;
602         }
603         abort();
604 }
605 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
606         switch (val) {
607                 case LDKSecp256k1Error_IncorrectSignature: return 0;
608                 case LDKSecp256k1Error_InvalidMessage: return 1;
609                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
610                 case LDKSecp256k1Error_InvalidSignature: return 3;
611                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
612                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
613                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
614                 case LDKSecp256k1Error_InvalidTweak: return 7;
615                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
616                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
617                 case LDKSecp256k1Error_InvalidParityValue: return 10;
618                 default: abort();
619         }
620 }
621 static inline LDKShortChannelIdError LDKShortChannelIdError_from_js(int32_t ord) {
622         switch (ord) {
623                 case 0: return LDKShortChannelIdError_BlockOverflow;
624                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
625                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
626         }
627         abort();
628 }
629 static inline int32_t LDKShortChannelIdError_to_js(LDKShortChannelIdError val) {
630         switch (val) {
631                 case LDKShortChannelIdError_BlockOverflow: return 0;
632                 case LDKShortChannelIdError_TxIndexOverflow: return 1;
633                 case LDKShortChannelIdError_VoutIndexOverflow: return 2;
634                 default: abort();
635         }
636 }
637 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
638         switch (ord) {
639                 case 0: return LDKSiPrefix_Milli;
640                 case 1: return LDKSiPrefix_Micro;
641                 case 2: return LDKSiPrefix_Nano;
642                 case 3: return LDKSiPrefix_Pico;
643         }
644         abort();
645 }
646 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
647         switch (val) {
648                 case LDKSiPrefix_Milli: return 0;
649                 case LDKSiPrefix_Micro: return 1;
650                 case LDKSiPrefix_Nano: return 2;
651                 case LDKSiPrefix_Pico: return 3;
652                 default: abort();
653         }
654 }
655 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_js(int32_t ord) {
656         switch (ord) {
657                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
658                 case 1: return LDKSocketAddressParseError_InvalidInput;
659                 case 2: return LDKSocketAddressParseError_InvalidPort;
660                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
661         }
662         abort();
663 }
664 static inline int32_t LDKSocketAddressParseError_to_js(LDKSocketAddressParseError val) {
665         switch (val) {
666                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
667                 case LDKSocketAddressParseError_InvalidInput: return 1;
668                 case LDKSocketAddressParseError_InvalidPort: return 2;
669                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
670                 default: abort();
671         }
672 }
673 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
674         switch (ord) {
675                 case 0: return LDKUtxoLookupError_UnknownChain;
676                 case 1: return LDKUtxoLookupError_UnknownTx;
677         }
678         abort();
679 }
680 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
681         switch (val) {
682                 case LDKUtxoLookupError_UnknownChain: return 0;
683                 case LDKUtxoLookupError_UnknownTx: return 1;
684                 default: abort();
685         }
686 }
687 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
688         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
689         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
690         return ret;
691 }
692 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
693         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
694         return ret;
695 }
696 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
697         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
698         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
699         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
700         return ret_arr;
701 }
702
703 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
704 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
705         if (!ptr_is_owned(thing)) return;
706         void* thing_ptr = untag_ptr(thing);
707         CHECK_ACCESS(thing_ptr);
708         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
709         FREE(untag_ptr(thing));
710         BigEndianScalar_free(thing_conv);
711 }
712
713 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
714         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
715         switch(obj->tag) {
716                 case LDKBech32Error_MissingSeparator: return 0;
717                 case LDKBech32Error_InvalidChecksum: return 1;
718                 case LDKBech32Error_InvalidLength: return 2;
719                 case LDKBech32Error_InvalidChar: return 3;
720                 case LDKBech32Error_InvalidData: return 4;
721                 case LDKBech32Error_InvalidPadding: return 5;
722                 case LDKBech32Error_MixedCase: return 6;
723                 default: abort();
724         }
725 }
726 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
727         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
728         assert(obj->tag == LDKBech32Error_InvalidChar);
729         int32_t invalid_char_conv = obj->invalid_char;
730         return invalid_char_conv;
731 }
732 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
733         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
734         assert(obj->tag == LDKBech32Error_InvalidData);
735         int8_t invalid_data_conv = obj->invalid_data;
736         return invalid_data_conv;
737 }
738 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
739         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
740         ret.is_owned = false;
741         return ret;
742 }
743 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
744         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
745         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
746         uint64_t ret_ref = 0;
747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
749         return ret_ref;
750 }
751
752 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
753 CHECK(!owner->result_ok);
754         return Bolt12SemanticError_clone(&*owner->contents.err);
755 }
756 uint32_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
757         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
758         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
759         return ret_conv;
760 }
761
762 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
763         LDKRefund ret = *owner->contents.result;
764         ret.is_owned = false;
765         return ret;
766 }
767 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_get_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_get_ok(uint64_t owner) {
768         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
769         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
770         uint64_t ret_ref = 0;
771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
773         return ret_ref;
774 }
775
776 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
777 CHECK(!owner->result_ok);
778         return Bolt12SemanticError_clone(&*owner->contents.err);
779 }
780 uint32_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_get_err"))) TS_CResult_RefundBolt12SemanticErrorZ_get_err(uint64_t owner) {
781         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
782         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
783         return ret_conv;
784 }
785
786 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
787         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
788         switch(obj->tag) {
789                 case LDKCOption_u64Z_Some: return 0;
790                 case LDKCOption_u64Z_None: return 1;
791                 default: abort();
792         }
793 }
794 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
795         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
796         assert(obj->tag == LDKCOption_u64Z_Some);
797         int64_t some_conv = obj->some;
798         return some_conv;
799 }
800 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
801         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
802         for (size_t i = 0; i < ret.datalen; i++) {
803                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
804         }
805         return ret;
806 }
807 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
808         LDKRefund ret = *owner->contents.result;
809         ret.is_owned = false;
810         return ret;
811 }
812 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
813         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
814         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
815         uint64_t ret_ref = 0;
816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
818         return ret_ref;
819 }
820
821 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
822         LDKBolt12ParseError ret = *owner->contents.err;
823         ret.is_owned = false;
824         return ret;
825 }
826 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
827         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
828         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
829         uint64_t ret_ref = 0;
830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
832         return ret_ref;
833 }
834
835 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
836         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
837         switch(obj->tag) {
838                 case LDKRetry_Attempts: return 0;
839                 default: abort();
840         }
841 }
842 int32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
843         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
844         assert(obj->tag == LDKRetry_Attempts);
845         int32_t attempts_conv = obj->attempts;
846         return attempts_conv;
847 }
848 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
849         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
850         switch(obj->tag) {
851                 case LDKDecodeError_UnknownVersion: return 0;
852                 case LDKDecodeError_UnknownRequiredFeature: return 1;
853                 case LDKDecodeError_InvalidValue: return 2;
854                 case LDKDecodeError_ShortRead: return 3;
855                 case LDKDecodeError_BadLengthDescriptor: return 4;
856                 case LDKDecodeError_Io: return 5;
857                 case LDKDecodeError_UnsupportedCompression: return 6;
858                 case LDKDecodeError_DangerousValue: return 7;
859                 default: abort();
860         }
861 }
862 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
863         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
864         assert(obj->tag == LDKDecodeError_Io);
865         uint32_t io_conv = LDKIOError_to_js(obj->io);
866         return io_conv;
867 }
868 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
869 CHECK(owner->result_ok);
870         return Retry_clone(&*owner->contents.result);
871 }
872 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_ok"))) TS_CResult_RetryDecodeErrorZ_get_ok(uint64_t owner) {
873         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
874         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
875         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
876         uint64_t ret_ref = tag_ptr(ret_copy, true);
877         return ret_ref;
878 }
879
880 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
881 CHECK(!owner->result_ok);
882         return DecodeError_clone(&*owner->contents.err);
883 }
884 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_get_err"))) TS_CResult_RetryDecodeErrorZ_get_err(uint64_t owner) {
885         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
886         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
887         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
888         uint64_t ret_ref = tag_ptr(ret_copy, true);
889         return ret_ref;
890 }
891
892 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
893         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
894         switch(obj->tag) {
895                 case LDKAPIError_APIMisuseError: return 0;
896                 case LDKAPIError_FeeRateTooHigh: return 1;
897                 case LDKAPIError_InvalidRoute: return 2;
898                 case LDKAPIError_ChannelUnavailable: return 3;
899                 case LDKAPIError_MonitorUpdateInProgress: return 4;
900                 case LDKAPIError_IncompatibleShutdownScript: return 5;
901                 default: abort();
902         }
903 }
904 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
905         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
906         assert(obj->tag == LDKAPIError_APIMisuseError);
907         LDKStr err_str = obj->api_misuse_error.err;
908                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
909         return err_conv;
910 }
911 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
912         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
913         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
914         LDKStr err_str = obj->fee_rate_too_high.err;
915                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
916         return err_conv;
917 }
918 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
919         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
920         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
921         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
922         return feerate_conv;
923 }
924 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
925         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
926         assert(obj->tag == LDKAPIError_InvalidRoute);
927         LDKStr err_str = obj->invalid_route.err;
928                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
929         return err_conv;
930 }
931 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
932         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
933         assert(obj->tag == LDKAPIError_ChannelUnavailable);
934         LDKStr err_str = obj->channel_unavailable.err;
935                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
936         return err_conv;
937 }
938 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
939         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
940         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
941         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
942                         uint64_t script_ref = 0;
943                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
944                         script_ref = tag_ptr(script_var.inner, false);
945         return script_ref;
946 }
947 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
948 CHECK(owner->result_ok);
949         return *owner->contents.result;
950 }
951 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
952         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
953         CResult_NoneAPIErrorZ_get_ok(owner_conv);
954 }
955
956 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
957 CHECK(!owner->result_ok);
958         return APIError_clone(&*owner->contents.err);
959 }
960 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
961         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
962         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
963         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
964         uint64_t ret_ref = tag_ptr(ret_copy, true);
965         return ret_ref;
966 }
967
968 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
969         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
970         for (size_t i = 0; i < ret.datalen; i++) {
971                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
972         }
973         return ret;
974 }
975 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
976         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
977         for (size_t i = 0; i < ret.datalen; i++) {
978                 ret.data[i] = APIError_clone(&orig->data[i]);
979         }
980         return ret;
981 }
982 uint32_t __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr"))) TS_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(uint64_t ptr) {
983         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
984         switch(obj->tag) {
985                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
986                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
987                 default: abort();
988         }
989 }
990 int8_tArray __attribute__((export_name("TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some"))) TS_LDKCOption_ThirtyTwoBytesZ_Some_get_some(uint64_t ptr) {
991         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
992         assert(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
993         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
994         memcpy(some_arr->elems, obj->some.data, 32);
995         return some_arr;
996 }
997 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
998         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
999         switch(obj->tag) {
1000                 case LDKCOption_CVec_u8ZZ_Some: return 0;
1001                 case LDKCOption_CVec_u8ZZ_None: return 1;
1002                 default: abort();
1003         }
1004 }
1005 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
1006         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1007         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
1008         LDKCVec_u8Z some_var = obj->some;
1009                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
1010                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
1011         return some_arr;
1012 }
1013 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1014         LDKRecipientOnionFields ret = *owner->contents.result;
1015         ret.is_owned = false;
1016         return ret;
1017 }
1018 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
1019         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1020         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1021         uint64_t ret_ref = 0;
1022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1024         return ret_ref;
1025 }
1026
1027 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1028 CHECK(!owner->result_ok);
1029         return DecodeError_clone(&*owner->contents.err);
1030 }
1031 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
1032         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1033         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1034         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1035         uint64_t ret_ref = tag_ptr(ret_copy, true);
1036         return ret_ref;
1037 }
1038
1039 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1040         return owner->a;
1041 }
1042 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_a"))) TS_C2Tuple_u64CVec_u8ZZ_get_a(uint64_t owner) {
1043         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1044         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1045         return ret_conv;
1046 }
1047
1048 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1049         return CVec_u8Z_clone(&owner->b);
1050 }
1051 int8_tArray  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_get_b"))) TS_C2Tuple_u64CVec_u8ZZ_get_b(uint64_t owner) {
1052         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1053         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1054         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1055         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1056         CVec_u8Z_free(ret_var);
1057         return ret_arr;
1058 }
1059
1060 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1061         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1062         for (size_t i = 0; i < ret.datalen; i++) {
1063                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1064         }
1065         return ret;
1066 }
1067 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1068         LDKRecipientOnionFields ret = *owner->contents.result;
1069         ret.is_owned = false;
1070         return ret;
1071 }
1072 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_get_ok(uint64_t owner) {
1073         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1074         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1075         uint64_t ret_ref = 0;
1076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1078         return ret_ref;
1079 }
1080
1081 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1082 CHECK(!owner->result_ok);
1083         return *owner->contents.err;
1084 }
1085 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_get_err"))) TS_CResult_RecipientOnionFieldsNoneZ_get_err(uint64_t owner) {
1086         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1087         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1088 }
1089
1090 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1091         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
1092         ret.is_owned = false;
1093         return ret;
1094 }
1095 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(uint64_t owner) {
1096         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1097         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1098         uint64_t ret_ref = 0;
1099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1101         return ret_ref;
1102 }
1103
1104 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1105 CHECK(!owner->result_ok);
1106         return Bolt12SemanticError_clone(&*owner->contents.err);
1107 }
1108 uint32_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(uint64_t owner) {
1109         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1110         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1111         return ret_conv;
1112 }
1113
1114 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1115         LDKBolt12Invoice ret = *owner->contents.result;
1116         ret.is_owned = false;
1117         return ret;
1118 }
1119 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(uint64_t owner) {
1120         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1121         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1122         uint64_t ret_ref = 0;
1123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1125         return ret_ref;
1126 }
1127
1128 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1129 CHECK(!owner->result_ok);
1130         return Bolt12SemanticError_clone(&*owner->contents.err);
1131 }
1132 uint32_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(uint64_t owner) {
1133         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1134         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1135         return ret_conv;
1136 }
1137
1138 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1139 CHECK(owner->result_ok);
1140         return *owner->contents.result;
1141 }
1142 int8_tArray  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_ok"))) TS_CResult_SchnorrSignatureNoneZ_get_ok(uint64_t owner) {
1143         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1144         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1145         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1146         return ret_arr;
1147 }
1148
1149 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1150 CHECK(!owner->result_ok);
1151         return *owner->contents.err;
1152 }
1153 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_get_err"))) TS_CResult_SchnorrSignatureNoneZ_get_err(uint64_t owner) {
1154         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1155         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1156 }
1157
1158 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1159         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1160         for (size_t i = 0; i < ret.datalen; i++) {
1161                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1162         }
1163         return ret;
1164 }
1165 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(uint64_t ptr) {
1166         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1167         switch(obj->tag) {
1168                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1169                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1170                 default: abort();
1171         }
1172 }
1173 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some"))) TS_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(uint64_t ptr) {
1174         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1175         assert(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1176         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1177                         ptrArray some_arr = NULL;
1178                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1179                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1180                         for (size_t m = 0; m < some_var.datalen; m++) {
1181                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
1182                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
1183                                 some_arr_ptr[m] = some_conv_12_arr;
1184                         }
1185                         
1186         return some_arr;
1187 }
1188 uint32_t __attribute__((export_name("TS_LDKAmount_ty_from_ptr"))) TS_LDKAmount_ty_from_ptr(uint64_t ptr) {
1189         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1190         switch(obj->tag) {
1191                 case LDKAmount_Bitcoin: return 0;
1192                 case LDKAmount_Currency: return 1;
1193                 default: abort();
1194         }
1195 }
1196 int64_t __attribute__((export_name("TS_LDKAmount_Bitcoin_get_amount_msats"))) TS_LDKAmount_Bitcoin_get_amount_msats(uint64_t ptr) {
1197         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1198         assert(obj->tag == LDKAmount_Bitcoin);
1199         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
1200         return amount_msats_conv;
1201 }
1202 int8_tArray __attribute__((export_name("TS_LDKAmount_Currency_get_iso4217_code"))) TS_LDKAmount_Currency_get_iso4217_code(uint64_t ptr) {
1203         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1204         assert(obj->tag == LDKAmount_Currency);
1205         int8_tArray iso4217_code_arr = init_int8_tArray(3, __LINE__);
1206         memcpy(iso4217_code_arr->elems, obj->currency.iso4217_code.data, 3);
1207         return iso4217_code_arr;
1208 }
1209 int64_t __attribute__((export_name("TS_LDKAmount_Currency_get_amount"))) TS_LDKAmount_Currency_get_amount(uint64_t ptr) {
1210         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1211         assert(obj->tag == LDKAmount_Currency);
1212         int64_t amount_conv = obj->currency.amount;
1213         return amount_conv;
1214 }
1215 uint32_t __attribute__((export_name("TS_LDKCOption_AmountZ_ty_from_ptr"))) TS_LDKCOption_AmountZ_ty_from_ptr(uint64_t ptr) {
1216         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1217         switch(obj->tag) {
1218                 case LDKCOption_AmountZ_Some: return 0;
1219                 case LDKCOption_AmountZ_None: return 1;
1220                 default: abort();
1221         }
1222 }
1223 uint64_t __attribute__((export_name("TS_LDKCOption_AmountZ_Some_get_some"))) TS_LDKCOption_AmountZ_Some_get_some(uint64_t ptr) {
1224         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1225         assert(obj->tag == LDKCOption_AmountZ_Some);
1226         uint64_t some_ref = tag_ptr(&obj->some, false);
1227         return some_ref;
1228 }
1229 uint32_t __attribute__((export_name("TS_LDKQuantity_ty_from_ptr"))) TS_LDKQuantity_ty_from_ptr(uint64_t ptr) {
1230         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1231         switch(obj->tag) {
1232                 case LDKQuantity_Bounded: return 0;
1233                 case LDKQuantity_Unbounded: return 1;
1234                 case LDKQuantity_One: return 2;
1235                 default: abort();
1236         }
1237 }
1238 int64_t __attribute__((export_name("TS_LDKQuantity_Bounded_get_bounded"))) TS_LDKQuantity_Bounded_get_bounded(uint64_t ptr) {
1239         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1240         assert(obj->tag == LDKQuantity_Bounded);
1241         int64_t bounded_conv = obj->bounded;
1242         return bounded_conv;
1243 }
1244 uint32_t __attribute__((export_name("TS_LDKCOption_QuantityZ_ty_from_ptr"))) TS_LDKCOption_QuantityZ_ty_from_ptr(uint64_t ptr) {
1245         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1246         switch(obj->tag) {
1247                 case LDKCOption_QuantityZ_Some: return 0;
1248                 case LDKCOption_QuantityZ_None: return 1;
1249                 default: abort();
1250         }
1251 }
1252 uint64_t __attribute__((export_name("TS_LDKCOption_QuantityZ_Some_get_some"))) TS_LDKCOption_QuantityZ_Some_get_some(uint64_t ptr) {
1253         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1254         assert(obj->tag == LDKCOption_QuantityZ_Some);
1255         uint64_t some_ref = tag_ptr(&obj->some, false);
1256         return some_ref;
1257 }
1258 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1259 CHECK(owner->result_ok);
1260         return ThirtyTwoBytes_clone(&*owner->contents.result);
1261 }
1262 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_get_ok(uint64_t owner) {
1263         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1264         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1265         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1266         return ret_arr;
1267 }
1268
1269 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1270 CHECK(!owner->result_ok);
1271         return *owner->contents.err;
1272 }
1273 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_get_err"))) TS_CResult_ThirtyTwoBytesNoneZ_get_err(uint64_t owner) {
1274         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1275         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1276 }
1277
1278 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1279         LDKBlindedPayInfo ret = *owner->contents.result;
1280         ret.is_owned = false;
1281         return ret;
1282 }
1283 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1284         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1285         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1286         uint64_t ret_ref = 0;
1287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1289         return ret_ref;
1290 }
1291
1292 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1293 CHECK(!owner->result_ok);
1294         return DecodeError_clone(&*owner->contents.err);
1295 }
1296 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1297         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1298         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1299         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1300         uint64_t ret_ref = tag_ptr(ret_copy, true);
1301         return ret_ref;
1302 }
1303
1304 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1305         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1306         ret.is_owned = false;
1307         return ret;
1308 }
1309 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1310         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1311         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1312         uint64_t ret_ref = 0;
1313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1315         return ret_ref;
1316 }
1317
1318 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1319 CHECK(!owner->result_ok);
1320         return DecodeError_clone(&*owner->contents.err);
1321 }
1322 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1323         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1324         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1325         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1326         uint64_t ret_ref = tag_ptr(ret_copy, true);
1327         return ret_ref;
1328 }
1329
1330 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1331         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1332         ret.is_owned = false;
1333         return ret;
1334 }
1335 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1336         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1337         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1338         uint64_t ret_ref = 0;
1339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1341         return ret_ref;
1342 }
1343
1344 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1345 CHECK(!owner->result_ok);
1346         return DecodeError_clone(&*owner->contents.err);
1347 }
1348 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1349         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1350         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1351         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1352         uint64_t ret_ref = tag_ptr(ret_copy, true);
1353         return ret_ref;
1354 }
1355
1356 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1357         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1358         switch(obj->tag) {
1359                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1360                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1361                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1362                 default: abort();
1363         }
1364 }
1365 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1366         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1367         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1368         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1369                         uint64_t outpoint_ref = 0;
1370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1371                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1372         return outpoint_ref;
1373 }
1374 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1375         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1376         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1377         LDKTxOut* output_ref = &obj->static_output.output;
1378         return tag_ptr(output_ref, false);
1379 }
1380 int8_tArray __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(uint64_t ptr) {
1381         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1382         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1383         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1384         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1385         return channel_keys_id_arr;
1386 }
1387 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1388         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1389         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1390         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1391                         uint64_t delayed_payment_output_ref = 0;
1392                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1393                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1394         return delayed_payment_output_ref;
1395 }
1396 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1397         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1398         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1399         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1400                         uint64_t static_payment_output_ref = 0;
1401                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1402                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1403         return static_payment_output_ref;
1404 }
1405 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1406 CHECK(owner->result_ok);
1407         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1408 }
1409 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1410         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1411         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1412         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1413         uint64_t ret_ref = tag_ptr(ret_copy, true);
1414         return ret_ref;
1415 }
1416
1417 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1418 CHECK(!owner->result_ok);
1419         return DecodeError_clone(&*owner->contents.err);
1420 }
1421 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1422         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1423         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1424         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1425         uint64_t ret_ref = tag_ptr(ret_copy, true);
1426         return ret_ref;
1427 }
1428
1429 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1430         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1431         for (size_t i = 0; i < ret.datalen; i++) {
1432                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1433         }
1434         return ret;
1435 }
1436 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1437         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1438         for (size_t i = 0; i < ret.datalen; i++) {
1439                 ret.data[i] = TxOut_clone(&orig->data[i]);
1440         }
1441         return ret;
1442 }
1443 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1444         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1445         switch(obj->tag) {
1446                 case LDKCOption_u32Z_Some: return 0;
1447                 case LDKCOption_u32Z_None: return 1;
1448                 default: abort();
1449         }
1450 }
1451 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1452         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1453         assert(obj->tag == LDKCOption_u32Z_Some);
1454         int32_t some_conv = obj->some;
1455         return some_conv;
1456 }
1457 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1458         return CVec_u8Z_clone(&owner->a);
1459 }
1460 int8_tArray  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_a"))) TS_C2Tuple_CVec_u8Zu64Z_get_a(uint64_t owner) {
1461         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1462         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1463         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1464         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1465         CVec_u8Z_free(ret_var);
1466         return ret_arr;
1467 }
1468
1469 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1470         return owner->b;
1471 }
1472 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_get_b"))) TS_C2Tuple_CVec_u8Zu64Z_get_b(uint64_t owner) {
1473         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1474         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1475         return ret_conv;
1476 }
1477
1478 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1479 CHECK(owner->result_ok);
1480         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1481 }
1482 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(uint64_t owner) {
1483         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1484         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1485         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1486         return tag_ptr(ret_conv, true);
1487 }
1488
1489 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1490 CHECK(!owner->result_ok);
1491         return *owner->contents.err;
1492 }
1493 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(uint64_t owner) {
1494         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1495         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1496 }
1497
1498 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1499         LDKChannelDerivationParameters ret = *owner->contents.result;
1500         ret.is_owned = false;
1501         return ret;
1502 }
1503 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(uint64_t owner) {
1504         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1505         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1506         uint64_t ret_ref = 0;
1507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1509         return ret_ref;
1510 }
1511
1512 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1513 CHECK(!owner->result_ok);
1514         return DecodeError_clone(&*owner->contents.err);
1515 }
1516 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(uint64_t owner) {
1517         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1518         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1519         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1520         uint64_t ret_ref = tag_ptr(ret_copy, true);
1521         return ret_ref;
1522 }
1523
1524 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1525         LDKHTLCDescriptor ret = *owner->contents.result;
1526         ret.is_owned = false;
1527         return ret;
1528 }
1529 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1530         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1531         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1532         uint64_t ret_ref = 0;
1533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1535         return ret_ref;
1536 }
1537
1538 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1539 CHECK(!owner->result_ok);
1540         return DecodeError_clone(&*owner->contents.err);
1541 }
1542 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_get_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1543         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1544         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1545         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1546         uint64_t ret_ref = tag_ptr(ret_copy, true);
1547         return ret_ref;
1548 }
1549
1550 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1551 CHECK(owner->result_ok);
1552         return *owner->contents.result;
1553 }
1554 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1555         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1556         CResult_NoneNoneZ_get_ok(owner_conv);
1557 }
1558
1559 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1560 CHECK(!owner->result_ok);
1561         return *owner->contents.err;
1562 }
1563 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1564         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1565         CResult_NoneNoneZ_get_err(owner_conv);
1566 }
1567
1568 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1569 CHECK(owner->result_ok);
1570         return *owner->contents.result;
1571 }
1572 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1573         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1574         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1575         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1576         return ret_arr;
1577 }
1578
1579 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1580 CHECK(!owner->result_ok);
1581         return *owner->contents.err;
1582 }
1583 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1584         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1585         CResult_PublicKeyNoneZ_get_err(owner_conv);
1586 }
1587
1588 uint32_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_ty_from_ptr"))) TS_LDKCOption_BigEndianScalarZ_ty_from_ptr(uint64_t ptr) {
1589         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1590         switch(obj->tag) {
1591                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1592                 case LDKCOption_BigEndianScalarZ_None: return 1;
1593                 default: abort();
1594         }
1595 }
1596 uint64_t __attribute__((export_name("TS_LDKCOption_BigEndianScalarZ_Some_get_some"))) TS_LDKCOption_BigEndianScalarZ_Some_get_some(uint64_t ptr) {
1597         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1598         assert(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1599         LDKBigEndianScalar* some_ref = &obj->some;
1600         return tag_ptr(some_ref, false);
1601 }
1602 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1603 CHECK(owner->result_ok);
1604         return *owner->contents.result;
1605 }
1606 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1607         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1608         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1609         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1610         return ret_arr;
1611 }
1612
1613 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1614 CHECK(!owner->result_ok);
1615         return *owner->contents.err;
1616 }
1617 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1618         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1619         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1620 }
1621
1622 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1623 CHECK(owner->result_ok);
1624         return *owner->contents.result;
1625 }
1626 int8_tArray  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_ok"))) TS_CResult_ECDSASignatureNoneZ_get_ok(uint64_t owner) {
1627         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1628         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1629         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1630         return ret_arr;
1631 }
1632
1633 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1634 CHECK(!owner->result_ok);
1635         return *owner->contents.err;
1636 }
1637 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_get_err"))) TS_CResult_ECDSASignatureNoneZ_get_err(uint64_t owner) {
1638         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1639         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1640 }
1641
1642 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1643 CHECK(owner->result_ok);
1644         return *owner->contents.result;
1645 }
1646 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
1647         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1648         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
1649         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1650         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1651         return ret_arr;
1652 }
1653
1654 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1655 CHECK(!owner->result_ok);
1656         return *owner->contents.err;
1657 }
1658 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
1659         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1660         CResult_TransactionNoneZ_get_err(owner_conv);
1661 }
1662
1663 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1664         return owner->a;
1665 }
1666 int8_tArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(uint64_t owner) {
1667         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1668         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1669         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1670         return ret_arr;
1671 }
1672
1673 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1674         return owner->b;
1675 }
1676 ptrArray  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(uint64_t owner) {
1677         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1678         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1679         ptrArray ret_arr = NULL;
1680         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1681         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1682         for (size_t m = 0; m < ret_var.datalen; m++) {
1683                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1684                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1685                 ret_arr_ptr[m] = ret_conv_12_arr;
1686         }
1687         
1688         return ret_arr;
1689 }
1690
1691 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1692 CHECK(owner->result_ok);
1693         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1694 }
1695 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(uint64_t owner) {
1696         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1697         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1698         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1699         return tag_ptr(ret_conv, true);
1700 }
1701
1702 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1703 CHECK(!owner->result_ok);
1704         return *owner->contents.err;
1705 }
1706 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(uint64_t owner) {
1707         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1708         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1709 }
1710
1711 typedef struct LDKChannelSigner_JCalls {
1712         atomic_size_t refcnt;
1713         uint32_t instance_ptr;
1714 } LDKChannelSigner_JCalls;
1715 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1716         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1717         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1718                 FREE(j_calls);
1719         }
1720 }
1721 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1722         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1723         int64_t idx_conv = idx;
1724         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1725         LDKPublicKey ret_ref;
1726         CHECK(ret->arr_len == 33);
1727         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1728         return ret_ref;
1729 }
1730 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1731         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1732         int64_t idx_conv = idx;
1733         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1734         LDKThirtyTwoBytes ret_ref;
1735         CHECK(ret->arr_len == 32);
1736         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1737         return ret_ref;
1738 }
1739 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1740         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1741         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1742         uint64_t holder_tx_ref = 0;
1743         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1744         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1745         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1746         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1747         ptrArray outbound_htlc_preimages_arr = NULL;
1748         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1749         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1750         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1751                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1752                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1753                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1754         }
1755         
1756         FREE(outbound_htlc_preimages_var.data);
1757         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);
1758         void* ret_ptr = untag_ptr(ret);
1759         CHECK_ACCESS(ret_ptr);
1760         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1761         FREE(untag_ptr(ret));
1762         return ret_conv;
1763 }
1764 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1765         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1766         int64_t idx_conv = idx;
1767         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1768         memcpy(secret_arr->elems, *secret, 32);
1769         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
1770         void* ret_ptr = untag_ptr(ret);
1771         CHECK_ACCESS(ret_ptr);
1772         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1773         FREE(untag_ptr(ret));
1774         return ret_conv;
1775 }
1776 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1777         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1778         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 4, 0, 0, 0, 0, 0, 0);
1779         LDKThirtyTwoBytes ret_ref;
1780         CHECK(ret->arr_len == 32);
1781         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1782         return ret_ref;
1783 }
1784 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1785         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1786         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1787         uint64_t channel_parameters_ref = 0;
1788         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1789         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1790         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1791         js_invoke_function_buuuuu(j_calls->instance_ptr, 5, channel_parameters_ref, 0, 0, 0, 0, 0);
1792 }
1793 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1794         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1795         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1796 }
1797 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1798         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1799         atomic_init(&calls->refcnt, 1);
1800         calls->instance_ptr = o;
1801
1802         LDKChannelPublicKeys pubkeys_conv;
1803         pubkeys_conv.inner = untag_ptr(pubkeys);
1804         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1805         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1806
1807         LDKChannelSigner ret = {
1808                 .this_arg = (void*) calls,
1809                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1810                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1811                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1812                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1813                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1814                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1815                 .free = LDKChannelSigner_JCalls_free,
1816                 .pubkeys = pubkeys_conv,
1817                 .set_pubkeys = NULL,
1818         };
1819         return ret;
1820 }
1821 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1822         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1823         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1824         return tag_ptr(res_ptr, true);
1825 }
1826 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1827         void* this_arg_ptr = untag_ptr(this_arg);
1828         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1829         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1830         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1831         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1832         return ret_arr;
1833 }
1834
1835 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1836         void* this_arg_ptr = untag_ptr(this_arg);
1837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1838         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1840         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1841         return ret_arr;
1842 }
1843
1844 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) {
1845         void* this_arg_ptr = untag_ptr(this_arg);
1846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1847         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1848         LDKHolderCommitmentTransaction holder_tx_conv;
1849         holder_tx_conv.inner = untag_ptr(holder_tx);
1850         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1851         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1852         holder_tx_conv.is_owned = false;
1853         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1854         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1855         if (outbound_htlc_preimages_constr.datalen > 0)
1856                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1857         else
1858                 outbound_htlc_preimages_constr.data = NULL;
1859         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1860         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
1861                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
1862                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
1863                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
1864                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
1865                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
1866         }
1867         FREE(outbound_htlc_preimages);
1868         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1869         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1870         return tag_ptr(ret_conv, true);
1871 }
1872
1873 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) {
1874         void* this_arg_ptr = untag_ptr(this_arg);
1875         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1876         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1877         uint8_t secret_arr[32];
1878         CHECK(secret->arr_len == 32);
1879         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1880         uint8_t (*secret_ref)[32] = &secret_arr;
1881         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1882         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1883         return tag_ptr(ret_conv, true);
1884 }
1885
1886 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1887         void* this_arg_ptr = untag_ptr(this_arg);
1888         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1889         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1890         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1891         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1892         return ret_arr;
1893 }
1894
1895 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1896         void* this_arg_ptr = untag_ptr(this_arg);
1897         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1898         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1899         LDKChannelTransactionParameters channel_parameters_conv;
1900         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1901         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1902         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1903         channel_parameters_conv.is_owned = false;
1904         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1905 }
1906
1907 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1908         if (this_arg->set_pubkeys != NULL)
1909                 this_arg->set_pubkeys(this_arg);
1910         return this_arg->pubkeys;
1911 }
1912 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1913         void* this_arg_ptr = untag_ptr(this_arg);
1914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1915         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1916         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1917         uint64_t ret_ref = 0;
1918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1920         return ret_ref;
1921 }
1922
1923 typedef struct LDKEcdsaChannelSigner_JCalls {
1924         atomic_size_t refcnt;
1925         uint32_t instance_ptr;
1926         LDKChannelSigner_JCalls* ChannelSigner;
1927 } LDKEcdsaChannelSigner_JCalls;
1928 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1929         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1930         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1931                 FREE(j_calls);
1932         }
1933 }
1934 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) {
1935         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1936         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1937         uint64_t commitment_tx_ref = 0;
1938         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1939         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1940         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1941         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1942         ptrArray inbound_htlc_preimages_arr = NULL;
1943         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1944         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1945         for (size_t m = 0; m < inbound_htlc_preimages_var.datalen; m++) {
1946                 int8_tArray inbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1947                 memcpy(inbound_htlc_preimages_conv_12_arr->elems, inbound_htlc_preimages_var.data[m].data, 32);
1948                 inbound_htlc_preimages_arr_ptr[m] = inbound_htlc_preimages_conv_12_arr;
1949         }
1950         
1951         FREE(inbound_htlc_preimages_var.data);
1952         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1953         ptrArray outbound_htlc_preimages_arr = NULL;
1954         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1955         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1956         for (size_t m = 0; m < outbound_htlc_preimages_var.datalen; m++) {
1957                 int8_tArray outbound_htlc_preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1958                 memcpy(outbound_htlc_preimages_conv_12_arr->elems, outbound_htlc_preimages_var.data[m].data, 32);
1959                 outbound_htlc_preimages_arr_ptr[m] = outbound_htlc_preimages_conv_12_arr;
1960         }
1961         
1962         FREE(outbound_htlc_preimages_var.data);
1963         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);
1964         void* ret_ptr = untag_ptr(ret);
1965         CHECK_ACCESS(ret_ptr);
1966         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1967         FREE(untag_ptr(ret));
1968         return ret_conv;
1969 }
1970 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1971         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1972         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1973         uint64_t commitment_tx_ref = 0;
1974         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1975         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1976         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1977         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
1978         void* ret_ptr = untag_ptr(ret);
1979         CHECK_ACCESS(ret_ptr);
1980         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1981         FREE(untag_ptr(ret));
1982         return ret_conv;
1983 }
1984 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]) {
1985         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1986         LDKTransaction justice_tx_var = justice_tx;
1987         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1988         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1989         Transaction_free(justice_tx_var);
1990         uint32_t input_conv = input;
1991         int64_t amount_conv = amount;
1992         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1993         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1994         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);
1995         void* ret_ptr = untag_ptr(ret);
1996         CHECK_ACCESS(ret_ptr);
1997         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1998         FREE(untag_ptr(ret));
1999         return ret_conv;
2000 }
2001 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) {
2002         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2003         LDKTransaction justice_tx_var = justice_tx;
2004         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2005         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2006         Transaction_free(justice_tx_var);
2007         uint32_t input_conv = input;
2008         int64_t amount_conv = amount;
2009         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2010         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2011         LDKHTLCOutputInCommitment htlc_var = *htlc;
2012         uint64_t htlc_ref = 0;
2013         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2014         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2015         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2016         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);
2017         void* ret_ptr = untag_ptr(ret);
2018         CHECK_ACCESS(ret_ptr);
2019         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2020         FREE(untag_ptr(ret));
2021         return ret_conv;
2022 }
2023 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2024         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2025         LDKTransaction htlc_tx_var = htlc_tx;
2026         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2027         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2028         Transaction_free(htlc_tx_var);
2029         uint32_t input_conv = input;
2030         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2031         uint64_t htlc_descriptor_ref = 0;
2032         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2033         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2034         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2035         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);
2036         void* ret_ptr = untag_ptr(ret);
2037         CHECK_ACCESS(ret_ptr);
2038         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2039         FREE(untag_ptr(ret));
2040         return ret_conv;
2041 }
2042 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) {
2043         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2044         LDKTransaction htlc_tx_var = htlc_tx;
2045         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2046         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2047         Transaction_free(htlc_tx_var);
2048         uint32_t input_conv = input;
2049         int64_t amount_conv = amount;
2050         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2051         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2052         LDKHTLCOutputInCommitment htlc_var = *htlc;
2053         uint64_t htlc_ref = 0;
2054         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2055         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2056         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2057         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);
2058         void* ret_ptr = untag_ptr(ret);
2059         CHECK_ACCESS(ret_ptr);
2060         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2061         FREE(untag_ptr(ret));
2062         return ret_conv;
2063 }
2064 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2065         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2066         LDKClosingTransaction closing_tx_var = *closing_tx;
2067         uint64_t closing_tx_ref = 0;
2068         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2069         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2070         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2071         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
2072         void* ret_ptr = untag_ptr(ret);
2073         CHECK_ACCESS(ret_ptr);
2074         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2075         FREE(untag_ptr(ret));
2076         return ret_conv;
2077 }
2078 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2079         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2080         LDKTransaction anchor_tx_var = anchor_tx;
2081         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2082         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2083         Transaction_free(anchor_tx_var);
2084         uint32_t input_conv = input;
2085         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
2086         void* ret_ptr = untag_ptr(ret);
2087         CHECK_ACCESS(ret_ptr);
2088         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2089         FREE(untag_ptr(ret));
2090         return ret_conv;
2091 }
2092 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2093         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2094         LDKUnsignedChannelAnnouncement msg_var = *msg;
2095         uint64_t msg_ref = 0;
2096         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2098         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2099         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
2100         void* ret_ptr = untag_ptr(ret);
2101         CHECK_ACCESS(ret_ptr);
2102         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2103         FREE(untag_ptr(ret));
2104         return ret_conv;
2105 }
2106 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2107         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2108         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2109         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2110 }
2111 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2112         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2113         atomic_init(&calls->refcnt, 1);
2114         calls->instance_ptr = o;
2115
2116         LDKChannelPublicKeys pubkeys_conv;
2117         pubkeys_conv.inner = untag_ptr(pubkeys);
2118         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2119         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2120
2121         LDKEcdsaChannelSigner ret = {
2122                 .this_arg = (void*) calls,
2123                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2124                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2125                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2126                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2127                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2128                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2129                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2130                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2131                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2132                 .free = LDKEcdsaChannelSigner_JCalls_free,
2133                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2134         };
2135         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2136         return ret;
2137 }
2138 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2139         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2140         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2141         return tag_ptr(res_ptr, true);
2142 }
2143 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) {
2144         void* this_arg_ptr = untag_ptr(this_arg);
2145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2146         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2147         LDKCommitmentTransaction commitment_tx_conv;
2148         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2149         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2150         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2151         commitment_tx_conv.is_owned = false;
2152         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2153         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2154         if (inbound_htlc_preimages_constr.datalen > 0)
2155                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2156         else
2157                 inbound_htlc_preimages_constr.data = NULL;
2158         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2159         for (size_t m = 0; m < inbound_htlc_preimages_constr.datalen; m++) {
2160                 int8_tArray inbound_htlc_preimages_conv_12 = inbound_htlc_preimages_vals[m];
2161                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_12_ref;
2162                 CHECK(inbound_htlc_preimages_conv_12->arr_len == 32);
2163                 memcpy(inbound_htlc_preimages_conv_12_ref.data, inbound_htlc_preimages_conv_12->elems, 32); FREE(inbound_htlc_preimages_conv_12);
2164                 inbound_htlc_preimages_constr.data[m] = inbound_htlc_preimages_conv_12_ref;
2165         }
2166         FREE(inbound_htlc_preimages);
2167         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2168         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2169         if (outbound_htlc_preimages_constr.datalen > 0)
2170                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2171         else
2172                 outbound_htlc_preimages_constr.data = NULL;
2173         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2174         for (size_t m = 0; m < outbound_htlc_preimages_constr.datalen; m++) {
2175                 int8_tArray outbound_htlc_preimages_conv_12 = outbound_htlc_preimages_vals[m];
2176                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_12_ref;
2177                 CHECK(outbound_htlc_preimages_conv_12->arr_len == 32);
2178                 memcpy(outbound_htlc_preimages_conv_12_ref.data, outbound_htlc_preimages_conv_12->elems, 32); FREE(outbound_htlc_preimages_conv_12);
2179                 outbound_htlc_preimages_constr.data[m] = outbound_htlc_preimages_conv_12_ref;
2180         }
2181         FREE(outbound_htlc_preimages);
2182         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2183         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2184         return tag_ptr(ret_conv, true);
2185 }
2186
2187 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment"))) TS_EcdsaChannelSigner_sign_holder_commitment(uint64_t this_arg, uint64_t commitment_tx) {
2188         void* this_arg_ptr = untag_ptr(this_arg);
2189         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2190         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2191         LDKHolderCommitmentTransaction commitment_tx_conv;
2192         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2193         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2194         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2195         commitment_tx_conv.is_owned = false;
2196         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2197         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2198         return tag_ptr(ret_conv, true);
2199 }
2200
2201 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) {
2202         void* this_arg_ptr = untag_ptr(this_arg);
2203         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2204         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2205         LDKTransaction justice_tx_ref;
2206         justice_tx_ref.datalen = justice_tx->arr_len;
2207         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2208         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2209         justice_tx_ref.data_is_owned = true;
2210         uint8_t per_commitment_key_arr[32];
2211         CHECK(per_commitment_key->arr_len == 32);
2212         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2213         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2214         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2215         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2216         return tag_ptr(ret_conv, true);
2217 }
2218
2219 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) {
2220         void* this_arg_ptr = untag_ptr(this_arg);
2221         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2222         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2223         LDKTransaction justice_tx_ref;
2224         justice_tx_ref.datalen = justice_tx->arr_len;
2225         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2226         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2227         justice_tx_ref.data_is_owned = true;
2228         uint8_t per_commitment_key_arr[32];
2229         CHECK(per_commitment_key->arr_len == 32);
2230         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2231         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2232         LDKHTLCOutputInCommitment htlc_conv;
2233         htlc_conv.inner = untag_ptr(htlc);
2234         htlc_conv.is_owned = ptr_is_owned(htlc);
2235         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2236         htlc_conv.is_owned = false;
2237         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2238         *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);
2239         return tag_ptr(ret_conv, true);
2240 }
2241
2242 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) {
2243         void* this_arg_ptr = untag_ptr(this_arg);
2244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2245         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2246         LDKTransaction htlc_tx_ref;
2247         htlc_tx_ref.datalen = htlc_tx->arr_len;
2248         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2249         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2250         htlc_tx_ref.data_is_owned = true;
2251         LDKHTLCDescriptor htlc_descriptor_conv;
2252         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2253         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2254         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2255         htlc_descriptor_conv.is_owned = false;
2256         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2257         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2258         return tag_ptr(ret_conv, true);
2259 }
2260
2261 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) {
2262         void* this_arg_ptr = untag_ptr(this_arg);
2263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2264         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2265         LDKTransaction htlc_tx_ref;
2266         htlc_tx_ref.datalen = htlc_tx->arr_len;
2267         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2268         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2269         htlc_tx_ref.data_is_owned = true;
2270         LDKPublicKey per_commitment_point_ref;
2271         CHECK(per_commitment_point->arr_len == 33);
2272         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2273         LDKHTLCOutputInCommitment htlc_conv;
2274         htlc_conv.inner = untag_ptr(htlc);
2275         htlc_conv.is_owned = ptr_is_owned(htlc);
2276         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2277         htlc_conv.is_owned = false;
2278         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2279         *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);
2280         return tag_ptr(ret_conv, true);
2281 }
2282
2283 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2284         void* this_arg_ptr = untag_ptr(this_arg);
2285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2286         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2287         LDKClosingTransaction closing_tx_conv;
2288         closing_tx_conv.inner = untag_ptr(closing_tx);
2289         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2290         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2291         closing_tx_conv.is_owned = false;
2292         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2293         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2294         return tag_ptr(ret_conv, true);
2295 }
2296
2297 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) {
2298         void* this_arg_ptr = untag_ptr(this_arg);
2299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2300         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2301         LDKTransaction anchor_tx_ref;
2302         anchor_tx_ref.datalen = anchor_tx->arr_len;
2303         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2304         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2305         anchor_tx_ref.data_is_owned = true;
2306         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2307         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2308         return tag_ptr(ret_conv, true);
2309 }
2310
2311 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) {
2312         void* this_arg_ptr = untag_ptr(this_arg);
2313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2314         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2315         LDKUnsignedChannelAnnouncement msg_conv;
2316         msg_conv.inner = untag_ptr(msg);
2317         msg_conv.is_owned = ptr_is_owned(msg);
2318         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2319         msg_conv.is_owned = false;
2320         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2321         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2322         return tag_ptr(ret_conv, true);
2323 }
2324
2325 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2326         atomic_size_t refcnt;
2327         uint32_t instance_ptr;
2328         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2329         LDKChannelSigner_JCalls* ChannelSigner;
2330 } LDKWriteableEcdsaChannelSigner_JCalls;
2331 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2332         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2333         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2334                 FREE(j_calls);
2335         }
2336 }
2337 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2338         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2339         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2340         LDKCVec_u8Z ret_ref;
2341         ret_ref.datalen = ret->arr_len;
2342         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2343         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2344         return ret_ref;
2345 }
2346 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2347         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2348         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2349         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2350         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2351 }
2352 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2353         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2354         atomic_init(&calls->refcnt, 1);
2355         calls->instance_ptr = o;
2356
2357         LDKChannelPublicKeys pubkeys_conv;
2358         pubkeys_conv.inner = untag_ptr(pubkeys);
2359         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2360         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2361
2362         LDKWriteableEcdsaChannelSigner ret = {
2363                 .this_arg = (void*) calls,
2364                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2365                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2366                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2367                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2368         };
2369         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2370         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2371         return ret;
2372 }
2373 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2374         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2375         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2376         return tag_ptr(res_ptr, true);
2377 }
2378 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2379         void* this_arg_ptr = untag_ptr(this_arg);
2380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2381         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2382         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2383         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2384         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2385         CVec_u8Z_free(ret_var);
2386         return ret_arr;
2387 }
2388
2389 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2390 CHECK(owner->result_ok);
2391         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2392 }
2393 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2394         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2395         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2396         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2397         return tag_ptr(ret_ret, true);
2398 }
2399
2400 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2401 CHECK(!owner->result_ok);
2402         return DecodeError_clone(&*owner->contents.err);
2403 }
2404 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2405         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2406         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2407         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2408         uint64_t ret_ref = tag_ptr(ret_copy, true);
2409         return ret_ref;
2410 }
2411
2412 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2413 CHECK(owner->result_ok);
2414         return CVec_u8Z_clone(&*owner->contents.result);
2415 }
2416 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_ok"))) TS_CResult_CVec_u8ZNoneZ_get_ok(uint64_t owner) {
2417         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2418         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2419         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2420         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2421         CVec_u8Z_free(ret_var);
2422         return ret_arr;
2423 }
2424
2425 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2426 CHECK(!owner->result_ok);
2427         return *owner->contents.err;
2428 }
2429 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_get_err"))) TS_CResult_CVec_u8ZNoneZ_get_err(uint64_t owner) {
2430         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2431         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2432 }
2433
2434 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2435         LDKShutdownScript ret = *owner->contents.result;
2436         ret.is_owned = false;
2437         return ret;
2438 }
2439 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2440         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2441         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2442         uint64_t ret_ref = 0;
2443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2445         return ret_ref;
2446 }
2447
2448 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2449 CHECK(!owner->result_ok);
2450         return *owner->contents.err;
2451 }
2452 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2453         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2454         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2455 }
2456
2457 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
2458         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2459         switch(obj->tag) {
2460                 case LDKCOption_u16Z_Some: return 0;
2461                 case LDKCOption_u16Z_None: return 1;
2462                 default: abort();
2463         }
2464 }
2465 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
2466         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2467         assert(obj->tag == LDKCOption_u16Z_Some);
2468         int16_t some_conv = obj->some;
2469         return some_conv;
2470 }
2471 uint32_t __attribute__((export_name("TS_LDKCOption_boolZ_ty_from_ptr"))) TS_LDKCOption_boolZ_ty_from_ptr(uint64_t ptr) {
2472         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2473         switch(obj->tag) {
2474                 case LDKCOption_boolZ_Some: return 0;
2475                 case LDKCOption_boolZ_None: return 1;
2476                 default: abort();
2477         }
2478 }
2479 jboolean __attribute__((export_name("TS_LDKCOption_boolZ_Some_get_some"))) TS_LDKCOption_boolZ_Some_get_some(uint64_t ptr) {
2480         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2481         assert(obj->tag == LDKCOption_boolZ_Some);
2482         jboolean some_conv = obj->some;
2483         return some_conv;
2484 }
2485 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2486 CHECK(owner->result_ok);
2487         return Witness_clone(&*owner->contents.result);
2488 }
2489 int8_tArray  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_ok"))) TS_CResult_WitnessNoneZ_get_ok(uint64_t owner) {
2490         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2491         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2492         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2493         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2494         Witness_free(ret_var);
2495         return ret_arr;
2496 }
2497
2498 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2499 CHECK(!owner->result_ok);
2500         return *owner->contents.err;
2501 }
2502 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_get_err"))) TS_CResult_WitnessNoneZ_get_err(uint64_t owner) {
2503         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2504         CResult_WitnessNoneZ_get_err(owner_conv);
2505 }
2506
2507 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2508         LDKInMemorySigner ret = *owner->contents.result;
2509         ret.is_owned = false;
2510         return ret;
2511 }
2512 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2513         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2514         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2515         uint64_t ret_ref = 0;
2516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2518         return ret_ref;
2519 }
2520
2521 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2522 CHECK(!owner->result_ok);
2523         return DecodeError_clone(&*owner->contents.err);
2524 }
2525 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2526         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2527         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2528         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2529         uint64_t ret_ref = tag_ptr(ret_copy, true);
2530         return ret_ref;
2531 }
2532
2533 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2534         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2535         for (size_t i = 0; i < ret.datalen; i++) {
2536                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2537         }
2538         return ret;
2539 }
2540 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2541         LDKRoute ret = *owner->contents.result;
2542         ret.is_owned = false;
2543         return ret;
2544 }
2545 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2546         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2547         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2548         uint64_t ret_ref = 0;
2549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2551         return ret_ref;
2552 }
2553
2554 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2555         LDKLightningError ret = *owner->contents.err;
2556         ret.is_owned = false;
2557         return ret;
2558 }
2559 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2560         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2561         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2562         uint64_t ret_ref = 0;
2563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2565         return ret_ref;
2566 }
2567
2568 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2569         LDKBlindedPayInfo ret = owner->a;
2570         ret.is_owned = false;
2571         return ret;
2572 }
2573 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2574         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2575         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2576         uint64_t ret_ref = 0;
2577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2579         return ret_ref;
2580 }
2581
2582 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2583         LDKBlindedPath ret = owner->b;
2584         ret.is_owned = false;
2585         return ret;
2586 }
2587 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2588         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2589         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2590         uint64_t ret_ref = 0;
2591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2593         return ret_ref;
2594 }
2595
2596 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2597         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2598         for (size_t i = 0; i < ret.datalen; i++) {
2599                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2600         }
2601         return ret;
2602 }
2603 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2604 CHECK(owner->result_ok);
2605         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
2606 }
2607 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(uint64_t owner) {
2608         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2609         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
2610         uint64_tArray ret_arr = NULL;
2611         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2612         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2613         for (size_t l = 0; l < ret_var.datalen; l++) {
2614                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
2615                 *ret_conv_37_conv = ret_var.data[l];
2616                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
2617         }
2618         
2619         FREE(ret_var.data);
2620         return ret_arr;
2621 }
2622
2623 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
2624 CHECK(!owner->result_ok);
2625         return *owner->contents.err;
2626 }
2627 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(uint64_t owner) {
2628         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
2629         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
2630 }
2631
2632 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2633         LDKOnionMessagePath ret = *owner->contents.result;
2634         ret.is_owned = false;
2635         return ret;
2636 }
2637 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
2638         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2639         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
2640         uint64_t ret_ref = 0;
2641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2643         return ret_ref;
2644 }
2645
2646 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
2647 CHECK(!owner->result_ok);
2648         return *owner->contents.err;
2649 }
2650 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
2651         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
2652         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
2653 }
2654
2655 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2656 CHECK(owner->result_ok);
2657         return CVec_BlindedPathZ_clone(&*owner->contents.result);
2658 }
2659 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_get_ok(uint64_t owner) {
2660         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2661         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
2662         uint64_tArray ret_arr = NULL;
2663         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2664         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2665         for (size_t n = 0; n < ret_var.datalen; n++) {
2666                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
2667                 uint64_t ret_conv_13_ref = 0;
2668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
2669                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
2670                 ret_arr_ptr[n] = ret_conv_13_ref;
2671         }
2672         
2673         FREE(ret_var.data);
2674         return ret_arr;
2675 }
2676
2677 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
2678 CHECK(!owner->result_ok);
2679         return *owner->contents.err;
2680 }
2681 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_get_err"))) TS_CResult_CVec_BlindedPathZNoneZ_get_err(uint64_t owner) {
2682         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
2683         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
2684 }
2685
2686 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2687         LDKInFlightHtlcs ret = *owner->contents.result;
2688         ret.is_owned = false;
2689         return ret;
2690 }
2691 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2692         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2693         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2694         uint64_t ret_ref = 0;
2695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2697         return ret_ref;
2698 }
2699
2700 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2701 CHECK(!owner->result_ok);
2702         return DecodeError_clone(&*owner->contents.err);
2703 }
2704 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2705         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2707         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2708         uint64_t ret_ref = tag_ptr(ret_copy, true);
2709         return ret_ref;
2710 }
2711
2712 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2713         LDKRouteHop ret = *owner->contents.result;
2714         ret.is_owned = false;
2715         return ret;
2716 }
2717 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2718         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2719         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2720         uint64_t ret_ref = 0;
2721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2723         return ret_ref;
2724 }
2725
2726 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2727 CHECK(!owner->result_ok);
2728         return DecodeError_clone(&*owner->contents.err);
2729 }
2730 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2731         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2733         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2734         uint64_t ret_ref = tag_ptr(ret_copy, true);
2735         return ret_ref;
2736 }
2737
2738 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2739         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2740         for (size_t i = 0; i < ret.datalen; i++) {
2741                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2742         }
2743         return ret;
2744 }
2745 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2746         LDKBlindedTail ret = *owner->contents.result;
2747         ret.is_owned = false;
2748         return ret;
2749 }
2750 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2751         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2752         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2753         uint64_t ret_ref = 0;
2754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2756         return ret_ref;
2757 }
2758
2759 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2760 CHECK(!owner->result_ok);
2761         return DecodeError_clone(&*owner->contents.err);
2762 }
2763 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2764         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2766         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2767         uint64_t ret_ref = tag_ptr(ret_copy, true);
2768         return ret_ref;
2769 }
2770
2771 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2772         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2773         for (size_t i = 0; i < ret.datalen; i++) {
2774                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2775         }
2776         return ret;
2777 }
2778 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2779         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2780         for (size_t i = 0; i < ret.datalen; i++) {
2781                 ret.data[i] = Path_clone(&orig->data[i]);
2782         }
2783         return ret;
2784 }
2785 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2786         LDKRoute ret = *owner->contents.result;
2787         ret.is_owned = false;
2788         return ret;
2789 }
2790 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2791         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2792         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2793         uint64_t ret_ref = 0;
2794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2796         return ret_ref;
2797 }
2798
2799 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2800 CHECK(!owner->result_ok);
2801         return DecodeError_clone(&*owner->contents.err);
2802 }
2803 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2804         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2806         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2807         uint64_t ret_ref = tag_ptr(ret_copy, true);
2808         return ret_ref;
2809 }
2810
2811 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2812         LDKRouteParameters ret = *owner->contents.result;
2813         ret.is_owned = false;
2814         return ret;
2815 }
2816 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2817         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2818         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2819         uint64_t ret_ref = 0;
2820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2822         return ret_ref;
2823 }
2824
2825 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2826 CHECK(!owner->result_ok);
2827         return DecodeError_clone(&*owner->contents.err);
2828 }
2829 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2830         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2831         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2832         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2833         uint64_t ret_ref = tag_ptr(ret_copy, true);
2834         return ret_ref;
2835 }
2836
2837 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2838         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2839         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2840         return ret;
2841 }
2842 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2843         LDKPaymentParameters ret = *owner->contents.result;
2844         ret.is_owned = false;
2845         return ret;
2846 }
2847 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2848         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2849         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2850         uint64_t ret_ref = 0;
2851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2853         return ret_ref;
2854 }
2855
2856 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2857 CHECK(!owner->result_ok);
2858         return DecodeError_clone(&*owner->contents.err);
2859 }
2860 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2861         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2863         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2864         uint64_t ret_ref = tag_ptr(ret_copy, true);
2865         return ret_ref;
2866 }
2867
2868 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2869         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2870         for (size_t i = 0; i < ret.datalen; i++) {
2871                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2872         }
2873         return ret;
2874 }
2875 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2876         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2877         for (size_t i = 0; i < ret.datalen; i++) {
2878                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2879         }
2880         return ret;
2881 }
2882 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2883         LDKRouteHint ret = *owner->contents.result;
2884         ret.is_owned = false;
2885         return ret;
2886 }
2887 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2888         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2889         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2890         uint64_t ret_ref = 0;
2891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2893         return ret_ref;
2894 }
2895
2896 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2897 CHECK(!owner->result_ok);
2898         return DecodeError_clone(&*owner->contents.err);
2899 }
2900 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2901         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2902         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2903         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2904         uint64_t ret_ref = tag_ptr(ret_copy, true);
2905         return ret_ref;
2906 }
2907
2908 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2909         LDKRouteHintHop ret = *owner->contents.result;
2910         ret.is_owned = false;
2911         return ret;
2912 }
2913 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2914         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2915         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2916         uint64_t ret_ref = 0;
2917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2919         return ret_ref;
2920 }
2921
2922 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2923 CHECK(!owner->result_ok);
2924         return DecodeError_clone(&*owner->contents.err);
2925 }
2926 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2927         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2929         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2930         uint64_t ret_ref = tag_ptr(ret_copy, true);
2931         return ret_ref;
2932 }
2933
2934 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2935         LDKFixedPenaltyScorer ret = *owner->contents.result;
2936         ret.is_owned = false;
2937         return ret;
2938 }
2939 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2940         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2941         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2942         uint64_t ret_ref = 0;
2943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2945         return ret_ref;
2946 }
2947
2948 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2949 CHECK(!owner->result_ok);
2950         return DecodeError_clone(&*owner->contents.err);
2951 }
2952 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2953         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2955         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2956         uint64_t ret_ref = tag_ptr(ret_copy, true);
2957         return ret_ref;
2958 }
2959
2960 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2961         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2962         for (size_t i = 0; i < ret.datalen; i++) {
2963                 ret.data[i] = NodeId_clone(&orig->data[i]);
2964         }
2965         return ret;
2966 }
2967 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2968         return owner->a;
2969 }
2970 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2971         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2972         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2973         return ret_conv;
2974 }
2975
2976 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2977         return owner->b;
2978 }
2979 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2980         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2981         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2982         return ret_conv;
2983 }
2984
2985 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2986         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2987         switch(obj->tag) {
2988                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2989                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2990                 default: abort();
2991         }
2992 }
2993 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2994         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2995         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2996         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2997         *some_conv = obj->some;
2998                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2999         return tag_ptr(some_conv, true);
3000 }
3001 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3002         return owner->a;
3003 }
3004 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
3005         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3006         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3007         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
3008         return ret_arr;
3009 }
3010
3011 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3012         return owner->b;
3013 }
3014 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
3015         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3016         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3017         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
3018         return ret_arr;
3019 }
3020
3021 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3022         return owner->a;
3023 }
3024 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_a"))) TS_C2Tuple__u1632_u1632Z_get_a(uint64_t owner) {
3025         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3026         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3027         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
3028         return ret_arr;
3029 }
3030
3031 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3032         return owner->b;
3033 }
3034 int16_tArray  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_get_b"))) TS_C2Tuple__u1632_u1632Z_get_b(uint64_t owner) {
3035         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3036         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3037         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3038         return ret_arr;
3039 }
3040
3041 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(uint64_t ptr) {
3042         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3043         switch(obj->tag) {
3044                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3045                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3046                 default: abort();
3047         }
3048 }
3049 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(uint64_t ptr) {
3050         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3051         assert(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3052         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3053                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3054         return tag_ptr(some_conv, false);
3055 }
3056 uint32_t __attribute__((export_name("TS_LDKCOption_f64Z_ty_from_ptr"))) TS_LDKCOption_f64Z_ty_from_ptr(uint64_t ptr) {
3057         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3058         switch(obj->tag) {
3059                 case LDKCOption_f64Z_Some: return 0;
3060                 case LDKCOption_f64Z_None: return 1;
3061                 default: abort();
3062         }
3063 }
3064 double __attribute__((export_name("TS_LDKCOption_f64Z_Some_get_some"))) TS_LDKCOption_f64Z_Some_get_some(uint64_t ptr) {
3065         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3066         assert(obj->tag == LDKCOption_f64Z_Some);
3067         double some_conv = obj->some;
3068         return some_conv;
3069 }
3070 typedef struct LDKLogger_JCalls {
3071         atomic_size_t refcnt;
3072         uint32_t instance_ptr;
3073 } LDKLogger_JCalls;
3074 static void LDKLogger_JCalls_free(void* this_arg) {
3075         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3076         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3077                 FREE(j_calls);
3078         }
3079 }
3080 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3081         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3082         LDKRecord record_var = record;
3083         uint64_t record_ref = 0;
3084         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3085         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3086         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
3087 }
3088 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3089         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3090         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3091 }
3092 static inline LDKLogger LDKLogger_init (JSValue o) {
3093         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3094         atomic_init(&calls->refcnt, 1);
3095         calls->instance_ptr = o;
3096
3097         LDKLogger ret = {
3098                 .this_arg = (void*) calls,
3099                 .log = log_LDKLogger_jcall,
3100                 .free = LDKLogger_JCalls_free,
3101         };
3102         return ret;
3103 }
3104 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3105         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3106         *res_ptr = LDKLogger_init(o);
3107         return tag_ptr(res_ptr, true);
3108 }
3109 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3110         LDKProbabilisticScorer ret = *owner->contents.result;
3111         ret.is_owned = false;
3112         return ret;
3113 }
3114 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3115         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3116         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3117         uint64_t ret_ref = 0;
3118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3120         return ret_ref;
3121 }
3122
3123 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3124 CHECK(!owner->result_ok);
3125         return DecodeError_clone(&*owner->contents.err);
3126 }
3127 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3128         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3129         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3130         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3131         uint64_t ret_ref = tag_ptr(ret_copy, true);
3132         return ret_ref;
3133 }
3134
3135 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3136         LDKBestBlock ret = *owner->contents.result;
3137         ret.is_owned = false;
3138         return ret;
3139 }
3140 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_get_ok"))) TS_CResult_BestBlockDecodeErrorZ_get_ok(uint64_t owner) {
3141         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3142         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
3143         uint64_t ret_ref = 0;
3144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3146         return ret_ref;
3147 }
3148
3149 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3150 CHECK(!owner->result_ok);
3151         return DecodeError_clone(&*owner->contents.err);
3152 }
3153 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_get_err"))) TS_CResult_BestBlockDecodeErrorZ_get_err(uint64_t owner) {
3154         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3155         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3156         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
3157         uint64_t ret_ref = tag_ptr(ret_copy, true);
3158         return ret_ref;
3159 }
3160
3161 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3162         return owner->a;
3163 }
3164 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
3165         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3166         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3167         return ret_conv;
3168 }
3169
3170 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3171         return owner->b;
3172 }
3173 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
3174         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3175         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3176         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3177         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3178         return ret_arr;
3179 }
3180
3181 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3182         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3183         for (size_t i = 0; i < ret.datalen; i++) {
3184                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3185         }
3186         return ret;
3187 }
3188 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3189         return ThirtyTwoBytes_clone(&owner->a);
3190 }
3191 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(uint64_t owner) {
3192         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3193         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3194         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3195         return ret_arr;
3196 }
3197
3198 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3199         return owner->b;
3200 }
3201 int32_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(uint64_t owner) {
3202         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3203         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3204         return ret_conv;
3205 }
3206
3207 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3208         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3209 }
3210 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(uint64_t owner) {
3211         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3212         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3213         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3214         uint64_t ret_ref = tag_ptr(ret_copy, true);
3215         return ret_ref;
3216 }
3217
3218 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3219         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3220         for (size_t i = 0; i < ret.datalen; i++) {
3221                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3222         }
3223         return ret;
3224 }
3225 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3226 CHECK(owner->result_ok);
3227         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3228 }
3229 uint32_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(uint64_t owner) {
3230         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3231         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3232         return ret_conv;
3233 }
3234
3235 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3236 CHECK(!owner->result_ok);
3237         return *owner->contents.err;
3238 }
3239 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(uint64_t owner) {
3240         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3241         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3242 }
3243
3244 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
3245         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3246         switch(obj->tag) {
3247                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3248                 case LDKClosureReason_HolderForceClosed: return 1;
3249                 case LDKClosureReason_LegacyCooperativeClosure: return 2;
3250                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: return 3;
3251                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: return 4;
3252                 case LDKClosureReason_CommitmentTxConfirmed: return 5;
3253                 case LDKClosureReason_FundingTimedOut: return 6;
3254                 case LDKClosureReason_ProcessingError: return 7;
3255                 case LDKClosureReason_DisconnectedPeer: return 8;
3256                 case LDKClosureReason_OutdatedChannelManager: return 9;
3257                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 10;
3258                 case LDKClosureReason_FundingBatchClosure: return 11;
3259                 case LDKClosureReason_HTLCsTimedOut: return 12;
3260                 default: abort();
3261         }
3262 }
3263 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
3264         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3265         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3266         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3267                         uint64_t peer_msg_ref = 0;
3268                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3269                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3270         return peer_msg_ref;
3271 }
3272 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
3273         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3274         assert(obj->tag == LDKClosureReason_ProcessingError);
3275         LDKStr err_str = obj->processing_error.err;
3276                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3277         return err_conv;
3278 }
3279 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
3280         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3281         switch(obj->tag) {
3282                 case LDKMonitorEvent_HTLCEvent: return 0;
3283                 case LDKMonitorEvent_HolderForceClosedWithInfo: return 1;
3284                 case LDKMonitorEvent_HolderForceClosed: return 2;
3285                 case LDKMonitorEvent_Completed: return 3;
3286                 default: abort();
3287         }
3288 }
3289 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
3290         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3291         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
3292         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3293                         uint64_t htlc_event_ref = 0;
3294                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3295                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3296         return htlc_event_ref;
3297 }
3298 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason(uint64_t ptr) {
3299         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3300         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3301         uint64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
3302         return reason_ref;
3303 }
3304 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint(uint64_t ptr) {
3305         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3306         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3307         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
3308                         uint64_t outpoint_ref = 0;
3309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
3310                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
3311         return outpoint_ref;
3312 }
3313 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id"))) TS_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id(uint64_t ptr) {
3314         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3315         assert(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3316         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
3317                         uint64_t channel_id_ref = 0;
3318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3319                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3320         return channel_id_ref;
3321 }
3322 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed"))) TS_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(uint64_t ptr) {
3323         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3324         assert(obj->tag == LDKMonitorEvent_HolderForceClosed);
3325         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3326                         uint64_t holder_force_closed_ref = 0;
3327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3328                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3329         return holder_force_closed_ref;
3330 }
3331 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3332         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3333         assert(obj->tag == LDKMonitorEvent_Completed);
3334         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3335                         uint64_t funding_txo_ref = 0;
3336                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3337                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3338         return funding_txo_ref;
3339 }
3340 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_channel_id"))) TS_LDKMonitorEvent_Completed_get_channel_id(uint64_t ptr) {
3341         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3342         assert(obj->tag == LDKMonitorEvent_Completed);
3343         LDKChannelId channel_id_var = obj->completed.channel_id;
3344                         uint64_t channel_id_ref = 0;
3345                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3346                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3347         return channel_id_ref;
3348 }
3349 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3350         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3351         assert(obj->tag == LDKMonitorEvent_Completed);
3352         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3353         return monitor_update_id_conv;
3354 }
3355 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3356         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3357         for (size_t i = 0; i < ret.datalen; i++) {
3358                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3359         }
3360         return ret;
3361 }
3362 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3363         LDKOutPoint ret = owner->a;
3364         ret.is_owned = false;
3365         return ret;
3366 }
3367 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3368         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3369         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3370         uint64_t ret_ref = 0;
3371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3373         return ret_ref;
3374 }
3375
3376 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3377         LDKChannelId ret = owner->b;
3378         ret.is_owned = false;
3379         return ret;
3380 }
3381 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3382         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3383         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3384         uint64_t ret_ref = 0;
3385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3387         return ret_ref;
3388 }
3389
3390 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3391         return CVec_MonitorEventZ_clone(&owner->c);
3392 }
3393 uint64_tArray  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3394         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3395         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
3396         uint64_tArray ret_arr = NULL;
3397         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3398         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3399         for (size_t o = 0; o < ret_var.datalen; o++) {
3400                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3401                 *ret_conv_14_copy = ret_var.data[o];
3402                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3403                 ret_arr_ptr[o] = ret_conv_14_ref;
3404         }
3405         
3406         FREE(ret_var.data);
3407         return ret_arr;
3408 }
3409
3410 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3411         return owner->d;
3412 }
3413 int8_tArray  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(uint64_t owner) {
3414         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3415         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3416         memcpy(ret_arr->elems, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form, 33);
3417         return ret_arr;
3418 }
3419
3420 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
3421         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3422         for (size_t i = 0; i < ret.datalen; i++) {
3423                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3424         }
3425         return ret;
3426 }
3427 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3428         LDKInitFeatures ret = *owner->contents.result;
3429         ret.is_owned = false;
3430         return ret;
3431 }
3432 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3433         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3434         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3435         uint64_t ret_ref = 0;
3436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3438         return ret_ref;
3439 }
3440
3441 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3442 CHECK(!owner->result_ok);
3443         return DecodeError_clone(&*owner->contents.err);
3444 }
3445 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3446         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3447         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3448         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3449         uint64_t ret_ref = tag_ptr(ret_copy, true);
3450         return ret_ref;
3451 }
3452
3453 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3454         LDKChannelFeatures ret = *owner->contents.result;
3455         ret.is_owned = false;
3456         return ret;
3457 }
3458 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3459         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3460         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3461         uint64_t ret_ref = 0;
3462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3464         return ret_ref;
3465 }
3466
3467 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3468 CHECK(!owner->result_ok);
3469         return DecodeError_clone(&*owner->contents.err);
3470 }
3471 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3472         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3473         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3474         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3475         uint64_t ret_ref = tag_ptr(ret_copy, true);
3476         return ret_ref;
3477 }
3478
3479 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3480         LDKNodeFeatures ret = *owner->contents.result;
3481         ret.is_owned = false;
3482         return ret;
3483 }
3484 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3485         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3486         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3487         uint64_t ret_ref = 0;
3488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3490         return ret_ref;
3491 }
3492
3493 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3494 CHECK(!owner->result_ok);
3495         return DecodeError_clone(&*owner->contents.err);
3496 }
3497 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3498         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3499         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3500         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3501         uint64_t ret_ref = tag_ptr(ret_copy, true);
3502         return ret_ref;
3503 }
3504
3505 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3506         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3507         ret.is_owned = false;
3508         return ret;
3509 }
3510 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3511         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3512         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3513         uint64_t ret_ref = 0;
3514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3516         return ret_ref;
3517 }
3518
3519 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3520 CHECK(!owner->result_ok);
3521         return DecodeError_clone(&*owner->contents.err);
3522 }
3523 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3524         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3525         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3526         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3527         uint64_t ret_ref = tag_ptr(ret_copy, true);
3528         return ret_ref;
3529 }
3530
3531 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3532         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3533         ret.is_owned = false;
3534         return ret;
3535 }
3536 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3537         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3538         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3539         uint64_t ret_ref = 0;
3540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3542         return ret_ref;
3543 }
3544
3545 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3546 CHECK(!owner->result_ok);
3547         return DecodeError_clone(&*owner->contents.err);
3548 }
3549 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3550         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3551         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3552         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3553         uint64_t ret_ref = tag_ptr(ret_copy, true);
3554         return ret_ref;
3555 }
3556
3557 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3558         LDKBlindedHopFeatures ret = *owner->contents.result;
3559         ret.is_owned = false;
3560         return ret;
3561 }
3562 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3563         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3564         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3565         uint64_t ret_ref = 0;
3566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3568         return ret_ref;
3569 }
3570
3571 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3572 CHECK(!owner->result_ok);
3573         return DecodeError_clone(&*owner->contents.err);
3574 }
3575 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3576         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3577         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3578         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3579         uint64_t ret_ref = tag_ptr(ret_copy, true);
3580         return ret_ref;
3581 }
3582
3583 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3584         LDKChannelTypeFeatures ret = *owner->contents.result;
3585         ret.is_owned = false;
3586         return ret;
3587 }
3588 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3589         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3590         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3591         uint64_t ret_ref = 0;
3592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3594         return ret_ref;
3595 }
3596
3597 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3598 CHECK(!owner->result_ok);
3599         return DecodeError_clone(&*owner->contents.err);
3600 }
3601 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3602         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3604         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3605         uint64_t ret_ref = tag_ptr(ret_copy, true);
3606         return ret_ref;
3607 }
3608
3609 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
3610         LDKOfferId ret = *owner->contents.result;
3611         ret.is_owned = false;
3612         return ret;
3613 }
3614 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_get_ok"))) TS_CResult_OfferIdDecodeErrorZ_get_ok(uint64_t owner) {
3615         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
3616         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
3617         uint64_t ret_ref = 0;
3618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3620         return ret_ref;
3621 }
3622
3623 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
3624 CHECK(!owner->result_ok);
3625         return DecodeError_clone(&*owner->contents.err);
3626 }
3627 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_get_err"))) TS_CResult_OfferIdDecodeErrorZ_get_err(uint64_t owner) {
3628         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
3629         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3630         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
3631         uint64_t ret_ref = tag_ptr(ret_copy, true);
3632         return ret_ref;
3633 }
3634
3635 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
3636 CHECK(owner->result_ok);
3637         return *owner->contents.result;
3638 }
3639 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3640         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
3641         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
3642 }
3643
3644 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
3645 CHECK(!owner->result_ok);
3646         return Bolt12SemanticError_clone(&*owner->contents.err);
3647 }
3648 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_get_err"))) TS_CResult_NoneBolt12SemanticErrorZ_get_err(uint64_t owner) {
3649         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
3650         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
3651         return ret_conv;
3652 }
3653
3654 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
3655         LDKOffer ret = *owner->contents.result;
3656         ret.is_owned = false;
3657         return ret;
3658 }
3659 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_get_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3660         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
3661         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
3662         uint64_t ret_ref = 0;
3663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3665         return ret_ref;
3666 }
3667
3668 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
3669 CHECK(!owner->result_ok);
3670         return Bolt12SemanticError_clone(&*owner->contents.err);
3671 }
3672 uint32_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_get_err"))) TS_CResult_OfferBolt12SemanticErrorZ_get_err(uint64_t owner) {
3673         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
3674         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
3675         return ret_conv;
3676 }
3677
3678 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3679         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
3680         ret.is_owned = false;
3681         return ret;
3682 }
3683 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3684         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3685         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
3686         uint64_t ret_ref = 0;
3687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3689         return ret_ref;
3690 }
3691
3692 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3693 CHECK(!owner->result_ok);
3694         return Bolt12SemanticError_clone(&*owner->contents.err);
3695 }
3696 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
3697         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3698         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
3699         return ret_conv;
3700 }
3701
3702 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3703         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
3704         ret.is_owned = false;
3705         return ret;
3706 }
3707 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
3708         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3709         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
3710         uint64_t ret_ref = 0;
3711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3713         return ret_ref;
3714 }
3715
3716 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
3717 CHECK(!owner->result_ok);
3718         return Bolt12SemanticError_clone(&*owner->contents.err);
3719 }
3720 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
3721         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
3722         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
3723         return ret_conv;
3724 }
3725
3726 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3727         LDKOffer ret = *owner->contents.result;
3728         ret.is_owned = false;
3729         return ret;
3730 }
3731 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
3732         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3733         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3734         uint64_t ret_ref = 0;
3735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3737         return ret_ref;
3738 }
3739
3740 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3741         LDKBolt12ParseError ret = *owner->contents.err;
3742         ret.is_owned = false;
3743         return ret;
3744 }
3745 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
3746         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3747         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3748         uint64_t ret_ref = 0;
3749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3751         return ret_ref;
3752 }
3753
3754 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3755         LDKNodeId ret = *owner->contents.result;
3756         ret.is_owned = false;
3757         return ret;
3758 }
3759 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3760         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3761         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3762         uint64_t ret_ref = 0;
3763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3765         return ret_ref;
3766 }
3767
3768 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3769 CHECK(!owner->result_ok);
3770         return DecodeError_clone(&*owner->contents.err);
3771 }
3772 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3773         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3775         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3776         uint64_t ret_ref = tag_ptr(ret_copy, true);
3777         return ret_ref;
3778 }
3779
3780 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3781 CHECK(owner->result_ok);
3782         return *owner->contents.result;
3783 }
3784 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
3785         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3786         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3787         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3788         return ret_arr;
3789 }
3790
3791 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3792 CHECK(!owner->result_ok);
3793         return *owner->contents.err;
3794 }
3795 uint32_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_get_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_get_err(uint64_t owner) {
3796         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3797         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3798         return ret_conv;
3799 }
3800
3801 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3802         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3803         switch(obj->tag) {
3804                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3805                 case LDKNetworkUpdate_ChannelFailure: return 1;
3806                 case LDKNetworkUpdate_NodeFailure: return 2;
3807                 default: abort();
3808         }
3809 }
3810 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3811         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3812         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3813         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3814                         uint64_t msg_ref = 0;
3815                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3816                         msg_ref = tag_ptr(msg_var.inner, false);
3817         return msg_ref;
3818 }
3819 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3820         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3821         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3822         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3823         return short_channel_id_conv;
3824 }
3825 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3826         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3827         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3828         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3829         return is_permanent_conv;
3830 }
3831 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3832         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3833         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3834         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3835         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3836         return node_id_arr;
3837 }
3838 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3839         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3840         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3841         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3842         return is_permanent_conv;
3843 }
3844 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3845         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3846         switch(obj->tag) {
3847                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3848                 case LDKCOption_NetworkUpdateZ_None: return 1;
3849                 default: abort();
3850         }
3851 }
3852 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3853         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3854         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3855         uint64_t some_ref = tag_ptr(&obj->some, false);
3856         return some_ref;
3857 }
3858 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3859 CHECK(owner->result_ok);
3860         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3861 }
3862 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3863         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3864         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3865         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3866         uint64_t ret_ref = tag_ptr(ret_copy, true);
3867         return ret_ref;
3868 }
3869
3870 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3871 CHECK(!owner->result_ok);
3872         return DecodeError_clone(&*owner->contents.err);
3873 }
3874 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3875         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3877         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3878         uint64_t ret_ref = tag_ptr(ret_copy, true);
3879         return ret_ref;
3880 }
3881
3882 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3883 CHECK(owner->result_ok);
3884         return TxOut_clone(&*owner->contents.result);
3885 }
3886 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
3887         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3888         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3889         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
3890         return tag_ptr(ret_ref, true);
3891 }
3892
3893 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
3894 CHECK(!owner->result_ok);
3895         return UtxoLookupError_clone(&*owner->contents.err);
3896 }
3897 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
3898         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
3899         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
3900         return ret_conv;
3901 }
3902
3903 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
3904         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3905         switch(obj->tag) {
3906                 case LDKUtxoResult_Sync: return 0;
3907                 case LDKUtxoResult_Async: return 1;
3908                 default: abort();
3909         }
3910 }
3911 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
3912         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3913         assert(obj->tag == LDKUtxoResult_Sync);
3914         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
3915         *sync_conv = obj->sync;
3916                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
3917         return tag_ptr(sync_conv, true);
3918 }
3919 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
3920         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
3921         assert(obj->tag == LDKUtxoResult_Async);
3922         LDKUtxoFuture async_var = obj->async;
3923                         uint64_t async_ref = 0;
3924                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
3925                         async_ref = tag_ptr(async_var.inner, false);
3926         return async_ref;
3927 }
3928 typedef struct LDKUtxoLookup_JCalls {
3929         atomic_size_t refcnt;
3930         uint32_t instance_ptr;
3931 } LDKUtxoLookup_JCalls;
3932 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
3933         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3934         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3935                 FREE(j_calls);
3936         }
3937 }
3938 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
3939         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
3940         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
3941         memcpy(chain_hash_arr->elems, *chain_hash, 32);
3942         int64_t short_channel_id_conv = short_channel_id;
3943         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);
3944         void* ret_ptr = untag_ptr(ret);
3945         CHECK_ACCESS(ret_ptr);
3946         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
3947         FREE(untag_ptr(ret));
3948         return ret_conv;
3949 }
3950 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
3951         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
3952         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3953 }
3954 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
3955         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
3956         atomic_init(&calls->refcnt, 1);
3957         calls->instance_ptr = o;
3958
3959         LDKUtxoLookup ret = {
3960                 .this_arg = (void*) calls,
3961                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
3962                 .free = LDKUtxoLookup_JCalls_free,
3963         };
3964         return ret;
3965 }
3966 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
3967         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3968         *res_ptr = LDKUtxoLookup_init(o);
3969         return tag_ptr(res_ptr, true);
3970 }
3971 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) {
3972         void* this_arg_ptr = untag_ptr(this_arg);
3973         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3974         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
3975         uint8_t chain_hash_arr[32];
3976         CHECK(chain_hash->arr_len == 32);
3977         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
3978         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
3979         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
3980         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
3981         uint64_t ret_ref = tag_ptr(ret_copy, true);
3982         return ret_ref;
3983 }
3984
3985 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
3986         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3987         switch(obj->tag) {
3988                 case LDKCOption_UtxoLookupZ_Some: return 0;
3989                 case LDKCOption_UtxoLookupZ_None: return 1;
3990                 default: abort();
3991         }
3992 }
3993 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
3994         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
3995         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
3996         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
3997         *some_ret = obj->some;
3998                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3999                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
4000                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4001                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
4002                         }
4003         return tag_ptr(some_ret, true);
4004 }
4005 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4006 CHECK(owner->result_ok);
4007         return *owner->contents.result;
4008 }
4009 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
4010         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4011         CResult_NoneLightningErrorZ_get_ok(owner_conv);
4012 }
4013
4014 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4015         LDKLightningError ret = *owner->contents.err;
4016         ret.is_owned = false;
4017         return ret;
4018 }
4019 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
4020         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4021         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4022         uint64_t ret_ref = 0;
4023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4025         return ret_ref;
4026 }
4027
4028 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4029 CHECK(owner->result_ok);
4030         return *owner->contents.result;
4031 }
4032 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
4033         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4034         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4035         return ret_conv;
4036 }
4037
4038 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4039         LDKLightningError ret = *owner->contents.err;
4040         ret.is_owned = false;
4041         return ret;
4042 }
4043 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
4044         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4045         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4046         uint64_t ret_ref = 0;
4047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4049         return ret_ref;
4050 }
4051
4052 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4053         LDKChannelAnnouncement ret = owner->a;
4054         ret.is_owned = false;
4055         return ret;
4056 }
4057 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
4058         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4059         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4060         uint64_t ret_ref = 0;
4061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4063         return ret_ref;
4064 }
4065
4066 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4067         LDKChannelUpdate ret = owner->b;
4068         ret.is_owned = false;
4069         return ret;
4070 }
4071 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
4072         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4073         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4074         uint64_t ret_ref = 0;
4075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4077         return ret_ref;
4078 }
4079
4080 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4081         LDKChannelUpdate ret = owner->c;
4082         ret.is_owned = false;
4083         return ret;
4084 }
4085 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
4086         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4087         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4088         uint64_t ret_ref = 0;
4089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4091         return ret_ref;
4092 }
4093
4094 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
4095         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4096         switch(obj->tag) {
4097                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4098                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4099                 default: abort();
4100         }
4101 }
4102 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
4103         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4104         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4105         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4106         *some_conv = obj->some;
4107                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4108         return tag_ptr(some_conv, true);
4109 }
4110 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
4111         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4112         switch(obj->tag) {
4113                 case LDKErrorAction_DisconnectPeer: return 0;
4114                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4115                 case LDKErrorAction_IgnoreError: return 2;
4116                 case LDKErrorAction_IgnoreAndLog: return 3;
4117                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4118                 case LDKErrorAction_SendErrorMessage: return 5;
4119                 case LDKErrorAction_SendWarningMessage: return 6;
4120                 default: abort();
4121         }
4122 }
4123 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
4124         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4125         assert(obj->tag == LDKErrorAction_DisconnectPeer);
4126         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4127                         uint64_t msg_ref = 0;
4128                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4129                         msg_ref = tag_ptr(msg_var.inner, false);
4130         return msg_ref;
4131 }
4132 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
4133         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4134         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4135         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4136                         uint64_t msg_ref = 0;
4137                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4138                         msg_ref = tag_ptr(msg_var.inner, false);
4139         return msg_ref;
4140 }
4141 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
4142         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4143         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
4144         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
4145         return ignore_and_log_conv;
4146 }
4147 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
4148         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4149         assert(obj->tag == LDKErrorAction_SendErrorMessage);
4150         LDKErrorMessage msg_var = obj->send_error_message.msg;
4151                         uint64_t msg_ref = 0;
4152                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4153                         msg_ref = tag_ptr(msg_var.inner, false);
4154         return msg_ref;
4155 }
4156 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
4157         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4158         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4159         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4160                         uint64_t msg_ref = 0;
4161                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4162                         msg_ref = tag_ptr(msg_var.inner, false);
4163         return msg_ref;
4164 }
4165 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
4166         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4167         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4168         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
4169         return log_level_conv;
4170 }
4171 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
4172         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4173         switch(obj->tag) {
4174                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4175                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4176                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4177                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4178                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4179                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4180                 case LDKMessageSendEvent_SendStfu: return 6;
4181                 case LDKMessageSendEvent_SendSplice: return 7;
4182                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4183                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4184                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4185                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4186                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4187                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4188                 case LDKMessageSendEvent_SendTxComplete: return 14;
4189                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4190                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4191                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4192                 case LDKMessageSendEvent_SendTxAbort: return 18;
4193                 case LDKMessageSendEvent_SendChannelReady: return 19;
4194                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4195                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4196                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4197                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4198                 case LDKMessageSendEvent_SendShutdown: return 24;
4199                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4200                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4201                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4202                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4203                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4204                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4205                 case LDKMessageSendEvent_HandleError: return 31;
4206                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4207                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4208                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4209                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4210                 default: abort();
4211         }
4212 }
4213 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
4214         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4215         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4216         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4217         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4218         return node_id_arr;
4219 }
4220 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
4221         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4222         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4223         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4224                         uint64_t msg_ref = 0;
4225                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4226                         msg_ref = tag_ptr(msg_var.inner, false);
4227         return msg_ref;
4228 }
4229 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
4230         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4231         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4232         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4233         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4234         return node_id_arr;
4235 }
4236 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
4237         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4238         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4239         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4240                         uint64_t msg_ref = 0;
4241                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4242                         msg_ref = tag_ptr(msg_var.inner, false);
4243         return msg_ref;
4244 }
4245 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
4246         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4247         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4248         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4249         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4250         return node_id_arr;
4251 }
4252 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
4253         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4254         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4255         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4256                         uint64_t msg_ref = 0;
4257                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4258                         msg_ref = tag_ptr(msg_var.inner, false);
4259         return msg_ref;
4260 }
4261 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
4262         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4263         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4264         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4265         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4266         return node_id_arr;
4267 }
4268 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
4269         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4270         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4271         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4272                         uint64_t msg_ref = 0;
4273                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4274                         msg_ref = tag_ptr(msg_var.inner, false);
4275         return msg_ref;
4276 }
4277 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
4278         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4279         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4280         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4281         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4282         return node_id_arr;
4283 }
4284 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
4285         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4286         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4287         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4288                         uint64_t msg_ref = 0;
4289                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4290                         msg_ref = tag_ptr(msg_var.inner, false);
4291         return msg_ref;
4292 }
4293 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
4294         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4295         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4296         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4297         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4298         return node_id_arr;
4299 }
4300 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
4301         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4302         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4303         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4304                         uint64_t msg_ref = 0;
4305                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4306                         msg_ref = tag_ptr(msg_var.inner, false);
4307         return msg_ref;
4308 }
4309 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_node_id"))) TS_LDKMessageSendEvent_SendStfu_get_node_id(uint64_t ptr) {
4310         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4311         assert(obj->tag == LDKMessageSendEvent_SendStfu);
4312         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4313         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4314         return node_id_arr;
4315 }
4316 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendStfu_get_msg"))) TS_LDKMessageSendEvent_SendStfu_get_msg(uint64_t ptr) {
4317         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4318         assert(obj->tag == LDKMessageSendEvent_SendStfu);
4319         LDKStfu msg_var = obj->send_stfu.msg;
4320                         uint64_t msg_ref = 0;
4321                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4322                         msg_ref = tag_ptr(msg_var.inner, false);
4323         return msg_ref;
4324 }
4325 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_node_id"))) TS_LDKMessageSendEvent_SendSplice_get_node_id(uint64_t ptr) {
4326         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4327         assert(obj->tag == LDKMessageSendEvent_SendSplice);
4328         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4329         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4330         return node_id_arr;
4331 }
4332 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSplice_get_msg"))) TS_LDKMessageSendEvent_SendSplice_get_msg(uint64_t ptr) {
4333         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4334         assert(obj->tag == LDKMessageSendEvent_SendSplice);
4335         LDKSplice msg_var = obj->send_splice.msg;
4336                         uint64_t msg_ref = 0;
4337                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4338                         msg_ref = tag_ptr(msg_var.inner, false);
4339         return msg_ref;
4340 }
4341 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceAck_get_node_id(uint64_t ptr) {
4342         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4343         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4344         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4345         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4346         return node_id_arr;
4347 }
4348 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceAck_get_msg"))) TS_LDKMessageSendEvent_SendSpliceAck_get_msg(uint64_t ptr) {
4349         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4350         assert(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4351         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
4352                         uint64_t msg_ref = 0;
4353                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4354                         msg_ref = tag_ptr(msg_var.inner, false);
4355         return msg_ref;
4356 }
4357 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_node_id(uint64_t ptr) {
4358         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4359         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4360         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4361         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
4362         return node_id_arr;
4363 }
4364 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendSpliceLocked_get_msg"))) TS_LDKMessageSendEvent_SendSpliceLocked_get_msg(uint64_t ptr) {
4365         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4366         assert(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4367         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
4368                         uint64_t msg_ref = 0;
4369                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4370                         msg_ref = tag_ptr(msg_var.inner, false);
4371         return msg_ref;
4372 }
4373 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
4374         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4375         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4376         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4377         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4378         return node_id_arr;
4379 }
4380 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
4381         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4382         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4383         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4384                         uint64_t msg_ref = 0;
4385                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4386                         msg_ref = tag_ptr(msg_var.inner, false);
4387         return msg_ref;
4388 }
4389 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
4390         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4391         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4392         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4393         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4394         return node_id_arr;
4395 }
4396 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
4397         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4398         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4399         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4400                         uint64_t msg_ref = 0;
4401                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4402                         msg_ref = tag_ptr(msg_var.inner, false);
4403         return msg_ref;
4404 }
4405 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
4406         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4407         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4408         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4409         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4410         return node_id_arr;
4411 }
4412 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
4413         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4414         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4415         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4416                         uint64_t msg_ref = 0;
4417                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4418                         msg_ref = tag_ptr(msg_var.inner, false);
4419         return msg_ref;
4420 }
4421 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
4422         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4423         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4424         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4425         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4426         return node_id_arr;
4427 }
4428 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
4429         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4430         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4431         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4432                         uint64_t msg_ref = 0;
4433                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4434                         msg_ref = tag_ptr(msg_var.inner, false);
4435         return msg_ref;
4436 }
4437 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
4438         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4439         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4440         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4441         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4442         return node_id_arr;
4443 }
4444 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
4445         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4446         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4447         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4448                         uint64_t msg_ref = 0;
4449                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4450                         msg_ref = tag_ptr(msg_var.inner, false);
4451         return msg_ref;
4452 }
4453 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
4454         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4455         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4456         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4457         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4458         return node_id_arr;
4459 }
4460 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
4461         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4462         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4463         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4464                         uint64_t msg_ref = 0;
4465                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4466                         msg_ref = tag_ptr(msg_var.inner, false);
4467         return msg_ref;
4468 }
4469 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4470         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4471         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4472         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4473         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4474         return node_id_arr;
4475 }
4476 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4477         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4478         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4479         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4480                         uint64_t msg_ref = 0;
4481                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4482                         msg_ref = tag_ptr(msg_var.inner, false);
4483         return msg_ref;
4484 }
4485 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4486         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4487         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4488         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4489         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4490         return node_id_arr;
4491 }
4492 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4493         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4494         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4495         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4496                         uint64_t msg_ref = 0;
4497                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4498                         msg_ref = tag_ptr(msg_var.inner, false);
4499         return msg_ref;
4500 }
4501 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4502         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4503         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4504         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4505         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4506         return node_id_arr;
4507 }
4508 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4509         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4510         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4511         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4512                         uint64_t msg_ref = 0;
4513                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4514                         msg_ref = tag_ptr(msg_var.inner, false);
4515         return msg_ref;
4516 }
4517 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4518         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4519         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4520         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4521         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4522         return node_id_arr;
4523 }
4524 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4525         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4526         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4527         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4528                         uint64_t msg_ref = 0;
4529                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4530                         msg_ref = tag_ptr(msg_var.inner, false);
4531         return msg_ref;
4532 }
4533 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4534         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4535         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4536         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4537         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4538         return node_id_arr;
4539 }
4540 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4541         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4542         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4543         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4544                         uint64_t msg_ref = 0;
4545                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4546                         msg_ref = tag_ptr(msg_var.inner, false);
4547         return msg_ref;
4548 }
4549 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4550         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4551         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4552         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4553         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4554         return node_id_arr;
4555 }
4556 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4557         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4558         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4559         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4560                         uint64_t updates_ref = 0;
4561                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4562                         updates_ref = tag_ptr(updates_var.inner, false);
4563         return updates_ref;
4564 }
4565 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4566         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4567         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4568         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4569         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4570         return node_id_arr;
4571 }
4572 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4573         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4574         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4575         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4576                         uint64_t msg_ref = 0;
4577                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4578                         msg_ref = tag_ptr(msg_var.inner, false);
4579         return msg_ref;
4580 }
4581 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4582         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4583         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4584         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4585         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4586         return node_id_arr;
4587 }
4588 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4589         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4590         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4591         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4592                         uint64_t msg_ref = 0;
4593                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4594                         msg_ref = tag_ptr(msg_var.inner, false);
4595         return msg_ref;
4596 }
4597 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4598         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4599         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4600         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4601         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4602         return node_id_arr;
4603 }
4604 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
4605         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4606         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4607         LDKShutdown msg_var = obj->send_shutdown.msg;
4608                         uint64_t msg_ref = 0;
4609                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4610                         msg_ref = tag_ptr(msg_var.inner, false);
4611         return msg_ref;
4612 }
4613 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
4614         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4615         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4616         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4617         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4618         return node_id_arr;
4619 }
4620 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
4621         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4622         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4623         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4624                         uint64_t msg_ref = 0;
4625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4626                         msg_ref = tag_ptr(msg_var.inner, false);
4627         return msg_ref;
4628 }
4629 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
4630         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4631         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4632         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4633         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4634         return node_id_arr;
4635 }
4636 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
4637         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4638         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4639         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4640                         uint64_t msg_ref = 0;
4641                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4642                         msg_ref = tag_ptr(msg_var.inner, false);
4643         return msg_ref;
4644 }
4645 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
4646         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4647         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4648         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4649                         uint64_t update_msg_ref = 0;
4650                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4651                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4652         return update_msg_ref;
4653 }
4654 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
4655         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4656         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4657         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4658                         uint64_t msg_ref = 0;
4659                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4660                         msg_ref = tag_ptr(msg_var.inner, false);
4661         return msg_ref;
4662 }
4663 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
4664         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4665         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4666         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4667                         uint64_t update_msg_ref = 0;
4668                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4669                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4670         return update_msg_ref;
4671 }
4672 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
4673         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4674         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4675         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4676                         uint64_t msg_ref = 0;
4677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4678                         msg_ref = tag_ptr(msg_var.inner, false);
4679         return msg_ref;
4680 }
4681 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
4682         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4683         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4684         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4685                         uint64_t msg_ref = 0;
4686                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4687                         msg_ref = tag_ptr(msg_var.inner, false);
4688         return msg_ref;
4689 }
4690 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
4691         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4692         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4693         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4694         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4695         return node_id_arr;
4696 }
4697 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
4698         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4699         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4700         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4701                         uint64_t msg_ref = 0;
4702                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4703                         msg_ref = tag_ptr(msg_var.inner, false);
4704         return msg_ref;
4705 }
4706 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
4707         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4708         assert(obj->tag == LDKMessageSendEvent_HandleError);
4709         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4710         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4711         return node_id_arr;
4712 }
4713 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
4714         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4715         assert(obj->tag == LDKMessageSendEvent_HandleError);
4716         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4717         return action_ref;
4718 }
4719 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
4720         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4721         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4722         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4723         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4724         return node_id_arr;
4725 }
4726 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
4727         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4728         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4729         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4730                         uint64_t msg_ref = 0;
4731                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4732                         msg_ref = tag_ptr(msg_var.inner, false);
4733         return msg_ref;
4734 }
4735 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
4736         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4737         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4738         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4739         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4740         return node_id_arr;
4741 }
4742 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
4743         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4744         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4745         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4746                         uint64_t msg_ref = 0;
4747                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4748                         msg_ref = tag_ptr(msg_var.inner, false);
4749         return msg_ref;
4750 }
4751 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
4752         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4753         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4754         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4755         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4756         return node_id_arr;
4757 }
4758 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
4759         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4760         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4761         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4762                         uint64_t msg_ref = 0;
4763                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4764                         msg_ref = tag_ptr(msg_var.inner, false);
4765         return msg_ref;
4766 }
4767 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
4768         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4769         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4770         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4771         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4772         return node_id_arr;
4773 }
4774 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
4775         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4776         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4777         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4778                         uint64_t msg_ref = 0;
4779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4780                         msg_ref = tag_ptr(msg_var.inner, false);
4781         return msg_ref;
4782 }
4783 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4784         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4785         for (size_t i = 0; i < ret.datalen; i++) {
4786                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4787         }
4788         return ret;
4789 }
4790 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4791         LDKChannelUpdateInfo ret = *owner->contents.result;
4792         ret.is_owned = false;
4793         return ret;
4794 }
4795 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
4796         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4797         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4798         uint64_t ret_ref = 0;
4799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4801         return ret_ref;
4802 }
4803
4804 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4805 CHECK(!owner->result_ok);
4806         return DecodeError_clone(&*owner->contents.err);
4807 }
4808 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
4809         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4811         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4812         uint64_t ret_ref = tag_ptr(ret_copy, true);
4813         return ret_ref;
4814 }
4815
4816 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4817         LDKChannelInfo ret = *owner->contents.result;
4818         ret.is_owned = false;
4819         return ret;
4820 }
4821 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
4822         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4823         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4824         uint64_t ret_ref = 0;
4825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4827         return ret_ref;
4828 }
4829
4830 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4831 CHECK(!owner->result_ok);
4832         return DecodeError_clone(&*owner->contents.err);
4833 }
4834 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
4835         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4836         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4837         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4838         uint64_t ret_ref = tag_ptr(ret_copy, true);
4839         return ret_ref;
4840 }
4841
4842 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4843         LDKRoutingFees ret = *owner->contents.result;
4844         ret.is_owned = false;
4845         return ret;
4846 }
4847 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
4848         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4849         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4850         uint64_t ret_ref = 0;
4851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4853         return ret_ref;
4854 }
4855
4856 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4857 CHECK(!owner->result_ok);
4858         return DecodeError_clone(&*owner->contents.err);
4859 }
4860 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
4861         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4863         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4864         uint64_t ret_ref = tag_ptr(ret_copy, true);
4865         return ret_ref;
4866 }
4867
4868 uint32_t __attribute__((export_name("TS_LDKSocketAddress_ty_from_ptr"))) TS_LDKSocketAddress_ty_from_ptr(uint64_t ptr) {
4869         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4870         switch(obj->tag) {
4871                 case LDKSocketAddress_TcpIpV4: return 0;
4872                 case LDKSocketAddress_TcpIpV6: return 1;
4873                 case LDKSocketAddress_OnionV2: return 2;
4874                 case LDKSocketAddress_OnionV3: return 3;
4875                 case LDKSocketAddress_Hostname: return 4;
4876                 default: abort();
4877         }
4878 }
4879 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_addr"))) TS_LDKSocketAddress_TcpIpV4_get_addr(uint64_t ptr) {
4880         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4881         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4882         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
4883         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
4884         return addr_arr;
4885 }
4886 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV4_get_port"))) TS_LDKSocketAddress_TcpIpV4_get_port(uint64_t ptr) {
4887         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4888         assert(obj->tag == LDKSocketAddress_TcpIpV4);
4889         int16_t port_conv = obj->tcp_ip_v4.port;
4890         return port_conv;
4891 }
4892 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_addr"))) TS_LDKSocketAddress_TcpIpV6_get_addr(uint64_t ptr) {
4893         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4894         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4895         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4896         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
4897         return addr_arr;
4898 }
4899 int16_t __attribute__((export_name("TS_LDKSocketAddress_TcpIpV6_get_port"))) TS_LDKSocketAddress_TcpIpV6_get_port(uint64_t ptr) {
4900         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4901         assert(obj->tag == LDKSocketAddress_TcpIpV6);
4902         int16_t port_conv = obj->tcp_ip_v6.port;
4903         return port_conv;
4904 }
4905 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV2_get_onion_v2"))) TS_LDKSocketAddress_OnionV2_get_onion_v2(uint64_t ptr) {
4906         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4907         assert(obj->tag == LDKSocketAddress_OnionV2);
4908         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4909         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4910         return onion_v2_arr;
4911 }
4912 int8_tArray __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKSocketAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
4913         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4914         assert(obj->tag == LDKSocketAddress_OnionV3);
4915         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4916         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4917         return ed25519_pubkey_arr;
4918 }
4919 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_checksum"))) TS_LDKSocketAddress_OnionV3_get_checksum(uint64_t ptr) {
4920         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4921         assert(obj->tag == LDKSocketAddress_OnionV3);
4922         int16_t checksum_conv = obj->onion_v3.checksum;
4923         return checksum_conv;
4924 }
4925 int8_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_version"))) TS_LDKSocketAddress_OnionV3_get_version(uint64_t ptr) {
4926         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4927         assert(obj->tag == LDKSocketAddress_OnionV3);
4928         int8_t version_conv = obj->onion_v3.version;
4929         return version_conv;
4930 }
4931 int16_t __attribute__((export_name("TS_LDKSocketAddress_OnionV3_get_port"))) TS_LDKSocketAddress_OnionV3_get_port(uint64_t ptr) {
4932         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4933         assert(obj->tag == LDKSocketAddress_OnionV3);
4934         int16_t port_conv = obj->onion_v3.port;
4935         return port_conv;
4936 }
4937 uint64_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_hostname"))) TS_LDKSocketAddress_Hostname_get_hostname(uint64_t ptr) {
4938         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4939         assert(obj->tag == LDKSocketAddress_Hostname);
4940         LDKHostname hostname_var = obj->hostname.hostname;
4941                         uint64_t hostname_ref = 0;
4942                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4943                         hostname_ref = tag_ptr(hostname_var.inner, false);
4944         return hostname_ref;
4945 }
4946 int16_t __attribute__((export_name("TS_LDKSocketAddress_Hostname_get_port"))) TS_LDKSocketAddress_Hostname_get_port(uint64_t ptr) {
4947         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
4948         assert(obj->tag == LDKSocketAddress_Hostname);
4949         int16_t port_conv = obj->hostname.port;
4950         return port_conv;
4951 }
4952 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
4953         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
4954         for (size_t i = 0; i < ret.datalen; i++) {
4955                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
4956         }
4957         return ret;
4958 }
4959 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4960         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4961         ret.is_owned = false;
4962         return ret;
4963 }
4964 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
4965         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4966         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4967         uint64_t ret_ref = 0;
4968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4970         return ret_ref;
4971 }
4972
4973 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4974 CHECK(!owner->result_ok);
4975         return DecodeError_clone(&*owner->contents.err);
4976 }
4977 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
4978         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4979         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4980         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4981         uint64_t ret_ref = tag_ptr(ret_copy, true);
4982         return ret_ref;
4983 }
4984
4985 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4986         LDKNodeAlias ret = *owner->contents.result;
4987         ret.is_owned = false;
4988         return ret;
4989 }
4990 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
4991         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4992         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4993         uint64_t ret_ref = 0;
4994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4996         return ret_ref;
4997 }
4998
4999 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5000 CHECK(!owner->result_ok);
5001         return DecodeError_clone(&*owner->contents.err);
5002 }
5003 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
5004         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5005         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5006         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5007         uint64_t ret_ref = tag_ptr(ret_copy, true);
5008         return ret_ref;
5009 }
5010
5011 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5012         LDKNodeInfo ret = *owner->contents.result;
5013         ret.is_owned = false;
5014         return ret;
5015 }
5016 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
5017         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5018         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5019         uint64_t ret_ref = 0;
5020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5022         return ret_ref;
5023 }
5024
5025 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5026 CHECK(!owner->result_ok);
5027         return DecodeError_clone(&*owner->contents.err);
5028 }
5029 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
5030         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5031         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5032         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5033         uint64_t ret_ref = tag_ptr(ret_copy, true);
5034         return ret_ref;
5035 }
5036
5037 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5038         LDKNetworkGraph ret = *owner->contents.result;
5039         ret.is_owned = false;
5040         return ret;
5041 }
5042 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
5043         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5044         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5045         uint64_t ret_ref = 0;
5046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5048         return ret_ref;
5049 }
5050
5051 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5052 CHECK(!owner->result_ok);
5053         return DecodeError_clone(&*owner->contents.err);
5054 }
5055 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
5056         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5057         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5058         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5059         uint64_t ret_ref = tag_ptr(ret_copy, true);
5060         return ret_ref;
5061 }
5062
5063 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(uint64_t ptr) {
5064         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5065         switch(obj->tag) {
5066                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5067                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5068                 default: abort();
5069         }
5070 }
5071 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_SocketAddressZZ_Some_get_some(uint64_t ptr) {
5072         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5073         assert(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5074         LDKCVec_SocketAddressZ some_var = obj->some;
5075                         uint64_tArray some_arr = NULL;
5076                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
5077                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
5078                         for (size_t p = 0; p < some_var.datalen; p++) {
5079                                 uint64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5080                                 some_arr_ptr[p] = some_conv_15_ref;
5081                         }
5082                         
5083         return some_arr;
5084 }
5085 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5086 CHECK(owner->result_ok);
5087         return *owner->contents.result;
5088 }
5089 int64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_get_ok"))) TS_CResult_u64ShortChannelIdErrorZ_get_ok(uint64_t owner) {
5090         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5091         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
5092         return ret_conv;
5093 }
5094
5095 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5096 CHECK(!owner->result_ok);
5097         return ShortChannelIdError_clone(&*owner->contents.err);
5098 }
5099 uint32_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_get_err"))) TS_CResult_u64ShortChannelIdErrorZ_get_err(uint64_t owner) {
5100         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5101         uint32_t ret_conv = LDKShortChannelIdError_to_js(CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
5102         return ret_conv;
5103 }
5104
5105 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5106         LDKPendingHTLCInfo ret = *owner->contents.result;
5107         ret.is_owned = false;
5108         return ret;
5109 }
5110 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(uint64_t owner) {
5111         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5112         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5113         uint64_t ret_ref = 0;
5114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5116         return ret_ref;
5117 }
5118
5119 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5120         LDKInboundHTLCErr ret = *owner->contents.err;
5121         ret.is_owned = false;
5122         return ret;
5123 }
5124 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(uint64_t owner) {
5125         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5126         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5127         uint64_t ret_ref = 0;
5128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5130         return ret_ref;
5131 }
5132
5133 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5134         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5135         for (size_t i = 0; i < ret.datalen; i++) {
5136                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5137         }
5138         return ret;
5139 }
5140 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5141         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5142         for (size_t i = 0; i < ret.datalen; i++) {
5143                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5144         }
5145         return ret;
5146 }
5147 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5148         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5149         for (size_t i = 0; i < ret.datalen; i++) {
5150                 ret.data[i] = Utxo_clone(&orig->data[i]);
5151         }
5152         return ret;
5153 }
5154 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
5155         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5156         switch(obj->tag) {
5157                 case LDKCOption_TxOutZ_Some: return 0;
5158                 case LDKCOption_TxOutZ_None: return 1;
5159                 default: abort();
5160         }
5161 }
5162 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
5163         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5164         assert(obj->tag == LDKCOption_TxOutZ_Some);
5165         LDKTxOut* some_ref = &obj->some;
5166         return tag_ptr(some_ref, false);
5167 }
5168 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5169         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5170         for (size_t i = 0; i < ret.datalen; i++) {
5171                 ret.data[i] = Input_clone(&orig->data[i]);
5172         }
5173         return ret;
5174 }
5175 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5176         LDKCoinSelection ret = *owner->contents.result;
5177         ret.is_owned = false;
5178         return ret;
5179 }
5180 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
5181         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5182         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5183         uint64_t ret_ref = 0;
5184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5186         return ret_ref;
5187 }
5188
5189 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5190 CHECK(!owner->result_ok);
5191         return *owner->contents.err;
5192 }
5193 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
5194         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5195         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5196 }
5197
5198 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5199 CHECK(owner->result_ok);
5200         return CVec_UtxoZ_clone(&*owner->contents.result);
5201 }
5202 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
5203         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5204         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5205         uint64_tArray ret_arr = NULL;
5206         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5207         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5208         for (size_t g = 0; g < ret_var.datalen; g++) {
5209                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5210                 uint64_t ret_conv_6_ref = 0;
5211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5212                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5213                 ret_arr_ptr[g] = ret_conv_6_ref;
5214         }
5215         
5216         FREE(ret_var.data);
5217         return ret_arr;
5218 }
5219
5220 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5221 CHECK(!owner->result_ok);
5222         return *owner->contents.err;
5223 }
5224 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
5225         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5226         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5227 }
5228
5229 uint32_t __attribute__((export_name("TS_LDKPaymentContext_ty_from_ptr"))) TS_LDKPaymentContext_ty_from_ptr(uint64_t ptr) {
5230         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5231         switch(obj->tag) {
5232                 case LDKPaymentContext_Unknown: return 0;
5233                 case LDKPaymentContext_Bolt12Offer: return 1;
5234                 case LDKPaymentContext_Bolt12Refund: return 2;
5235                 default: abort();
5236         }
5237 }
5238 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Unknown_get_unknown"))) TS_LDKPaymentContext_Unknown_get_unknown(uint64_t ptr) {
5239         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5240         assert(obj->tag == LDKPaymentContext_Unknown);
5241         LDKUnknownPaymentContext unknown_var = obj->unknown;
5242                         uint64_t unknown_ref = 0;
5243                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
5244                         unknown_ref = tag_ptr(unknown_var.inner, false);
5245         return unknown_ref;
5246 }
5247 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Bolt12Offer_get_bolt12_offer"))) TS_LDKPaymentContext_Bolt12Offer_get_bolt12_offer(uint64_t ptr) {
5248         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5249         assert(obj->tag == LDKPaymentContext_Bolt12Offer);
5250         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
5251                         uint64_t bolt12_offer_ref = 0;
5252                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
5253                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
5254         return bolt12_offer_ref;
5255 }
5256 uint64_t __attribute__((export_name("TS_LDKPaymentContext_Bolt12Refund_get_bolt12_refund"))) TS_LDKPaymentContext_Bolt12Refund_get_bolt12_refund(uint64_t ptr) {
5257         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5258         assert(obj->tag == LDKPaymentContext_Bolt12Refund);
5259         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
5260                         uint64_t bolt12_refund_ref = 0;
5261                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
5262                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
5263         return bolt12_refund_ref;
5264 }
5265 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentContextZ_ty_from_ptr"))) TS_LDKCOption_PaymentContextZ_ty_from_ptr(uint64_t ptr) {
5266         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5267         switch(obj->tag) {
5268                 case LDKCOption_PaymentContextZ_Some: return 0;
5269                 case LDKCOption_PaymentContextZ_None: return 1;
5270                 default: abort();
5271         }
5272 }
5273 uint64_t __attribute__((export_name("TS_LDKCOption_PaymentContextZ_Some_get_some"))) TS_LDKCOption_PaymentContextZ_Some_get_some(uint64_t ptr) {
5274         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5275         assert(obj->tag == LDKCOption_PaymentContextZ_Some);
5276         uint64_t some_ref = tag_ptr(&obj->some, false);
5277         return some_ref;
5278 }
5279 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5280         return owner->a;
5281 }
5282 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_a"))) TS_C2Tuple_u64u16Z_get_a(uint64_t owner) {
5283         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5284         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5285         return ret_conv;
5286 }
5287
5288 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5289         return owner->b;
5290 }
5291 int16_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_get_b"))) TS_C2Tuple_u64u16Z_get_b(uint64_t owner) {
5292         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5293         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5294         return ret_conv;
5295 }
5296
5297 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(uint64_t ptr) {
5298         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5299         switch(obj->tag) {
5300                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5301                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5302                 default: abort();
5303         }
5304 }
5305 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(uint64_t ptr) {
5306         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5307         assert(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5308         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5309         *some_conv = obj->some;
5310                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5311         return tag_ptr(some_conv, true);
5312 }
5313 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5314         LDKChannelId ret = *owner->contents.result;
5315         ret.is_owned = false;
5316         return ret;
5317 }
5318 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_get_ok"))) TS_CResult_ChannelIdAPIErrorZ_get_ok(uint64_t owner) {
5319         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5320         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
5321         uint64_t ret_ref = 0;
5322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5324         return ret_ref;
5325 }
5326
5327 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5328 CHECK(!owner->result_ok);
5329         return APIError_clone(&*owner->contents.err);
5330 }
5331 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_get_err"))) TS_CResult_ChannelIdAPIErrorZ_get_err(uint64_t owner) {
5332         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5333         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5334         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
5335         uint64_t ret_ref = tag_ptr(ret_copy, true);
5336         return ret_ref;
5337 }
5338
5339 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5340         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5341         switch(obj->tag) {
5342                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5343                 case LDKRecentPaymentDetails_Pending: return 1;
5344                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5345                 case LDKRecentPaymentDetails_Abandoned: return 3;
5346                 default: abort();
5347         }
5348 }
5349 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id"))) TS_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(uint64_t ptr) {
5350         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5351         assert(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
5352         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5353         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
5354         return payment_id_arr;
5355 }
5356 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_id"))) TS_LDKRecentPaymentDetails_Pending_get_payment_id(uint64_t ptr) {
5357         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5358         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5359         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5360         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
5361         return payment_id_arr;
5362 }
5363 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5364         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5365         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5366         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5367         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5368         return payment_hash_arr;
5369 }
5370 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5371         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5372         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5373         int64_t total_msat_conv = obj->pending.total_msat;
5374         return total_msat_conv;
5375 }
5376 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_id(uint64_t ptr) {
5377         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5378         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5379         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5380         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
5381         return payment_id_arr;
5382 }
5383 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5384         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5385         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5386         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5387         return payment_hash_ref;
5388 }
5389 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_id"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_id(uint64_t ptr) {
5390         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5391         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5392         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5393         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
5394         return payment_id_arr;
5395 }
5396 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5397         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5398         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5399         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5400         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5401         return payment_hash_arr;
5402 }
5403 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5404         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5405         for (size_t i = 0; i < ret.datalen; i++) {
5406                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5407         }
5408         return ret;
5409 }
5410 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5411         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5412         switch(obj->tag) {
5413                 case LDKPaymentSendFailure_ParameterError: return 0;
5414                 case LDKPaymentSendFailure_PathParameterError: return 1;
5415                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5416                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5417                 case LDKPaymentSendFailure_PartialFailure: return 4;
5418                 default: abort();
5419         }
5420 }
5421 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
5422         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5423         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
5424         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5425         return parameter_error_ref;
5426 }
5427 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
5428         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5429         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
5430         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5431                         uint64_tArray path_parameter_error_arr = NULL;
5432                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
5433                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5434                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5435                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5436                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5437                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5438                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5439                         }
5440                         
5441         return path_parameter_error_arr;
5442 }
5443 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
5444         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5445         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5446         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5447                         uint64_tArray all_failed_resend_safe_arr = NULL;
5448                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5449                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5450                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5451                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5452                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5453                         }
5454                         
5455         return all_failed_resend_safe_arr;
5456 }
5457 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
5458         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5459         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5460         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5461                         uint64_tArray results_arr = NULL;
5462                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
5463                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
5464                         for (size_t w = 0; w < results_var.datalen; w++) {
5465                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5466                                 *results_conv_22_conv = results_var.data[w];
5467                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5468                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5469                         }
5470                         
5471         return results_arr;
5472 }
5473 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
5474         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5475         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5476         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5477                         uint64_t failed_paths_retry_ref = 0;
5478                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5479                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5480         return failed_paths_retry_ref;
5481 }
5482 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
5483         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5484         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
5485         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5486         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5487         return payment_id_arr;
5488 }
5489 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5490 CHECK(owner->result_ok);
5491         return *owner->contents.result;
5492 }
5493 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
5494         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5495         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5496 }
5497
5498 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5499 CHECK(!owner->result_ok);
5500         return PaymentSendFailure_clone(&*owner->contents.err);
5501 }
5502 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
5503         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5504         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5505         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5506         uint64_t ret_ref = tag_ptr(ret_copy, true);
5507         return ret_ref;
5508 }
5509
5510 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5511 CHECK(owner->result_ok);
5512         return *owner->contents.result;
5513 }
5514 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
5515         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5516         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5517 }
5518
5519 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5520 CHECK(!owner->result_ok);
5521         return RetryableSendFailure_clone(&*owner->contents.err);
5522 }
5523 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
5524         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5525         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5526         return ret_conv;
5527 }
5528
5529 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5530 CHECK(owner->result_ok);
5531         return ThirtyTwoBytes_clone(&*owner->contents.result);
5532 }
5533 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(uint64_t owner) {
5534         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5535         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5536         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5537         return ret_arr;
5538 }
5539
5540 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5541 CHECK(!owner->result_ok);
5542         return PaymentSendFailure_clone(&*owner->contents.err);
5543 }
5544 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(uint64_t owner) {
5545         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5546         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5547         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5548         uint64_t ret_ref = tag_ptr(ret_copy, true);
5549         return ret_ref;
5550 }
5551
5552 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5553 CHECK(owner->result_ok);
5554         return ThirtyTwoBytes_clone(&*owner->contents.result);
5555 }
5556 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(uint64_t owner) {
5557         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5558         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5559         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5560         return ret_arr;
5561 }
5562
5563 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5564 CHECK(!owner->result_ok);
5565         return RetryableSendFailure_clone(&*owner->contents.err);
5566 }
5567 uint32_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(uint64_t owner) {
5568         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5569         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5570         return ret_conv;
5571 }
5572
5573 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5574         return ThirtyTwoBytes_clone(&owner->a);
5575 }
5576 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(uint64_t owner) {
5577         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5578         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5579         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5580         return ret_arr;
5581 }
5582
5583 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5584         return ThirtyTwoBytes_clone(&owner->b);
5585 }
5586 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(uint64_t owner) {
5587         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5588         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5589         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5590         return ret_arr;
5591 }
5592
5593 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5594 CHECK(owner->result_ok);
5595         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5596 }
5597 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(uint64_t owner) {
5598         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5599         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5600         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5601         return tag_ptr(ret_conv, true);
5602 }
5603
5604 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5605 CHECK(!owner->result_ok);
5606         return PaymentSendFailure_clone(&*owner->contents.err);
5607 }
5608 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(uint64_t owner) {
5609         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5610         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5611         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5612         uint64_t ret_ref = tag_ptr(ret_copy, true);
5613         return ret_ref;
5614 }
5615
5616 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5617         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5618         for (size_t i = 0; i < ret.datalen; i++) {
5619                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5620         }
5621         return ret;
5622 }
5623 uint32_t __attribute__((export_name("TS_LDKProbeSendFailure_ty_from_ptr"))) TS_LDKProbeSendFailure_ty_from_ptr(uint64_t ptr) {
5624         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5625         switch(obj->tag) {
5626                 case LDKProbeSendFailure_RouteNotFound: return 0;
5627                 case LDKProbeSendFailure_SendingFailed: return 1;
5628                 default: abort();
5629         }
5630 }
5631 uint64_t __attribute__((export_name("TS_LDKProbeSendFailure_SendingFailed_get_sending_failed"))) TS_LDKProbeSendFailure_SendingFailed_get_sending_failed(uint64_t ptr) {
5632         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5633         assert(obj->tag == LDKProbeSendFailure_SendingFailed);
5634         uint64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5635         return sending_failed_ref;
5636 }
5637 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5638 CHECK(owner->result_ok);
5639         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5640 }
5641 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(uint64_t owner) {
5642         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5643         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5644         uint64_tArray ret_arr = NULL;
5645         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5646         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5647         for (size_t o = 0; o < ret_var.datalen; o++) {
5648                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5649                 *ret_conv_40_conv = ret_var.data[o];
5650                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5651         }
5652         
5653         FREE(ret_var.data);
5654         return ret_arr;
5655 }
5656
5657 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5658 CHECK(!owner->result_ok);
5659         return ProbeSendFailure_clone(&*owner->contents.err);
5660 }
5661 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(uint64_t owner) {
5662         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5663         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5664         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5665         uint64_t ret_ref = tag_ptr(ret_copy, true);
5666         return ret_ref;
5667 }
5668
5669 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
5670         LDKChannelId ret = owner->a;
5671         ret.is_owned = false;
5672         return ret;
5673 }
5674 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_get_a"))) TS_C2Tuple_ChannelIdPublicKeyZ_get_a(uint64_t owner) {
5675         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
5676         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
5677         uint64_t ret_ref = 0;
5678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5680         return ret_ref;
5681 }
5682
5683 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
5684         return owner->b;
5685 }
5686 int8_tArray  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_get_b"))) TS_C2Tuple_ChannelIdPublicKeyZ_get_b(uint64_t owner) {
5687         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
5688         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5689         memcpy(ret_arr->elems, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5690         return ret_arr;
5691 }
5692
5693 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
5694         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5695         for (size_t i = 0; i < ret.datalen; i++) {
5696                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
5697         }
5698         return ret;
5699 }
5700 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
5701         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
5702         for (size_t i = 0; i < ret.datalen; i++) {
5703                 ret.data[i] = ChannelId_clone(&orig->data[i]);
5704         }
5705         return ret;
5706 }
5707 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
5708         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
5709         ret.is_owned = false;
5710         return ret;
5711 }
5712 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
5713         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
5714         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
5715         uint64_t ret_ref = 0;
5716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5718         return ret_ref;
5719 }
5720
5721 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
5722 CHECK(!owner->result_ok);
5723         return Bolt12SemanticError_clone(&*owner->contents.err);
5724 }
5725 uint32_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
5726         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
5727         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
5728         return ret_conv;
5729 }
5730
5731 uint32_t __attribute__((export_name("TS_LDKCOption_StrZ_ty_from_ptr"))) TS_LDKCOption_StrZ_ty_from_ptr(uint64_t ptr) {
5732         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5733         switch(obj->tag) {
5734                 case LDKCOption_StrZ_Some: return 0;
5735                 case LDKCOption_StrZ_None: return 1;
5736                 default: abort();
5737         }
5738 }
5739 jstring __attribute__((export_name("TS_LDKCOption_StrZ_Some_get_some"))) TS_LDKCOption_StrZ_Some_get_some(uint64_t ptr) {
5740         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5741         assert(obj->tag == LDKCOption_StrZ_Some);
5742         LDKStr some_str = obj->some;
5743                         jstring some_conv = str_ref_to_ts(some_str.chars, some_str.len);
5744         return some_conv;
5745 }
5746 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5747 CHECK(owner->result_ok);
5748         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5749 }
5750 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(uint64_t owner) {
5751         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5752         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5753         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5754         return tag_ptr(ret_conv, true);
5755 }
5756
5757 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5758 CHECK(!owner->result_ok);
5759         return *owner->contents.err;
5760 }
5761 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(uint64_t owner) {
5762         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5763         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5764 }
5765
5766 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5767 CHECK(owner->result_ok);
5768         return ThirtyTwoBytes_clone(&*owner->contents.result);
5769 }
5770 int8_tArray  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(uint64_t owner) {
5771         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5772         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5773         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
5774         return ret_arr;
5775 }
5776
5777 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5778 CHECK(!owner->result_ok);
5779         return APIError_clone(&*owner->contents.err);
5780 }
5781 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_get_err(uint64_t owner) {
5782         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5783         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5784         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
5785         uint64_t ret_ref = tag_ptr(ret_copy, true);
5786         return ret_ref;
5787 }
5788
5789 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
5790         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5791         switch(obj->tag) {
5792                 case LDKOffersMessage_InvoiceRequest: return 0;
5793                 case LDKOffersMessage_Invoice: return 1;
5794                 case LDKOffersMessage_InvoiceError: return 2;
5795                 default: abort();
5796         }
5797 }
5798 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
5799         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5800         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
5801         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5802                         uint64_t invoice_request_ref = 0;
5803                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5804                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5805         return invoice_request_ref;
5806 }
5807 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
5808         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5809         assert(obj->tag == LDKOffersMessage_Invoice);
5810         LDKBolt12Invoice invoice_var = obj->invoice;
5811                         uint64_t invoice_ref = 0;
5812                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5813                         invoice_ref = tag_ptr(invoice_var.inner, false);
5814         return invoice_ref;
5815 }
5816 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
5817         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5818         assert(obj->tag == LDKOffersMessage_InvoiceError);
5819         LDKInvoiceError invoice_error_var = obj->invoice_error;
5820                         uint64_t invoice_error_ref = 0;
5821                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5822                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5823         return invoice_error_ref;
5824 }
5825 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
5826         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5827         switch(obj->tag) {
5828                 case LDKCOption_OffersMessageZ_Some: return 0;
5829                 case LDKCOption_OffersMessageZ_None: return 1;
5830                 default: abort();
5831         }
5832 }
5833 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
5834         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5835         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
5836         uint64_t some_ref = tag_ptr(&obj->some, false);
5837         return some_ref;
5838 }
5839 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
5840         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5841         switch(obj->tag) {
5842                 case LDKDestination_Node: return 0;
5843                 case LDKDestination_BlindedPath: return 1;
5844                 default: abort();
5845         }
5846 }
5847 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
5848         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5849         assert(obj->tag == LDKDestination_Node);
5850         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5851         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5852         return node_arr;
5853 }
5854 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
5855         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5856         assert(obj->tag == LDKDestination_BlindedPath);
5857         LDKBlindedPath blinded_path_var = obj->blinded_path;
5858                         uint64_t blinded_path_ref = 0;
5859                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5860                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5861         return blinded_path_ref;
5862 }
5863 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5864         return OffersMessage_clone(&owner->a);
5865 }
5866 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(uint64_t owner) {
5867         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5868         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5869         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5870         uint64_t ret_ref = tag_ptr(ret_copy, true);
5871         return ret_ref;
5872 }
5873
5874 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5875         return Destination_clone(&owner->b);
5876 }
5877 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(uint64_t owner) {
5878         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5879         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5880         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5881         uint64_t ret_ref = tag_ptr(ret_copy, true);
5882         return ret_ref;
5883 }
5884
5885 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5886         LDKBlindedPath ret = owner->c;
5887         ret.is_owned = false;
5888         return ret;
5889 }
5890 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(uint64_t owner) {
5891         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5892         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5893         uint64_t ret_ref = 0;
5894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5896         return ret_ref;
5897 }
5898
5899 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5900         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5901         for (size_t i = 0; i < ret.datalen; i++) {
5902                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5903         }
5904         return ret;
5905 }
5906 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5907         LDKPhantomRouteHints ret = *owner->contents.result;
5908         ret.is_owned = false;
5909         return ret;
5910 }
5911 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5912         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5913         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5914         uint64_t ret_ref = 0;
5915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5917         return ret_ref;
5918 }
5919
5920 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5921 CHECK(!owner->result_ok);
5922         return DecodeError_clone(&*owner->contents.err);
5923 }
5924 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5925         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5927         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5928         uint64_t ret_ref = tag_ptr(ret_copy, true);
5929         return ret_ref;
5930 }
5931
5932 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5933         LDKBlindedForward ret = *owner->contents.result;
5934         ret.is_owned = false;
5935         return ret;
5936 }
5937 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_get_ok(uint64_t owner) {
5938         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5939         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
5940         uint64_t ret_ref = 0;
5941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5943         return ret_ref;
5944 }
5945
5946 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
5947 CHECK(!owner->result_ok);
5948         return DecodeError_clone(&*owner->contents.err);
5949 }
5950 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_get_err"))) TS_CResult_BlindedForwardDecodeErrorZ_get_err(uint64_t owner) {
5951         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
5952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5953         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
5954         uint64_t ret_ref = tag_ptr(ret_copy, true);
5955         return ret_ref;
5956 }
5957
5958 uint32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ty_from_ptr"))) TS_LDKPendingHTLCRouting_ty_from_ptr(uint64_t ptr) {
5959         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5960         switch(obj->tag) {
5961                 case LDKPendingHTLCRouting_Forward: return 0;
5962                 case LDKPendingHTLCRouting_Receive: return 1;
5963                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
5964                 default: abort();
5965         }
5966 }
5967 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_onion_packet"))) TS_LDKPendingHTLCRouting_Forward_get_onion_packet(uint64_t ptr) {
5968         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5969         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5970         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
5971                         uint64_t onion_packet_ref = 0;
5972                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
5973                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
5974         return onion_packet_ref;
5975 }
5976 int64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_short_channel_id"))) TS_LDKPendingHTLCRouting_Forward_get_short_channel_id(uint64_t ptr) {
5977         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5978         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5979         int64_t short_channel_id_conv = obj->forward.short_channel_id;
5980         return short_channel_id_conv;
5981 }
5982 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Forward_get_blinded"))) TS_LDKPendingHTLCRouting_Forward_get_blinded(uint64_t ptr) {
5983         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5984         assert(obj->tag == LDKPendingHTLCRouting_Forward);
5985         LDKBlindedForward blinded_var = obj->forward.blinded;
5986                         uint64_t blinded_ref = 0;
5987                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
5988                         blinded_ref = tag_ptr(blinded_var.inner, false);
5989         return blinded_ref;
5990 }
5991 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_data"))) TS_LDKPendingHTLCRouting_Receive_get_payment_data(uint64_t ptr) {
5992         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
5993         assert(obj->tag == LDKPendingHTLCRouting_Receive);
5994         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
5995                         uint64_t payment_data_ref = 0;
5996                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
5997                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
5998         return payment_data_ref;
5999 }
6000 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_metadata"))) TS_LDKPendingHTLCRouting_Receive_get_payment_metadata(uint64_t ptr) {
6001         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6002         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6003         uint64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6004         return payment_metadata_ref;
6005 }
6006 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_payment_context"))) TS_LDKPendingHTLCRouting_Receive_get_payment_context(uint64_t ptr) {
6007         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6008         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6009         uint64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
6010         return payment_context_ref;
6011 }
6012 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(uint64_t ptr) {
6013         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6014         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6015         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6016         return incoming_cltv_expiry_conv;
6017 }
6018 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret"))) TS_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(uint64_t ptr) {
6019         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6020         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6021         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6022         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6023         return phantom_shared_secret_arr;
6024 }
6025 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_Receive_get_custom_tlvs(uint64_t ptr) {
6026         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6027         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6028         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6029                         uint64_tArray custom_tlvs_arr = NULL;
6030                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
6031                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6032                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6033                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6034                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6035                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6036                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6037                         }
6038                         
6039         return custom_tlvs_arr;
6040 }
6041 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(uint64_t ptr) {
6042         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6043         assert(obj->tag == LDKPendingHTLCRouting_Receive);
6044         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6045         return requires_blinded_error_conv;
6046 }
6047 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(uint64_t ptr) {
6048         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6049         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6050         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6051                         uint64_t payment_data_ref = 0;
6052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6053                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6054         return payment_data_ref;
6055 }
6056 int8_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(uint64_t ptr) {
6057         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6058         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6059         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6060         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6061         return payment_preimage_arr;
6062 }
6063 uint64_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(uint64_t ptr) {
6064         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6065         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6066         uint64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6067         return payment_metadata_ref;
6068 }
6069 int32_t __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(uint64_t ptr) {
6070         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6071         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6072         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6073         return incoming_cltv_expiry_conv;
6074 }
6075 uint64_tArray __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(uint64_t ptr) {
6076         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6077         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6078         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6079                         uint64_tArray custom_tlvs_arr = NULL;
6080                         custom_tlvs_arr = init_uint64_tArray(custom_tlvs_var.datalen, __LINE__);
6081                         uint64_t *custom_tlvs_arr_ptr = (uint64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6082                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6083                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6084                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6085                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6086                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6087                         }
6088                         
6089         return custom_tlvs_arr;
6090 }
6091 jboolean __attribute__((export_name("TS_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error"))) TS_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error(uint64_t ptr) {
6092         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6093         assert(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6094         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
6095         return requires_blinded_error_conv;
6096 }
6097 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6098 CHECK(owner->result_ok);
6099         return PendingHTLCRouting_clone(&*owner->contents.result);
6100 }
6101 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(uint64_t owner) {
6102         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6103         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6104         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6105         uint64_t ret_ref = tag_ptr(ret_copy, true);
6106         return ret_ref;
6107 }
6108
6109 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6110 CHECK(!owner->result_ok);
6111         return DecodeError_clone(&*owner->contents.err);
6112 }
6113 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(uint64_t owner) {
6114         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6115         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6116         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6117         uint64_t ret_ref = tag_ptr(ret_copy, true);
6118         return ret_ref;
6119 }
6120
6121 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6122         LDKPendingHTLCInfo ret = *owner->contents.result;
6123         ret.is_owned = false;
6124         return ret;
6125 }
6126 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(uint64_t owner) {
6127         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6128         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6129         uint64_t ret_ref = 0;
6130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6132         return ret_ref;
6133 }
6134
6135 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6136 CHECK(!owner->result_ok);
6137         return DecodeError_clone(&*owner->contents.err);
6138 }
6139 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_get_err(uint64_t owner) {
6140         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6142         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6143         uint64_t ret_ref = tag_ptr(ret_copy, true);
6144         return ret_ref;
6145 }
6146
6147 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6148 CHECK(owner->result_ok);
6149         return BlindedFailure_clone(&*owner->contents.result);
6150 }
6151 uint32_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_get_ok(uint64_t owner) {
6152         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6153         uint32_t ret_conv = LDKBlindedFailure_to_js(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6154         return ret_conv;
6155 }
6156
6157 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6158 CHECK(!owner->result_ok);
6159         return DecodeError_clone(&*owner->contents.err);
6160 }
6161 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_get_err"))) TS_CResult_BlindedFailureDecodeErrorZ_get_err(uint64_t owner) {
6162         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6163         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6164         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6165         uint64_t ret_ref = tag_ptr(ret_copy, true);
6166         return ret_ref;
6167 }
6168
6169 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6170         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6171         for (size_t i = 0; i < ret.datalen; i++) {
6172                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6173         }
6174         return ret;
6175 }
6176 typedef struct LDKWatch_JCalls {
6177         atomic_size_t refcnt;
6178         uint32_t instance_ptr;
6179 } LDKWatch_JCalls;
6180 static void LDKWatch_JCalls_free(void* this_arg) {
6181         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6182         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6183                 FREE(j_calls);
6184         }
6185 }
6186 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6187         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6188         LDKOutPoint funding_txo_var = funding_txo;
6189         uint64_t funding_txo_ref = 0;
6190         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6191         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6192         LDKChannelMonitor monitor_var = monitor;
6193         uint64_t monitor_ref = 0;
6194         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6195         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6196         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
6197         void* ret_ptr = untag_ptr(ret);
6198         CHECK_ACCESS(ret_ptr);
6199         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6200         FREE(untag_ptr(ret));
6201         return ret_conv;
6202 }
6203 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6204         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6205         LDKOutPoint funding_txo_var = funding_txo;
6206         uint64_t funding_txo_ref = 0;
6207         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6208         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6209         LDKChannelMonitorUpdate update_var = *update;
6210         uint64_t update_ref = 0;
6211         update_var = ChannelMonitorUpdate_clone(&update_var);
6212         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6213         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6214         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
6215         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6216         return ret_conv;
6217 }
6218 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6219         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6220         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
6221         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
6222         ret_constr.datalen = ret->arr_len;
6223         if (ret_constr.datalen > 0)
6224                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
6225         else
6226                 ret_constr.data = NULL;
6227         uint64_t* ret_vals = ret->elems;
6228         for (size_t f = 0; f < ret_constr.datalen; f++) {
6229                 uint64_t ret_conv_57 = ret_vals[f];
6230                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
6231                 CHECK_ACCESS(ret_conv_57_ptr);
6232                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
6233                 FREE(untag_ptr(ret_conv_57));
6234                 ret_constr.data[f] = ret_conv_57_conv;
6235         }
6236         FREE(ret);
6237         return ret_constr;
6238 }
6239 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6240         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6241         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6242 }
6243 static inline LDKWatch LDKWatch_init (JSValue o) {
6244         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6245         atomic_init(&calls->refcnt, 1);
6246         calls->instance_ptr = o;
6247
6248         LDKWatch ret = {
6249                 .this_arg = (void*) calls,
6250                 .watch_channel = watch_channel_LDKWatch_jcall,
6251                 .update_channel = update_channel_LDKWatch_jcall,
6252                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6253                 .free = LDKWatch_JCalls_free,
6254         };
6255         return ret;
6256 }
6257 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6258         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6259         *res_ptr = LDKWatch_init(o);
6260         return tag_ptr(res_ptr, true);
6261 }
6262 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
6263         void* this_arg_ptr = untag_ptr(this_arg);
6264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6265         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6266         LDKOutPoint funding_txo_conv;
6267         funding_txo_conv.inner = untag_ptr(funding_txo);
6268         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6269         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6270         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6271         LDKChannelMonitor monitor_conv;
6272         monitor_conv.inner = untag_ptr(monitor);
6273         monitor_conv.is_owned = ptr_is_owned(monitor);
6274         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6275         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6276         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
6277         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6278         return tag_ptr(ret_conv, true);
6279 }
6280
6281 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
6282         void* this_arg_ptr = untag_ptr(this_arg);
6283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6284         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6285         LDKOutPoint funding_txo_conv;
6286         funding_txo_conv.inner = untag_ptr(funding_txo);
6287         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6288         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6289         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6290         LDKChannelMonitorUpdate update_conv;
6291         update_conv.inner = untag_ptr(update);
6292         update_conv.is_owned = ptr_is_owned(update);
6293         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6294         update_conv.is_owned = false;
6295         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6296         return ret_conv;
6297 }
6298
6299 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
6300         void* this_arg_ptr = untag_ptr(this_arg);
6301         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6302         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6303         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6304         uint64_tArray ret_arr = NULL;
6305         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6306         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6307         for (size_t f = 0; f < ret_var.datalen; f++) {
6308                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
6309                 *ret_conv_57_conv = ret_var.data[f];
6310                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
6311         }
6312         
6313         FREE(ret_var.data);
6314         return ret_arr;
6315 }
6316
6317 typedef struct LDKBroadcasterInterface_JCalls {
6318         atomic_size_t refcnt;
6319         uint32_t instance_ptr;
6320 } LDKBroadcasterInterface_JCalls;
6321 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6322         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6323         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6324                 FREE(j_calls);
6325         }
6326 }
6327 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6328         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6329         LDKCVec_TransactionZ txs_var = txs;
6330         ptrArray txs_arr = NULL;
6331         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6332         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6333         for (size_t m = 0; m < txs_var.datalen; m++) {
6334                 LDKTransaction txs_conv_12_var = txs_var.data[m];
6335                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
6336                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
6337                 Transaction_free(txs_conv_12_var);
6338                 txs_arr_ptr[m] = txs_conv_12_arr;
6339         }
6340         
6341         FREE(txs_var.data);
6342         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
6343 }
6344 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6345         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6346         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6347 }
6348 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6349         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6350         atomic_init(&calls->refcnt, 1);
6351         calls->instance_ptr = o;
6352
6353         LDKBroadcasterInterface ret = {
6354                 .this_arg = (void*) calls,
6355                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6356                 .free = LDKBroadcasterInterface_JCalls_free,
6357         };
6358         return ret;
6359 }
6360 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6361         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6362         *res_ptr = LDKBroadcasterInterface_init(o);
6363         return tag_ptr(res_ptr, true);
6364 }
6365 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
6366         void* this_arg_ptr = untag_ptr(this_arg);
6367         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6368         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6369         LDKCVec_TransactionZ txs_constr;
6370         txs_constr.datalen = txs->arr_len;
6371         if (txs_constr.datalen > 0)
6372                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6373         else
6374                 txs_constr.data = NULL;
6375         int8_tArray* txs_vals = (void*) txs->elems;
6376         for (size_t m = 0; m < txs_constr.datalen; m++) {
6377                 int8_tArray txs_conv_12 = txs_vals[m];
6378                 LDKTransaction txs_conv_12_ref;
6379                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
6380                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
6381                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
6382                 txs_conv_12_ref.data_is_owned = true;
6383                 txs_constr.data[m] = txs_conv_12_ref;
6384         }
6385         FREE(txs);
6386         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6387 }
6388
6389 typedef struct LDKEntropySource_JCalls {
6390         atomic_size_t refcnt;
6391         uint32_t instance_ptr;
6392 } LDKEntropySource_JCalls;
6393 static void LDKEntropySource_JCalls_free(void* this_arg) {
6394         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6395         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6396                 FREE(j_calls);
6397         }
6398 }
6399 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6400         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6401         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
6402         LDKThirtyTwoBytes ret_ref;
6403         CHECK(ret->arr_len == 32);
6404         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6405         return ret_ref;
6406 }
6407 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6408         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6409         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6410 }
6411 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
6412         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6413         atomic_init(&calls->refcnt, 1);
6414         calls->instance_ptr = o;
6415
6416         LDKEntropySource ret = {
6417                 .this_arg = (void*) calls,
6418                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6419                 .free = LDKEntropySource_JCalls_free,
6420         };
6421         return ret;
6422 }
6423 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
6424         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6425         *res_ptr = LDKEntropySource_init(o);
6426         return tag_ptr(res_ptr, true);
6427 }
6428 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
6429         void* this_arg_ptr = untag_ptr(this_arg);
6430         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6431         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6432         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6433         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6434         return ret_arr;
6435 }
6436
6437 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
6438         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6439         switch(obj->tag) {
6440                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6441                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6442                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6443                 default: abort();
6444         }
6445 }
6446 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
6447         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6448         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6449         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6450                         uint64_t channel_announcement_ref = 0;
6451                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6452                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6453         return channel_announcement_ref;
6454 }
6455 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
6456         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6457         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6458         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6459                         uint64_t channel_update_ref = 0;
6460                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6461                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6462         return channel_update_ref;
6463 }
6464 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
6465         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6466         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6467         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6468                         uint64_t node_announcement_ref = 0;
6469                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6470                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6471         return node_announcement_ref;
6472 }
6473 typedef struct LDKNodeSigner_JCalls {
6474         atomic_size_t refcnt;
6475         uint32_t instance_ptr;
6476 } LDKNodeSigner_JCalls;
6477 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6478         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6479         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6480                 FREE(j_calls);
6481         }
6482 }
6483 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6484         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6485         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6486         LDKThirtyTwoBytes ret_ref;
6487         CHECK(ret->arr_len == 32);
6488         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6489         return ret_ref;
6490 }
6491 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6492         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6493         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6494         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6495         void* ret_ptr = untag_ptr(ret);
6496         CHECK_ACCESS(ret_ptr);
6497         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6498         FREE(untag_ptr(ret));
6499         return ret_conv;
6500 }
6501 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6502         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6503         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6504         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6505         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6506         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6507         *tweak_copy = tweak;
6508         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6509         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6510         void* ret_ptr = untag_ptr(ret);
6511         CHECK_ACCESS(ret_ptr);
6512         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6513         FREE(untag_ptr(ret));
6514         return ret_conv;
6515 }
6516 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6517         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6518         LDKu8slice hrp_bytes_var = hrp_bytes;
6519         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6520         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6521         LDKCVec_U5Z invoice_data_var = invoice_data;
6522         ptrArray invoice_data_arr = NULL;
6523         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6524         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6525         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6526                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6527                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6528         }
6529         
6530         FREE(invoice_data_var.data);
6531         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6532         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);
6533         void* ret_ptr = untag_ptr(ret);
6534         CHECK_ACCESS(ret_ptr);
6535         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6536         FREE(untag_ptr(ret));
6537         return ret_conv;
6538 }
6539 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6540         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6541         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6542         uint64_t invoice_request_ref = 0;
6543         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
6544         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6545         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6546         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, invoice_request_ref, 0, 0, 0, 0, 0);
6547         void* ret_ptr = untag_ptr(ret);
6548         CHECK_ACCESS(ret_ptr);
6549         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6550         FREE(untag_ptr(ret));
6551         return ret_conv;
6552 }
6553 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6554         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6555         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6556         uint64_t invoice_ref = 0;
6557         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
6558         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6559         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6560         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 28, invoice_ref, 0, 0, 0, 0, 0);
6561         void* ret_ptr = untag_ptr(ret);
6562         CHECK_ACCESS(ret_ptr);
6563         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6564         FREE(untag_ptr(ret));
6565         return ret_conv;
6566 }
6567 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6568         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6569         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6570         *msg_copy = msg;
6571         uint64_t msg_ref = tag_ptr(msg_copy, true);
6572         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, msg_ref, 0, 0, 0, 0, 0);
6573         void* ret_ptr = untag_ptr(ret);
6574         CHECK_ACCESS(ret_ptr);
6575         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6576         FREE(untag_ptr(ret));
6577         return ret_conv;
6578 }
6579 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6580         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6581         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6582 }
6583 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6584         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6585         atomic_init(&calls->refcnt, 1);
6586         calls->instance_ptr = o;
6587
6588         LDKNodeSigner ret = {
6589                 .this_arg = (void*) calls,
6590                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6591                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6592                 .ecdh = ecdh_LDKNodeSigner_jcall,
6593                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6594                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6595                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6596                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6597                 .free = LDKNodeSigner_JCalls_free,
6598         };
6599         return ret;
6600 }
6601 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6602         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6603         *res_ptr = LDKNodeSigner_init(o);
6604         return tag_ptr(res_ptr, true);
6605 }
6606 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6607         void* this_arg_ptr = untag_ptr(this_arg);
6608         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6609         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6610         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6611         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6612         return ret_arr;
6613 }
6614
6615 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6616         void* this_arg_ptr = untag_ptr(this_arg);
6617         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6618         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6619         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6620         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6621         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6622         return tag_ptr(ret_conv, true);
6623 }
6624
6625 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) {
6626         void* this_arg_ptr = untag_ptr(this_arg);
6627         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6628         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6629         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6630         LDKPublicKey other_key_ref;
6631         CHECK(other_key->arr_len == 33);
6632         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6633         void* tweak_ptr = untag_ptr(tweak);
6634         CHECK_ACCESS(tweak_ptr);
6635         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6636         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6637         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6638         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6639         return tag_ptr(ret_conv, true);
6640 }
6641
6642 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) {
6643         void* this_arg_ptr = untag_ptr(this_arg);
6644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6645         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6646         LDKu8slice hrp_bytes_ref;
6647         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6648         hrp_bytes_ref.data = hrp_bytes->elems;
6649         LDKCVec_U5Z invoice_data_constr;
6650         invoice_data_constr.datalen = invoice_data->arr_len;
6651         if (invoice_data_constr.datalen > 0)
6652                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6653         else
6654                 invoice_data_constr.data = NULL;
6655         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6656         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6657                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6658                 
6659                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6660         }
6661         FREE(invoice_data);
6662         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6663         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6664         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6665         FREE(hrp_bytes);
6666         return tag_ptr(ret_conv, true);
6667 }
6668
6669 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) {
6670         void* this_arg_ptr = untag_ptr(this_arg);
6671         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6672         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6673         LDKUnsignedInvoiceRequest invoice_request_conv;
6674         invoice_request_conv.inner = untag_ptr(invoice_request);
6675         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6676         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6677         invoice_request_conv.is_owned = false;
6678         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6679         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6680         return tag_ptr(ret_conv, true);
6681 }
6682
6683 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_bolt12_invoice"))) TS_NodeSigner_sign_bolt12_invoice(uint64_t this_arg, uint64_t invoice) {
6684         void* this_arg_ptr = untag_ptr(this_arg);
6685         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6686         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6687         LDKUnsignedBolt12Invoice invoice_conv;
6688         invoice_conv.inner = untag_ptr(invoice);
6689         invoice_conv.is_owned = ptr_is_owned(invoice);
6690         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6691         invoice_conv.is_owned = false;
6692         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6693         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6694         return tag_ptr(ret_conv, true);
6695 }
6696
6697 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6698         void* this_arg_ptr = untag_ptr(this_arg);
6699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6700         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6701         void* msg_ptr = untag_ptr(msg);
6702         CHECK_ACCESS(msg_ptr);
6703         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6704         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6705         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6706         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6707         return tag_ptr(ret_conv, true);
6708 }
6709
6710 typedef struct LDKSignerProvider_JCalls {
6711         atomic_size_t refcnt;
6712         uint32_t instance_ptr;
6713 } LDKSignerProvider_JCalls;
6714 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6715         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6716         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6717                 FREE(j_calls);
6718         }
6719 }
6720 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6721         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6722         jboolean inbound_conv = inbound;
6723         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6724         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6725         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6726         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);
6727         LDKThirtyTwoBytes ret_ref;
6728         CHECK(ret->arr_len == 32);
6729         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6730         return ret_ref;
6731 }
6732 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6733         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6734         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6735         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6736         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6737         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);
6738         void* ret_ptr = untag_ptr(ret);
6739         CHECK_ACCESS(ret_ptr);
6740         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6741         FREE(untag_ptr(ret));
6742         return ret_conv;
6743 }
6744 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6745         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6746         LDKu8slice reader_var = reader;
6747         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6748         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6749         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6750         void* ret_ptr = untag_ptr(ret);
6751         CHECK_ACCESS(ret_ptr);
6752         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6753         FREE(untag_ptr(ret));
6754         return ret_conv;
6755 }
6756 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6757         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6758         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6759         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6760         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0, 0);
6761         void* ret_ptr = untag_ptr(ret);
6762         CHECK_ACCESS(ret_ptr);
6763         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6764         FREE(untag_ptr(ret));
6765         return ret_conv;
6766 }
6767 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6768         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6769         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
6770         void* ret_ptr = untag_ptr(ret);
6771         CHECK_ACCESS(ret_ptr);
6772         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6773         FREE(untag_ptr(ret));
6774         return ret_conv;
6775 }
6776 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6777         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6778         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6779 }
6780 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6781         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6782         atomic_init(&calls->refcnt, 1);
6783         calls->instance_ptr = o;
6784
6785         LDKSignerProvider ret = {
6786                 .this_arg = (void*) calls,
6787                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6788                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6789                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6790                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6791                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6792                 .free = LDKSignerProvider_JCalls_free,
6793         };
6794         return ret;
6795 }
6796 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
6797         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6798         *res_ptr = LDKSignerProvider_init(o);
6799         return tag_ptr(res_ptr, true);
6800 }
6801 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) {
6802         void* this_arg_ptr = untag_ptr(this_arg);
6803         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6804         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6805         LDKU128 user_channel_id_ref;
6806         CHECK(user_channel_id->arr_len == 16);
6807         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6808         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6809         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);
6810         return ret_arr;
6811 }
6812
6813 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) {
6814         void* this_arg_ptr = untag_ptr(this_arg);
6815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6816         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6817         LDKThirtyTwoBytes channel_keys_id_ref;
6818         CHECK(channel_keys_id->arr_len == 32);
6819         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6820         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6821         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6822         return tag_ptr(ret_ret, true);
6823 }
6824
6825 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
6826         void* this_arg_ptr = untag_ptr(this_arg);
6827         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6828         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6829         LDKu8slice reader_ref;
6830         reader_ref.datalen = reader->arr_len;
6831         reader_ref.data = reader->elems;
6832         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6833         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6834         FREE(reader);
6835         return tag_ptr(ret_conv, true);
6836 }
6837
6838 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg, int8_tArray channel_keys_id) {
6839         void* this_arg_ptr = untag_ptr(this_arg);
6840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6841         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6842         LDKThirtyTwoBytes channel_keys_id_ref;
6843         CHECK(channel_keys_id->arr_len == 32);
6844         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6845         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
6846         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
6847         return tag_ptr(ret_conv, true);
6848 }
6849
6850 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
6851         void* this_arg_ptr = untag_ptr(this_arg);
6852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6853         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6854         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
6855         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6856         return tag_ptr(ret_conv, true);
6857 }
6858
6859 typedef struct LDKFeeEstimator_JCalls {
6860         atomic_size_t refcnt;
6861         uint32_t instance_ptr;
6862 } LDKFeeEstimator_JCalls;
6863 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6864         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6865         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6866                 FREE(j_calls);
6867         }
6868 }
6869 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6870         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6871         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6872         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, confirmation_target_conv, 0, 0, 0, 0, 0);
6873 }
6874 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6875         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6876         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6877 }
6878 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
6879         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6880         atomic_init(&calls->refcnt, 1);
6881         calls->instance_ptr = o;
6882
6883         LDKFeeEstimator ret = {
6884                 .this_arg = (void*) calls,
6885                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6886                 .free = LDKFeeEstimator_JCalls_free,
6887         };
6888         return ret;
6889 }
6890 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
6891         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6892         *res_ptr = LDKFeeEstimator_init(o);
6893         return tag_ptr(res_ptr, true);
6894 }
6895 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) {
6896         void* this_arg_ptr = untag_ptr(this_arg);
6897         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6898         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6899         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6900         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6901         return ret_conv;
6902 }
6903
6904 typedef struct LDKMessageRouter_JCalls {
6905         atomic_size_t refcnt;
6906         uint32_t instance_ptr;
6907 } LDKMessageRouter_JCalls;
6908 static void LDKMessageRouter_JCalls_free(void* this_arg) {
6909         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6910         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6911                 FREE(j_calls);
6912         }
6913 }
6914 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
6915         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6916         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
6917         memcpy(sender_arr->elems, sender.compressed_form, 33);
6918         LDKCVec_PublicKeyZ peers_var = peers;
6919         ptrArray peers_arr = NULL;
6920         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6921         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6922         for (size_t m = 0; m < peers_var.datalen; m++) {
6923                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
6924                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
6925                 peers_arr_ptr[m] = peers_conv_12_arr;
6926         }
6927         
6928         FREE(peers_var.data);
6929         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
6930         *destination_copy = destination;
6931         uint64_t destination_ref = tag_ptr(destination_copy, true);
6932         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);
6933         void* ret_ptr = untag_ptr(ret);
6934         CHECK_ACCESS(ret_ptr);
6935         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
6936         FREE(untag_ptr(ret));
6937         return ret_conv;
6938 }
6939 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
6940         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
6941         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
6942         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
6943         LDKCVec_PublicKeyZ peers_var = peers;
6944         ptrArray peers_arr = NULL;
6945         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
6946         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
6947         for (size_t m = 0; m < peers_var.datalen; m++) {
6948                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
6949                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
6950                 peers_arr_ptr[m] = peers_conv_12_arr;
6951         }
6952         
6953         FREE(peers_var.data);
6954         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)recipient_arr, (uint32_t)peers_arr, 0, 0, 0, 0);
6955         void* ret_ptr = untag_ptr(ret);
6956         CHECK_ACCESS(ret_ptr);
6957         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
6958         FREE(untag_ptr(ret));
6959         return ret_conv;
6960 }
6961 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
6962         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
6963         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6964 }
6965 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
6966         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
6967         atomic_init(&calls->refcnt, 1);
6968         calls->instance_ptr = o;
6969
6970         LDKMessageRouter ret = {
6971                 .this_arg = (void*) calls,
6972                 .find_path = find_path_LDKMessageRouter_jcall,
6973                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
6974                 .free = LDKMessageRouter_JCalls_free,
6975         };
6976         return ret;
6977 }
6978 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
6979         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
6980         *res_ptr = LDKMessageRouter_init(o);
6981         return tag_ptr(res_ptr, true);
6982 }
6983 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) {
6984         void* this_arg_ptr = untag_ptr(this_arg);
6985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6986         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
6987         LDKPublicKey sender_ref;
6988         CHECK(sender->arr_len == 33);
6989         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
6990         LDKCVec_PublicKeyZ peers_constr;
6991         peers_constr.datalen = peers->arr_len;
6992         if (peers_constr.datalen > 0)
6993                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6994         else
6995                 peers_constr.data = NULL;
6996         int8_tArray* peers_vals = (void*) peers->elems;
6997         for (size_t m = 0; m < peers_constr.datalen; m++) {
6998                 int8_tArray peers_conv_12 = peers_vals[m];
6999                 LDKPublicKey peers_conv_12_ref;
7000                 CHECK(peers_conv_12->arr_len == 33);
7001                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
7002                 peers_constr.data[m] = peers_conv_12_ref;
7003         }
7004         FREE(peers);
7005         void* destination_ptr = untag_ptr(destination);
7006         CHECK_ACCESS(destination_ptr);
7007         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7008         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7009         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7010         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7011         return tag_ptr(ret_conv, true);
7012 }
7013
7014 uint64_t  __attribute__((export_name("TS_MessageRouter_create_blinded_paths"))) TS_MessageRouter_create_blinded_paths(uint64_t this_arg, int8_tArray recipient, ptrArray peers) {
7015         void* this_arg_ptr = untag_ptr(this_arg);
7016         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7017         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7018         LDKPublicKey recipient_ref;
7019         CHECK(recipient->arr_len == 33);
7020         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7021         LDKCVec_PublicKeyZ peers_constr;
7022         peers_constr.datalen = peers->arr_len;
7023         if (peers_constr.datalen > 0)
7024                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7025         else
7026                 peers_constr.data = NULL;
7027         int8_tArray* peers_vals = (void*) peers->elems;
7028         for (size_t m = 0; m < peers_constr.datalen; m++) {
7029                 int8_tArray peers_conv_12 = peers_vals[m];
7030                 LDKPublicKey peers_conv_12_ref;
7031                 CHECK(peers_conv_12->arr_len == 33);
7032                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
7033                 peers_constr.data[m] = peers_conv_12_ref;
7034         }
7035         FREE(peers);
7036         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7037         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7038         return tag_ptr(ret_conv, true);
7039 }
7040
7041 typedef struct LDKRouter_JCalls {
7042         atomic_size_t refcnt;
7043         uint32_t instance_ptr;
7044         LDKMessageRouter_JCalls* MessageRouter;
7045 } LDKRouter_JCalls;
7046 static void LDKRouter_JCalls_free(void* this_arg) {
7047         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7048         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7049                 FREE(j_calls);
7050         }
7051 }
7052 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7053         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7054         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7055         memcpy(payer_arr->elems, payer.compressed_form, 33);
7056         LDKRouteParameters route_params_var = *route_params;
7057         uint64_t route_params_ref = 0;
7058         route_params_var = RouteParameters_clone(&route_params_var);
7059         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7060         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7061         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7062         uint64_tArray first_hops_arr = NULL;
7063         if (first_hops != NULL) {
7064                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7065                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7066                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7067                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7068                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7069                         uint64_t first_hops_conv_16_ref = 0;
7070                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7071                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7072                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7073                 }
7074         
7075         }
7076         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7077         uint64_t inflight_htlcs_ref = 0;
7078         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7079         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7080         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);
7081         void* ret_ptr = untag_ptr(ret);
7082         CHECK_ACCESS(ret_ptr);
7083         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7084         FREE(untag_ptr(ret));
7085         return ret_conv;
7086 }
7087 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) {
7088         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7089         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7090         memcpy(payer_arr->elems, payer.compressed_form, 33);
7091         LDKRouteParameters route_params_var = *route_params;
7092         uint64_t route_params_ref = 0;
7093         route_params_var = RouteParameters_clone(&route_params_var);
7094         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7095         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7096         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7097         uint64_tArray first_hops_arr = NULL;
7098         if (first_hops != NULL) {
7099                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7100                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7101                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7102                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7103                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7104                         uint64_t first_hops_conv_16_ref = 0;
7105                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7106                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7107                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7108                 }
7109         
7110         }
7111         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7112         uint64_t inflight_htlcs_ref = 0;
7113         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7114         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7115         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7116         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7117         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7118         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7119         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);
7120         void* ret_ptr = untag_ptr(ret);
7121         CHECK_ACCESS(ret_ptr);
7122         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7123         FREE(untag_ptr(ret));
7124         return ret_conv;
7125 }
7126 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) {
7127         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7128         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7129         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7130         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7131         uint64_tArray first_hops_arr = NULL;
7132         first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7133         uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7134         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7135                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7136                 uint64_t first_hops_conv_16_ref = 0;
7137                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7138                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7139                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7140         }
7141         
7142         FREE(first_hops_var.data);
7143         LDKReceiveTlvs tlvs_var = tlvs;
7144         uint64_t tlvs_ref = 0;
7145         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7146         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7147         int64_t amount_msats_conv = amount_msats;
7148         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);
7149         void* ret_ptr = untag_ptr(ret);
7150         CHECK_ACCESS(ret_ptr);
7151         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7152         FREE(untag_ptr(ret));
7153         return ret_conv;
7154 }
7155 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7156         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7157         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7158         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7159 }
7160 static inline LDKRouter LDKRouter_init (JSValue o, JSValue MessageRouter) {
7161         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7162         atomic_init(&calls->refcnt, 1);
7163         calls->instance_ptr = o;
7164
7165         LDKRouter ret = {
7166                 .this_arg = (void*) calls,
7167                 .find_route = find_route_LDKRouter_jcall,
7168                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7169                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7170                 .free = LDKRouter_JCalls_free,
7171                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7172         };
7173         calls->MessageRouter = ret.MessageRouter.this_arg;
7174         return ret;
7175 }
7176 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o, JSValue MessageRouter) {
7177         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7178         *res_ptr = LDKRouter_init(o, MessageRouter);
7179         return tag_ptr(res_ptr, true);
7180 }
7181 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) {
7182         void* this_arg_ptr = untag_ptr(this_arg);
7183         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7184         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7185         LDKPublicKey payer_ref;
7186         CHECK(payer->arr_len == 33);
7187         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7188         LDKRouteParameters route_params_conv;
7189         route_params_conv.inner = untag_ptr(route_params);
7190         route_params_conv.is_owned = ptr_is_owned(route_params);
7191         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7192         route_params_conv.is_owned = false;
7193         LDKCVec_ChannelDetailsZ first_hops_constr;
7194         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7195         if (first_hops != 0) {
7196                 first_hops_constr.datalen = first_hops->arr_len;
7197                 if (first_hops_constr.datalen > 0)
7198                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7199                 else
7200                         first_hops_constr.data = NULL;
7201                 uint64_t* first_hops_vals = first_hops->elems;
7202                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7203                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7204                         LDKChannelDetails first_hops_conv_16_conv;
7205                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7206                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7207                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7208                         first_hops_conv_16_conv.is_owned = false;
7209                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7210                 }
7211                 FREE(first_hops);
7212                 first_hops_ptr = &first_hops_constr;
7213         }
7214         LDKInFlightHtlcs inflight_htlcs_conv;
7215         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7216         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7217         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7218         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7219         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7220         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7221         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7222         return tag_ptr(ret_conv, true);
7223 }
7224
7225 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) {
7226         void* this_arg_ptr = untag_ptr(this_arg);
7227         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7228         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7229         LDKPublicKey payer_ref;
7230         CHECK(payer->arr_len == 33);
7231         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7232         LDKRouteParameters route_params_conv;
7233         route_params_conv.inner = untag_ptr(route_params);
7234         route_params_conv.is_owned = ptr_is_owned(route_params);
7235         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7236         route_params_conv.is_owned = false;
7237         LDKCVec_ChannelDetailsZ first_hops_constr;
7238         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7239         if (first_hops != 0) {
7240                 first_hops_constr.datalen = first_hops->arr_len;
7241                 if (first_hops_constr.datalen > 0)
7242                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7243                 else
7244                         first_hops_constr.data = NULL;
7245                 uint64_t* first_hops_vals = first_hops->elems;
7246                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7247                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7248                         LDKChannelDetails first_hops_conv_16_conv;
7249                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7250                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7252                         first_hops_conv_16_conv.is_owned = false;
7253                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7254                 }
7255                 FREE(first_hops);
7256                 first_hops_ptr = &first_hops_constr;
7257         }
7258         LDKInFlightHtlcs inflight_htlcs_conv;
7259         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7260         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7261         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7262         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7263         LDKThirtyTwoBytes _payment_hash_ref;
7264         CHECK(_payment_hash->arr_len == 32);
7265         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7266         LDKThirtyTwoBytes _payment_id_ref;
7267         CHECK(_payment_id->arr_len == 32);
7268         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7269         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7270         *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);
7271         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7272         return tag_ptr(ret_conv, true);
7273 }
7274
7275 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) {
7276         void* this_arg_ptr = untag_ptr(this_arg);
7277         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7278         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7279         LDKPublicKey recipient_ref;
7280         CHECK(recipient->arr_len == 33);
7281         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7282         LDKCVec_ChannelDetailsZ first_hops_constr;
7283         first_hops_constr.datalen = first_hops->arr_len;
7284         if (first_hops_constr.datalen > 0)
7285                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7286         else
7287                 first_hops_constr.data = NULL;
7288         uint64_t* first_hops_vals = first_hops->elems;
7289         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7290                 uint64_t first_hops_conv_16 = first_hops_vals[q];
7291                 LDKChannelDetails first_hops_conv_16_conv;
7292                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7293                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7294                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7295                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
7296                 first_hops_constr.data[q] = first_hops_conv_16_conv;
7297         }
7298         FREE(first_hops);
7299         LDKReceiveTlvs tlvs_conv;
7300         tlvs_conv.inner = untag_ptr(tlvs);
7301         tlvs_conv.is_owned = ptr_is_owned(tlvs);
7302         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
7303         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
7304         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
7305         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
7306         return tag_ptr(ret_conv, true);
7307 }
7308
7309 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7310         return ThirtyTwoBytes_clone(&owner->a);
7311 }
7312 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(uint64_t owner) {
7313         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7314         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7315         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
7316         return ret_arr;
7317 }
7318
7319 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7320         LDKChannelManager ret = owner->b;
7321         ret.is_owned = false;
7322         return ret;
7323 }
7324 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(uint64_t owner) {
7325         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7326         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
7327         uint64_t ret_ref = 0;
7328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7330         return ret_ref;
7331 }
7332
7333 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7334 CHECK(owner->result_ok);
7335         return &*owner->contents.result;
7336 }
7337 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
7338         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7339         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7340         return ret_ret;
7341 }
7342
7343 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7344 CHECK(!owner->result_ok);
7345         return DecodeError_clone(&*owner->contents.err);
7346 }
7347 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
7348         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7349         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7350         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
7351         uint64_t ret_ref = tag_ptr(ret_copy, true);
7352         return ret_ref;
7353 }
7354
7355 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
7356         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7357         switch(obj->tag) {
7358                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7359                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7360                 default: abort();
7361         }
7362 }
7363 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
7364         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7365         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7366         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7367         return fixed_limit_msat_conv;
7368 }
7369 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
7370         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7371         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7372         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7373         return fee_rate_multiplier_conv;
7374 }
7375 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7376 CHECK(owner->result_ok);
7377         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7378 }
7379 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
7380         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7381         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7382         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7383         uint64_t ret_ref = tag_ptr(ret_copy, true);
7384         return ret_ref;
7385 }
7386
7387 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7388 CHECK(!owner->result_ok);
7389         return DecodeError_clone(&*owner->contents.err);
7390 }
7391 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
7392         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7393         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7394         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7395         uint64_t ret_ref = tag_ptr(ret_copy, true);
7396         return ret_ref;
7397 }
7398
7399 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7400         LDKChannelConfig ret = *owner->contents.result;
7401         ret.is_owned = false;
7402         return ret;
7403 }
7404 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
7405         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7406         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7407         uint64_t ret_ref = 0;
7408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7410         return ret_ref;
7411 }
7412
7413 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7414 CHECK(!owner->result_ok);
7415         return DecodeError_clone(&*owner->contents.err);
7416 }
7417 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
7418         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7419         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7420         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7421         uint64_t ret_ref = tag_ptr(ret_copy, true);
7422         return ret_ref;
7423 }
7424
7425 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
7426         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7427         switch(obj->tag) {
7428                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7429                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7430                 default: abort();
7431         }
7432 }
7433 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
7434         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7435         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7436         uint64_t some_ref = tag_ptr(&obj->some, false);
7437         return some_ref;
7438 }
7439 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
7440         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7441         switch(obj->tag) {
7442                 case LDKCOption_APIErrorZ_Some: return 0;
7443                 case LDKCOption_APIErrorZ_None: return 1;
7444                 default: abort();
7445         }
7446 }
7447 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
7448         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7449         assert(obj->tag == LDKCOption_APIErrorZ_Some);
7450         uint64_t some_ref = tag_ptr(&obj->some, false);
7451         return some_ref;
7452 }
7453 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7454 CHECK(owner->result_ok);
7455         return COption_APIErrorZ_clone(&*owner->contents.result);
7456 }
7457 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
7458         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7459         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7460         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7461         uint64_t ret_ref = tag_ptr(ret_copy, true);
7462         return ret_ref;
7463 }
7464
7465 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7466 CHECK(!owner->result_ok);
7467         return DecodeError_clone(&*owner->contents.err);
7468 }
7469 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
7470         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7471         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7472         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7473         uint64_t ret_ref = tag_ptr(ret_copy, true);
7474         return ret_ref;
7475 }
7476
7477 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7478         LDKChannelMonitorUpdate ret = *owner->contents.result;
7479         ret.is_owned = false;
7480         return ret;
7481 }
7482 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7483         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7484         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7485         uint64_t ret_ref = 0;
7486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7488         return ret_ref;
7489 }
7490
7491 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7492 CHECK(!owner->result_ok);
7493         return DecodeError_clone(&*owner->contents.err);
7494 }
7495 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7496         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7498         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7499         uint64_t ret_ref = tag_ptr(ret_copy, true);
7500         return ret_ref;
7501 }
7502
7503 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7504         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7505         switch(obj->tag) {
7506                 case LDKCOption_MonitorEventZ_Some: return 0;
7507                 case LDKCOption_MonitorEventZ_None: return 1;
7508                 default: abort();
7509         }
7510 }
7511 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7512         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7513         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7514         uint64_t some_ref = tag_ptr(&obj->some, false);
7515         return some_ref;
7516 }
7517 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7518 CHECK(owner->result_ok);
7519         return COption_MonitorEventZ_clone(&*owner->contents.result);
7520 }
7521 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7522         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7523         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7524         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7525         uint64_t ret_ref = tag_ptr(ret_copy, true);
7526         return ret_ref;
7527 }
7528
7529 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7530 CHECK(!owner->result_ok);
7531         return DecodeError_clone(&*owner->contents.err);
7532 }
7533 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7534         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7535         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7536         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7537         uint64_t ret_ref = tag_ptr(ret_copy, true);
7538         return ret_ref;
7539 }
7540
7541 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7542         LDKHTLCUpdate ret = *owner->contents.result;
7543         ret.is_owned = false;
7544         return ret;
7545 }
7546 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7547         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7548         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7549         uint64_t ret_ref = 0;
7550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7552         return ret_ref;
7553 }
7554
7555 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7556 CHECK(!owner->result_ok);
7557         return DecodeError_clone(&*owner->contents.err);
7558 }
7559 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7560         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7561         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7562         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7563         uint64_t ret_ref = tag_ptr(ret_copy, true);
7564         return ret_ref;
7565 }
7566
7567 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7568         LDKOutPoint ret = owner->a;
7569         ret.is_owned = false;
7570         return ret;
7571 }
7572 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_a"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_a(uint64_t owner) {
7573         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7574         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7575         uint64_t ret_ref = 0;
7576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7578         return ret_ref;
7579 }
7580
7581 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7582         return CVec_u8Z_clone(&owner->b);
7583 }
7584 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_get_b"))) TS_C2Tuple_OutPointCVec_u8ZZ_get_b(uint64_t owner) {
7585         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7586         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7587         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7588         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7589         CVec_u8Z_free(ret_var);
7590         return ret_arr;
7591 }
7592
7593 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7594         return owner->a;
7595 }
7596 int32_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_a"))) TS_C2Tuple_u32CVec_u8ZZ_get_a(uint64_t owner) {
7597         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7598         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7599         return ret_conv;
7600 }
7601
7602 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7603         return CVec_u8Z_clone(&owner->b);
7604 }
7605 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_get_b"))) TS_C2Tuple_u32CVec_u8ZZ_get_b(uint64_t owner) {
7606         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7607         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7610         CVec_u8Z_free(ret_var);
7611         return ret_arr;
7612 }
7613
7614 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7615         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7616         for (size_t i = 0; i < ret.datalen; i++) {
7617                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7618         }
7619         return ret;
7620 }
7621 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7622         return ThirtyTwoBytes_clone(&owner->a);
7623 }
7624 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(uint64_t owner) {
7625         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7626         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7627         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7628         return ret_arr;
7629 }
7630
7631 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7632         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7633 }
7634 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(uint64_t owner) {
7635         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7636         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7637         uint64_tArray ret_arr = NULL;
7638         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7639         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7640         for (size_t x = 0; x < ret_var.datalen; x++) {
7641                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7642                 *ret_conv_23_conv = ret_var.data[x];
7643                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7644         }
7645         
7646         FREE(ret_var.data);
7647         return ret_arr;
7648 }
7649
7650 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7651         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 };
7652         for (size_t i = 0; i < ret.datalen; i++) {
7653                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7654         }
7655         return ret;
7656 }
7657 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7658         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7659         for (size_t i = 0; i < ret.datalen; i++) {
7660                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7661         }
7662         return ret;
7663 }
7664 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7665         return owner->a;
7666 }
7667 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
7668         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7669         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7670         return ret_conv;
7671 }
7672
7673 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7674         return TxOut_clone(&owner->b);
7675 }
7676 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
7677         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7678         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7679         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7680         return tag_ptr(ret_ref, true);
7681 }
7682
7683 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7684         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7685         for (size_t i = 0; i < ret.datalen; i++) {
7686                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7687         }
7688         return ret;
7689 }
7690 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7691         return ThirtyTwoBytes_clone(&owner->a);
7692 }
7693 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
7694         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7695         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7696         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7697         return ret_arr;
7698 }
7699
7700 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7701         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7702 }
7703 uint64_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
7704         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7705         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7706         uint64_tArray ret_arr = NULL;
7707         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7708         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7709         for (size_t u = 0; u < ret_var.datalen; u++) {
7710                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7711                 *ret_conv_20_conv = ret_var.data[u];
7712                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7713         }
7714         
7715         FREE(ret_var.data);
7716         return ret_arr;
7717 }
7718
7719 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7720         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 };
7721         for (size_t i = 0; i < ret.datalen; i++) {
7722                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7723         }
7724         return ret;
7725 }
7726 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
7727         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7728         switch(obj->tag) {
7729                 case LDKBalance_ClaimableOnChannelClose: return 0;
7730                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7731                 case LDKBalance_ContentiousClaimable: return 2;
7732                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7733                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7734                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7735                 default: abort();
7736         }
7737 }
7738 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
7739         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7740         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
7741         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7742         return amount_satoshis_conv;
7743 }
7744 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
7745         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7746         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7747         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7748         return amount_satoshis_conv;
7749 }
7750 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
7751         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7752         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7753         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7754         return confirmation_height_conv;
7755 }
7756 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
7757         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7758         assert(obj->tag == LDKBalance_ContentiousClaimable);
7759         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7760         return amount_satoshis_conv;
7761 }
7762 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
7763         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7764         assert(obj->tag == LDKBalance_ContentiousClaimable);
7765         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7766         return timeout_height_conv;
7767 }
7768 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
7769         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7770         assert(obj->tag == LDKBalance_ContentiousClaimable);
7771         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7772         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7773         return payment_hash_arr;
7774 }
7775 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
7776         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7777         assert(obj->tag == LDKBalance_ContentiousClaimable);
7778         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7779         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7780         return payment_preimage_arr;
7781 }
7782 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7783         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7784         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7785         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7786         return amount_satoshis_conv;
7787 }
7788 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
7789         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7790         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7791         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7792         return claimable_height_conv;
7793 }
7794 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
7795         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7796         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7797         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7798         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7799         return payment_hash_arr;
7800 }
7801 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
7802         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7803         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7804         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7805         return amount_satoshis_conv;
7806 }
7807 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
7808         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7809         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7810         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7811         return expiry_height_conv;
7812 }
7813 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
7814         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7815         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7816         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7817         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7818         return payment_hash_arr;
7819 }
7820 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
7821         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7822         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7823         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7824         return amount_satoshis_conv;
7825 }
7826 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7827         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7828         for (size_t i = 0; i < ret.datalen; i++) {
7829                 ret.data[i] = Balance_clone(&orig->data[i]);
7830         }
7831         return ret;
7832 }
7833 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7834         return ThirtyTwoBytes_clone(&owner->a);
7835 }
7836 int8_tArray  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(uint64_t owner) {
7837         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7839         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
7840         return ret_arr;
7841 }
7842
7843 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7844         LDKChannelMonitor ret = owner->b;
7845         ret.is_owned = false;
7846         return ret;
7847 }
7848 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(uint64_t owner) {
7849         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
7850         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
7851         uint64_t ret_ref = 0;
7852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7854         return ret_ref;
7855 }
7856
7857 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7858 CHECK(owner->result_ok);
7859         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
7860 }
7861 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
7862         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7863         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
7864         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7865         return tag_ptr(ret_conv, true);
7866 }
7867
7868 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7869 CHECK(!owner->result_ok);
7870         return DecodeError_clone(&*owner->contents.err);
7871 }
7872 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
7873         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7874         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7875         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7876         uint64_t ret_ref = tag_ptr(ret_copy, true);
7877         return ret_ref;
7878 }
7879
7880 typedef struct LDKType_JCalls {
7881         atomic_size_t refcnt;
7882         uint32_t instance_ptr;
7883 } LDKType_JCalls;
7884 static void LDKType_JCalls_free(void* this_arg) {
7885         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7886         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7887                 FREE(j_calls);
7888         }
7889 }
7890 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7891         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7892         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, 0, 0, 0, 0, 0, 0);
7893 }
7894 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7895         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7896         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0);
7897         LDKStr ret_conv = str_ref_to_owned_c(ret);
7898         return ret_conv;
7899 }
7900 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7901         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7902         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, 0, 0, 0, 0, 0, 0);
7903         LDKCVec_u8Z ret_ref;
7904         ret_ref.datalen = ret->arr_len;
7905         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7906         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7907         return ret_ref;
7908 }
7909 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7910         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7911         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7912 }
7913 static inline LDKType LDKType_init (JSValue o) {
7914         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7915         atomic_init(&calls->refcnt, 1);
7916         calls->instance_ptr = o;
7917
7918         LDKType ret = {
7919                 .this_arg = (void*) calls,
7920                 .type_id = type_id_LDKType_jcall,
7921                 .debug_str = debug_str_LDKType_jcall,
7922                 .write = write_LDKType_jcall,
7923                 .cloned = LDKType_JCalls_cloned,
7924                 .free = LDKType_JCalls_free,
7925         };
7926         return ret;
7927 }
7928 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
7929         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7930         *res_ptr = LDKType_init(o);
7931         return tag_ptr(res_ptr, true);
7932 }
7933 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
7934         void* this_arg_ptr = untag_ptr(this_arg);
7935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7936         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7937         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7938         return ret_conv;
7939 }
7940
7941 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
7942         void* this_arg_ptr = untag_ptr(this_arg);
7943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7944         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7945         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7946         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7947         Str_free(ret_str);
7948         return ret_conv;
7949 }
7950
7951 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
7952         void* this_arg_ptr = untag_ptr(this_arg);
7953         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7954         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7955         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7956         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7957         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7958         CVec_u8Z_free(ret_var);
7959         return ret_arr;
7960 }
7961
7962 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7963         return owner->a;
7964 }
7965 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
7966         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7967         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7968         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
7969         return ret_arr;
7970 }
7971
7972 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7973         return Type_clone(&owner->b);
7974 }
7975 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
7976         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7977         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7978         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7979         return tag_ptr(ret_ret, true);
7980 }
7981
7982 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7983         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7984         for (size_t i = 0; i < ret.datalen; i++) {
7985                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7986         }
7987         return ret;
7988 }
7989 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
7990         return owner->a;
7991 }
7992 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(uint64_t owner) {
7993         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
7994         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
7995         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
7996         return ret_arr;
7997 }
7998
7999 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8000         return CVec_SocketAddressZ_clone(&owner->b);
8001 }
8002 uint64_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(uint64_t owner) {
8003         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8004         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8005         uint64_tArray ret_arr = NULL;
8006         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8007         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8008         for (size_t p = 0; p < ret_var.datalen; p++) {
8009                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8010                 *ret_conv_15_copy = ret_var.data[p];
8011                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8012                 ret_arr_ptr[p] = ret_conv_15_ref;
8013         }
8014         
8015         FREE(ret_var.data);
8016         return ret_arr;
8017 }
8018
8019 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8020         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8021         for (size_t i = 0; i < ret.datalen; i++) {
8022                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8023         }
8024         return ret;
8025 }
8026 typedef struct LDKOnionMessageContents_JCalls {
8027         atomic_size_t refcnt;
8028         uint32_t instance_ptr;
8029 } LDKOnionMessageContents_JCalls;
8030 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8031         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8032         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8033                 FREE(j_calls);
8034         }
8035 }
8036 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8037         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8038         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
8039 }
8040 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8041         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8042         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
8043         LDKCVec_u8Z ret_ref;
8044         ret_ref.datalen = ret->arr_len;
8045         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8046         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8047         return ret_ref;
8048 }
8049 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8050         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8051         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
8052         LDKStr ret_conv = str_ref_to_owned_c(ret);
8053         return ret_conv;
8054 }
8055 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8056         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8057         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8058 }
8059 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JSValue o) {
8060         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8061         atomic_init(&calls->refcnt, 1);
8062         calls->instance_ptr = o;
8063
8064         LDKOnionMessageContents ret = {
8065                 .this_arg = (void*) calls,
8066                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8067                 .write = write_LDKOnionMessageContents_jcall,
8068                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8069                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8070                 .free = LDKOnionMessageContents_JCalls_free,
8071         };
8072         return ret;
8073 }
8074 uint64_t  __attribute__((export_name("TS_LDKOnionMessageContents_new"))) TS_LDKOnionMessageContents_new(JSValue o) {
8075         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8076         *res_ptr = LDKOnionMessageContents_init(o);
8077         return tag_ptr(res_ptr, true);
8078 }
8079 int64_t  __attribute__((export_name("TS_OnionMessageContents_tlv_type"))) TS_OnionMessageContents_tlv_type(uint64_t this_arg) {
8080         void* this_arg_ptr = untag_ptr(this_arg);
8081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8082         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8083         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8084         return ret_conv;
8085 }
8086
8087 int8_tArray  __attribute__((export_name("TS_OnionMessageContents_write"))) TS_OnionMessageContents_write(uint64_t this_arg) {
8088         void* this_arg_ptr = untag_ptr(this_arg);
8089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8090         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8091         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8092         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8093         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8094         CVec_u8Z_free(ret_var);
8095         return ret_arr;
8096 }
8097
8098 jstring  __attribute__((export_name("TS_OnionMessageContents_debug_str"))) TS_OnionMessageContents_debug_str(uint64_t this_arg) {
8099         void* this_arg_ptr = untag_ptr(this_arg);
8100         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8101         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8102         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8103         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8104         Str_free(ret_str);
8105         return ret_conv;
8106 }
8107
8108 uint32_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_OnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
8109         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8110         switch(obj->tag) {
8111                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8112                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8113                 default: abort();
8114         }
8115 }
8116 uint64_t __attribute__((export_name("TS_LDKCOption_OnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_OnionMessageContentsZ_Some_get_some(uint64_t ptr) {
8117         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8118         assert(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8119         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8120         *some_ret = OnionMessageContents_clone(&obj->some);
8121         return tag_ptr(some_ret, true);
8122 }
8123 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8124 CHECK(owner->result_ok);
8125         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8126 }
8127 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
8128         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8129         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8130         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8131         uint64_t ret_ref = tag_ptr(ret_copy, true);
8132         return ret_ref;
8133 }
8134
8135 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8136 CHECK(!owner->result_ok);
8137         return DecodeError_clone(&*owner->contents.err);
8138 }
8139 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
8140         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8142         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8143         uint64_t ret_ref = tag_ptr(ret_copy, true);
8144         return ret_ref;
8145 }
8146
8147 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8148         return OnionMessageContents_clone(&owner->a);
8149 }
8150 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(uint64_t owner) {
8151         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8152         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8153         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8154         return tag_ptr(ret_ret, true);
8155 }
8156
8157 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8158         return Destination_clone(&owner->b);
8159 }
8160 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(uint64_t owner) {
8161         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8162         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8163         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8164         uint64_t ret_ref = tag_ptr(ret_copy, true);
8165         return ret_ref;
8166 }
8167
8168 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8169         LDKBlindedPath ret = owner->c;
8170         ret.is_owned = false;
8171         return ret;
8172 }
8173 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(uint64_t owner) {
8174         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8175         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8176         uint64_t ret_ref = 0;
8177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8179         return ret_ref;
8180 }
8181
8182 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8183         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8184         for (size_t i = 0; i < ret.datalen; i++) {
8185                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8186         }
8187         return ret;
8188 }
8189 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
8190         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8191         switch(obj->tag) {
8192                 case LDKCOption_TypeZ_Some: return 0;
8193                 case LDKCOption_TypeZ_None: return 1;
8194                 default: abort();
8195         }
8196 }
8197 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
8198         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8199         assert(obj->tag == LDKCOption_TypeZ_Some);
8200         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8201         *some_ret = Type_clone(&obj->some);
8202         return tag_ptr(some_ret, true);
8203 }
8204 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8205 CHECK(owner->result_ok);
8206         return COption_TypeZ_clone(&*owner->contents.result);
8207 }
8208 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
8209         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8210         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8211         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8212         uint64_t ret_ref = tag_ptr(ret_copy, true);
8213         return ret_ref;
8214 }
8215
8216 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8217 CHECK(!owner->result_ok);
8218         return DecodeError_clone(&*owner->contents.err);
8219 }
8220 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
8221         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8222         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8223         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8224         uint64_t ret_ref = tag_ptr(ret_copy, true);
8225         return ret_ref;
8226 }
8227
8228 uint32_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_ty_from_ptr"))) TS_LDKCOption_SocketAddressZ_ty_from_ptr(uint64_t ptr) {
8229         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8230         switch(obj->tag) {
8231                 case LDKCOption_SocketAddressZ_Some: return 0;
8232                 case LDKCOption_SocketAddressZ_None: return 1;
8233                 default: abort();
8234         }
8235 }
8236 uint64_t __attribute__((export_name("TS_LDKCOption_SocketAddressZ_Some_get_some"))) TS_LDKCOption_SocketAddressZ_Some_get_some(uint64_t ptr) {
8237         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8238         assert(obj->tag == LDKCOption_SocketAddressZ_Some);
8239         uint64_t some_ref = tag_ptr(&obj->some, false);
8240         return some_ref;
8241 }
8242 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8243 CHECK(owner->result_ok);
8244         return CVec_u8Z_clone(&*owner->contents.result);
8245 }
8246 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
8247         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8248         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8249         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8250         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8251         CVec_u8Z_free(ret_var);
8252         return ret_arr;
8253 }
8254
8255 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8256         LDKPeerHandleError ret = *owner->contents.err;
8257         ret.is_owned = false;
8258         return ret;
8259 }
8260 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
8261         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8262         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8263         uint64_t ret_ref = 0;
8264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8266         return ret_ref;
8267 }
8268
8269 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8270 CHECK(owner->result_ok);
8271         return *owner->contents.result;
8272 }
8273 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
8274         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8275         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8276 }
8277
8278 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8279         LDKPeerHandleError ret = *owner->contents.err;
8280         ret.is_owned = false;
8281         return ret;
8282 }
8283 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
8284         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8285         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8286         uint64_t ret_ref = 0;
8287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8289         return ret_ref;
8290 }
8291
8292 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8293 CHECK(owner->result_ok);
8294         return *owner->contents.result;
8295 }
8296 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
8297         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8298         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8299         return ret_conv;
8300 }
8301
8302 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8303         LDKPeerHandleError ret = *owner->contents.err;
8304         ret.is_owned = false;
8305         return ret;
8306 }
8307 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
8308         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8309         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8310         uint64_t ret_ref = 0;
8311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8313         return ret_ref;
8314 }
8315
8316 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
8317         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8318         switch(obj->tag) {
8319                 case LDKGraphSyncError_DecodeError: return 0;
8320                 case LDKGraphSyncError_LightningError: return 1;
8321                 default: abort();
8322         }
8323 }
8324 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
8325         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8326         assert(obj->tag == LDKGraphSyncError_DecodeError);
8327         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8328         return decode_error_ref;
8329 }
8330 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
8331         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8332         assert(obj->tag == LDKGraphSyncError_LightningError);
8333         LDKLightningError lightning_error_var = obj->lightning_error;
8334                         uint64_t lightning_error_ref = 0;
8335                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8336                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8337         return lightning_error_ref;
8338 }
8339 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8340 CHECK(owner->result_ok);
8341         return *owner->contents.result;
8342 }
8343 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
8344         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8345         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8346         return ret_conv;
8347 }
8348
8349 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8350 CHECK(!owner->result_ok);
8351         return GraphSyncError_clone(&*owner->contents.err);
8352 }
8353 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
8354         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8355         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8356         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8357         uint64_t ret_ref = tag_ptr(ret_copy, true);
8358         return ret_ref;
8359 }
8360
8361 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8362 CHECK(owner->result_ok);
8363         return CVec_u8Z_clone(&*owner->contents.result);
8364 }
8365 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_ok"))) TS_CResult_CVec_u8ZIOErrorZ_get_ok(uint64_t owner) {
8366         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8367         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
8368         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8369         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8370         CVec_u8Z_free(ret_var);
8371         return ret_arr;
8372 }
8373
8374 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8375 CHECK(!owner->result_ok);
8376         return *owner->contents.err;
8377 }
8378 uint32_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_get_err"))) TS_CResult_CVec_u8ZIOErrorZ_get_err(uint64_t owner) {
8379         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8380         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
8381         return ret_conv;
8382 }
8383
8384 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
8385 CHECK(owner->result_ok);
8386         return *owner->contents.result;
8387 }
8388 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_ok"))) TS_CResult_NoneIOErrorZ_get_ok(uint64_t owner) {
8389         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
8390         CResult_NoneIOErrorZ_get_ok(owner_conv);
8391 }
8392
8393 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
8394 CHECK(!owner->result_ok);
8395         return *owner->contents.err;
8396 }
8397 uint32_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_get_err"))) TS_CResult_NoneIOErrorZ_get_err(uint64_t owner) {
8398         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
8399         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneIOErrorZ_get_err(owner_conv));
8400         return ret_conv;
8401 }
8402
8403 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8404 CHECK(owner->result_ok);
8405         return *owner->contents.result;
8406 }
8407 ptrArray  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_ok"))) TS_CResult_CVec_StrZIOErrorZ_get_ok(uint64_t owner) {
8408         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8409         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
8410         ptrArray ret_arr = NULL;
8411         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8412         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
8413         for (size_t i = 0; i < ret_var.datalen; i++) {
8414                 LDKStr ret_conv_8_str = ret_var.data[i];
8415                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
8416                 ret_arr_ptr[i] = ret_conv_8_conv;
8417         }
8418         
8419         return ret_arr;
8420 }
8421
8422 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8423 CHECK(!owner->result_ok);
8424         return *owner->contents.err;
8425 }
8426 uint32_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_get_err"))) TS_CResult_CVec_StrZIOErrorZ_get_err(uint64_t owner) {
8427         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8428         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
8429         return ret_conv;
8430 }
8431
8432 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
8433         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
8434         for (size_t i = 0; i < ret.datalen; i++) {
8435                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
8436         }
8437         return ret;
8438 }
8439 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8440 CHECK(owner->result_ok);
8441         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
8442 }
8443 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(uint64_t owner) {
8444         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8445         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
8446         uint64_tArray ret_arr = NULL;
8447         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8448         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8449         for (size_t o = 0; o < ret_var.datalen; o++) {
8450                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8451                 *ret_conv_40_conv = ret_var.data[o];
8452                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8453         }
8454         
8455         FREE(ret_var.data);
8456         return ret_arr;
8457 }
8458
8459 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8460 CHECK(!owner->result_ok);
8461         return *owner->contents.err;
8462 }
8463 uint32_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(uint64_t owner) {
8464         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8465         uint32_t ret_conv = LDKIOError_to_js(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8466         return ret_conv;
8467 }
8468
8469 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8470 CHECK(owner->result_ok);
8471         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8472 }
8473 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(uint64_t owner) {
8474         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8475         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8476         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8477         return tag_ptr(ret_conv, true);
8478 }
8479
8480 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8481 CHECK(!owner->result_ok);
8482         return *owner->contents.err;
8483 }
8484 uint32_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(uint64_t owner) {
8485         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8486         uint32_t ret_conv = LDKIOError_to_js(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8487         return ret_conv;
8488 }
8489
8490 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8491         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
8492         ret.is_owned = false;
8493         return ret;
8494 }
8495 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8496         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8497         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_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 enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8505 CHECK(!owner->result_ok);
8506         return Bolt12SemanticError_clone(&*owner->contents.err);
8507 }
8508 uint32_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(uint64_t owner) {
8509         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8510         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
8511         return ret_conv;
8512 }
8513
8514 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8515         LDKInvoiceRequest ret = *owner->contents.result;
8516         ret.is_owned = false;
8517         return ret;
8518 }
8519 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8520         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8521         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
8522         uint64_t ret_ref = 0;
8523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8525         return ret_ref;
8526 }
8527
8528 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
8529 CHECK(!owner->result_ok);
8530         return Bolt12SemanticError_clone(&*owner->contents.err);
8531 }
8532 uint32_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(uint64_t owner) {
8533         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
8534         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
8535         return ret_conv;
8536 }
8537
8538 uint32_t __attribute__((export_name("TS_LDKCOption_SecretKeyZ_ty_from_ptr"))) TS_LDKCOption_SecretKeyZ_ty_from_ptr(uint64_t ptr) {
8539         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8540         switch(obj->tag) {
8541                 case LDKCOption_SecretKeyZ_Some: return 0;
8542                 case LDKCOption_SecretKeyZ_None: return 1;
8543                 default: abort();
8544         }
8545 }
8546 int8_tArray __attribute__((export_name("TS_LDKCOption_SecretKeyZ_Some_get_some"))) TS_LDKCOption_SecretKeyZ_Some_get_some(uint64_t ptr) {
8547         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8548         assert(obj->tag == LDKCOption_SecretKeyZ_Some);
8549         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8550         memcpy(some_arr->elems, obj->some.bytes, 32);
8551         return some_arr;
8552 }
8553 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8554         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
8555         ret.is_owned = false;
8556         return ret;
8557 }
8558 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8559         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8560         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8561         uint64_t ret_ref = 0;
8562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8564         return ret_ref;
8565 }
8566
8567 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8568 CHECK(!owner->result_ok);
8569         return Bolt12SemanticError_clone(&*owner->contents.err);
8570 }
8571 uint32_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
8572         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8573         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8574         return ret_conv;
8575 }
8576
8577 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8578         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8579         ret.is_owned = false;
8580         return ret;
8581 }
8582 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_ok(uint64_t owner) {
8583         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8584         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8585         uint64_t ret_ref = 0;
8586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8588         return ret_ref;
8589 }
8590
8591 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8592 CHECK(!owner->result_ok);
8593         return *owner->contents.err;
8594 }
8595 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_get_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_get_err(uint64_t owner) {
8596         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8597         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8598 }
8599
8600 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8601         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
8602         ret.is_owned = false;
8603         return ret;
8604 }
8605 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(uint64_t owner) {
8606         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8607         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8608         uint64_t ret_ref = 0;
8609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8611         return ret_ref;
8612 }
8613
8614 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8615 CHECK(!owner->result_ok);
8616         return Bolt12SemanticError_clone(&*owner->contents.err);
8617 }
8618 uint32_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(uint64_t owner) {
8619         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8620         uint32_t ret_conv = LDKBolt12SemanticError_to_js(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8621         return ret_conv;
8622 }
8623
8624 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
8625         LDKInvoiceRequestFields ret = *owner->contents.result;
8626         ret.is_owned = false;
8627         return ret;
8628 }
8629 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(uint64_t owner) {
8630         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
8631         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
8632         uint64_t ret_ref = 0;
8633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8635         return ret_ref;
8636 }
8637
8638 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
8639 CHECK(!owner->result_ok);
8640         return DecodeError_clone(&*owner->contents.err);
8641 }
8642 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(uint64_t owner) {
8643         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
8644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8645         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
8646         uint64_t ret_ref = tag_ptr(ret_copy, true);
8647         return ret_ref;
8648 }
8649
8650 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8651         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8652         for (size_t i = 0; i < ret.datalen; i++) {
8653                 ret.data[i] = Witness_clone(&orig->data[i]);
8654         }
8655         return ret;
8656 }
8657 uint32_t __attribute__((export_name("TS_LDKCOption_ECDSASignatureZ_ty_from_ptr"))) TS_LDKCOption_ECDSASignatureZ_ty_from_ptr(uint64_t ptr) {
8658         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
8659         switch(obj->tag) {
8660                 case LDKCOption_ECDSASignatureZ_Some: return 0;
8661                 case LDKCOption_ECDSASignatureZ_None: return 1;
8662                 default: abort();
8663         }
8664 }
8665 int8_tArray __attribute__((export_name("TS_LDKCOption_ECDSASignatureZ_Some_get_some"))) TS_LDKCOption_ECDSASignatureZ_Some_get_some(uint64_t ptr) {
8666         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
8667         assert(obj->tag == LDKCOption_ECDSASignatureZ_Some);
8668         int8_tArray some_arr = init_int8_tArray(64, __LINE__);
8669         memcpy(some_arr->elems, obj->some.compact_form, 64);
8670         return some_arr;
8671 }
8672 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8673         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8674         switch(obj->tag) {
8675                 case LDKCOption_i64Z_Some: return 0;
8676                 case LDKCOption_i64Z_None: return 1;
8677                 default: abort();
8678         }
8679 }
8680 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8681         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8682         assert(obj->tag == LDKCOption_i64Z_Some);
8683         int64_t some_conv = obj->some;
8684         return some_conv;
8685 }
8686 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8687 CHECK(owner->result_ok);
8688         return SocketAddress_clone(&*owner->contents.result);
8689 }
8690 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_ok"))) TS_CResult_SocketAddressDecodeErrorZ_get_ok(uint64_t owner) {
8691         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8692         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8693         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8694         uint64_t ret_ref = tag_ptr(ret_copy, true);
8695         return ret_ref;
8696 }
8697
8698 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8699 CHECK(!owner->result_ok);
8700         return DecodeError_clone(&*owner->contents.err);
8701 }
8702 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_get_err"))) TS_CResult_SocketAddressDecodeErrorZ_get_err(uint64_t owner) {
8703         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8705         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8706         uint64_t ret_ref = tag_ptr(ret_copy, true);
8707         return ret_ref;
8708 }
8709
8710 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8711 CHECK(owner->result_ok);
8712         return SocketAddress_clone(&*owner->contents.result);
8713 }
8714 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(uint64_t owner) {
8715         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8716         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8717         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8718         uint64_t ret_ref = tag_ptr(ret_copy, true);
8719         return ret_ref;
8720 }
8721
8722 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8723 CHECK(!owner->result_ok);
8724         return SocketAddressParseError_clone(&*owner->contents.err);
8725 }
8726 uint32_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_get_err(uint64_t owner) {
8727         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8728         uint32_t ret_conv = LDKSocketAddressParseError_to_js(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8729         return ret_conv;
8730 }
8731
8732 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8733         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8734         for (size_t i = 0; i < ret.datalen; i++) {
8735                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8736         }
8737         return ret;
8738 }
8739 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8740         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8741         for (size_t i = 0; i < ret.datalen; i++) {
8742                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8743         }
8744         return ret;
8745 }
8746 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8747         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8748         for (size_t i = 0; i < ret.datalen; i++) {
8749                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8750         }
8751         return ret;
8752 }
8753 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8754         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8755         for (size_t i = 0; i < ret.datalen; i++) {
8756                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8757         }
8758         return ret;
8759 }
8760 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8761         LDKAcceptChannel ret = *owner->contents.result;
8762         ret.is_owned = false;
8763         return ret;
8764 }
8765 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8766         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8767         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8768         uint64_t ret_ref = 0;
8769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8771         return ret_ref;
8772 }
8773
8774 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8775 CHECK(!owner->result_ok);
8776         return DecodeError_clone(&*owner->contents.err);
8777 }
8778 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8779         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8780         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8781         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8782         uint64_t ret_ref = tag_ptr(ret_copy, true);
8783         return ret_ref;
8784 }
8785
8786 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8787         LDKAcceptChannelV2 ret = *owner->contents.result;
8788         ret.is_owned = false;
8789         return ret;
8790 }
8791 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8792         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8793         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8794         uint64_t ret_ref = 0;
8795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8797         return ret_ref;
8798 }
8799
8800 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8801 CHECK(!owner->result_ok);
8802         return DecodeError_clone(&*owner->contents.err);
8803 }
8804 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8805         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8806         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8807         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8808         uint64_t ret_ref = tag_ptr(ret_copy, true);
8809         return ret_ref;
8810 }
8811
8812 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8813         LDKStfu ret = *owner->contents.result;
8814         ret.is_owned = false;
8815         return ret;
8816 }
8817 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_ok"))) TS_CResult_StfuDecodeErrorZ_get_ok(uint64_t owner) {
8818         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8819         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8820         uint64_t ret_ref = 0;
8821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8823         return ret_ref;
8824 }
8825
8826 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8827 CHECK(!owner->result_ok);
8828         return DecodeError_clone(&*owner->contents.err);
8829 }
8830 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_get_err"))) TS_CResult_StfuDecodeErrorZ_get_err(uint64_t owner) {
8831         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8832         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8833         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8834         uint64_t ret_ref = tag_ptr(ret_copy, true);
8835         return ret_ref;
8836 }
8837
8838 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8839         LDKSplice ret = *owner->contents.result;
8840         ret.is_owned = false;
8841         return ret;
8842 }
8843 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_ok"))) TS_CResult_SpliceDecodeErrorZ_get_ok(uint64_t owner) {
8844         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8845         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8846         uint64_t ret_ref = 0;
8847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8849         return ret_ref;
8850 }
8851
8852 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8853 CHECK(!owner->result_ok);
8854         return DecodeError_clone(&*owner->contents.err);
8855 }
8856 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_get_err"))) TS_CResult_SpliceDecodeErrorZ_get_err(uint64_t owner) {
8857         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8858         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8859         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8860         uint64_t ret_ref = tag_ptr(ret_copy, true);
8861         return ret_ref;
8862 }
8863
8864 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8865         LDKSpliceAck ret = *owner->contents.result;
8866         ret.is_owned = false;
8867         return ret;
8868 }
8869 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_ok"))) TS_CResult_SpliceAckDecodeErrorZ_get_ok(uint64_t owner) {
8870         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8871         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8872         uint64_t ret_ref = 0;
8873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8875         return ret_ref;
8876 }
8877
8878 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8879 CHECK(!owner->result_ok);
8880         return DecodeError_clone(&*owner->contents.err);
8881 }
8882 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_get_err"))) TS_CResult_SpliceAckDecodeErrorZ_get_err(uint64_t owner) {
8883         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8885         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8886         uint64_t ret_ref = tag_ptr(ret_copy, true);
8887         return ret_ref;
8888 }
8889
8890 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8891         LDKSpliceLocked ret = *owner->contents.result;
8892         ret.is_owned = false;
8893         return ret;
8894 }
8895 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_get_ok(uint64_t owner) {
8896         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8897         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8898         uint64_t ret_ref = 0;
8899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8901         return ret_ref;
8902 }
8903
8904 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8905 CHECK(!owner->result_ok);
8906         return DecodeError_clone(&*owner->contents.err);
8907 }
8908 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_get_err"))) TS_CResult_SpliceLockedDecodeErrorZ_get_err(uint64_t owner) {
8909         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8910         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8911         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8912         uint64_t ret_ref = tag_ptr(ret_copy, true);
8913         return ret_ref;
8914 }
8915
8916 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8917         LDKTxAddInput ret = *owner->contents.result;
8918         ret.is_owned = false;
8919         return ret;
8920 }
8921 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
8922         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8923         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8924         uint64_t ret_ref = 0;
8925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8927         return ret_ref;
8928 }
8929
8930 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8931 CHECK(!owner->result_ok);
8932         return DecodeError_clone(&*owner->contents.err);
8933 }
8934 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
8935         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8936         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8937         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8938         uint64_t ret_ref = tag_ptr(ret_copy, true);
8939         return ret_ref;
8940 }
8941
8942 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8943         LDKTxAddOutput ret = *owner->contents.result;
8944         ret.is_owned = false;
8945         return ret;
8946 }
8947 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
8948         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8949         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8950         uint64_t ret_ref = 0;
8951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8953         return ret_ref;
8954 }
8955
8956 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8957 CHECK(!owner->result_ok);
8958         return DecodeError_clone(&*owner->contents.err);
8959 }
8960 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
8961         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8962         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8963         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
8964         uint64_t ret_ref = tag_ptr(ret_copy, true);
8965         return ret_ref;
8966 }
8967
8968 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8969         LDKTxRemoveInput ret = *owner->contents.result;
8970         ret.is_owned = false;
8971         return ret;
8972 }
8973 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
8974         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8975         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
8976         uint64_t ret_ref = 0;
8977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8979         return ret_ref;
8980 }
8981
8982 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8983 CHECK(!owner->result_ok);
8984         return DecodeError_clone(&*owner->contents.err);
8985 }
8986 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
8987         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8989         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
8990         uint64_t ret_ref = tag_ptr(ret_copy, true);
8991         return ret_ref;
8992 }
8993
8994 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8995         LDKTxRemoveOutput ret = *owner->contents.result;
8996         ret.is_owned = false;
8997         return ret;
8998 }
8999 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
9000         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9001         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9002         uint64_t ret_ref = 0;
9003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9005         return ret_ref;
9006 }
9007
9008 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9009 CHECK(!owner->result_ok);
9010         return DecodeError_clone(&*owner->contents.err);
9011 }
9012 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
9013         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9015         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9016         uint64_t ret_ref = tag_ptr(ret_copy, true);
9017         return ret_ref;
9018 }
9019
9020 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9021         LDKTxComplete ret = *owner->contents.result;
9022         ret.is_owned = false;
9023         return ret;
9024 }
9025 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
9026         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9027         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9028         uint64_t ret_ref = 0;
9029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9031         return ret_ref;
9032 }
9033
9034 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9035 CHECK(!owner->result_ok);
9036         return DecodeError_clone(&*owner->contents.err);
9037 }
9038 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
9039         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9041         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9042         uint64_t ret_ref = tag_ptr(ret_copy, true);
9043         return ret_ref;
9044 }
9045
9046 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9047         LDKTxSignatures ret = *owner->contents.result;
9048         ret.is_owned = false;
9049         return ret;
9050 }
9051 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9052         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9053         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9054         uint64_t ret_ref = 0;
9055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9057         return ret_ref;
9058 }
9059
9060 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9061 CHECK(!owner->result_ok);
9062         return DecodeError_clone(&*owner->contents.err);
9063 }
9064 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9065         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9067         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9068         uint64_t ret_ref = tag_ptr(ret_copy, true);
9069         return ret_ref;
9070 }
9071
9072 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9073         LDKTxInitRbf ret = *owner->contents.result;
9074         ret.is_owned = false;
9075         return ret;
9076 }
9077 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
9078         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9079         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9080         uint64_t ret_ref = 0;
9081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9083         return ret_ref;
9084 }
9085
9086 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9087 CHECK(!owner->result_ok);
9088         return DecodeError_clone(&*owner->contents.err);
9089 }
9090 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
9091         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9093         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9094         uint64_t ret_ref = tag_ptr(ret_copy, true);
9095         return ret_ref;
9096 }
9097
9098 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9099         LDKTxAckRbf ret = *owner->contents.result;
9100         ret.is_owned = false;
9101         return ret;
9102 }
9103 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
9104         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9105         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9106         uint64_t ret_ref = 0;
9107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9109         return ret_ref;
9110 }
9111
9112 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9113 CHECK(!owner->result_ok);
9114         return DecodeError_clone(&*owner->contents.err);
9115 }
9116 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
9117         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9119         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9120         uint64_t ret_ref = tag_ptr(ret_copy, true);
9121         return ret_ref;
9122 }
9123
9124 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9125         LDKTxAbort ret = *owner->contents.result;
9126         ret.is_owned = false;
9127         return ret;
9128 }
9129 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
9130         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9131         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9132         uint64_t ret_ref = 0;
9133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9135         return ret_ref;
9136 }
9137
9138 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9139 CHECK(!owner->result_ok);
9140         return DecodeError_clone(&*owner->contents.err);
9141 }
9142 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
9143         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9145         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9146         uint64_t ret_ref = tag_ptr(ret_copy, true);
9147         return ret_ref;
9148 }
9149
9150 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9151         LDKAnnouncementSignatures ret = *owner->contents.result;
9152         ret.is_owned = false;
9153         return ret;
9154 }
9155 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9156         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9157         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9158         uint64_t ret_ref = 0;
9159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9161         return ret_ref;
9162 }
9163
9164 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9165 CHECK(!owner->result_ok);
9166         return DecodeError_clone(&*owner->contents.err);
9167 }
9168 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9169         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9171         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9172         uint64_t ret_ref = tag_ptr(ret_copy, true);
9173         return ret_ref;
9174 }
9175
9176 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9177         LDKChannelReestablish ret = *owner->contents.result;
9178         ret.is_owned = false;
9179         return ret;
9180 }
9181 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
9182         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9183         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9184         uint64_t ret_ref = 0;
9185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9187         return ret_ref;
9188 }
9189
9190 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9191 CHECK(!owner->result_ok);
9192         return DecodeError_clone(&*owner->contents.err);
9193 }
9194 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
9195         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9197         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9198         uint64_t ret_ref = tag_ptr(ret_copy, true);
9199         return ret_ref;
9200 }
9201
9202 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9203         LDKClosingSigned ret = *owner->contents.result;
9204         ret.is_owned = false;
9205         return ret;
9206 }
9207 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9208         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9209         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9210         uint64_t ret_ref = 0;
9211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9213         return ret_ref;
9214 }
9215
9216 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9217 CHECK(!owner->result_ok);
9218         return DecodeError_clone(&*owner->contents.err);
9219 }
9220 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
9221         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9222         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9223         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9224         uint64_t ret_ref = tag_ptr(ret_copy, true);
9225         return ret_ref;
9226 }
9227
9228 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9229         LDKClosingSignedFeeRange ret = *owner->contents.result;
9230         ret.is_owned = false;
9231         return ret;
9232 }
9233 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
9234         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9235         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9236         uint64_t ret_ref = 0;
9237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9239         return ret_ref;
9240 }
9241
9242 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9243 CHECK(!owner->result_ok);
9244         return DecodeError_clone(&*owner->contents.err);
9245 }
9246 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
9247         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9248         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9249         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9250         uint64_t ret_ref = tag_ptr(ret_copy, true);
9251         return ret_ref;
9252 }
9253
9254 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9255         LDKCommitmentSigned ret = *owner->contents.result;
9256         ret.is_owned = false;
9257         return ret;
9258 }
9259 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
9260         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9261         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9262         uint64_t ret_ref = 0;
9263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9265         return ret_ref;
9266 }
9267
9268 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9269 CHECK(!owner->result_ok);
9270         return DecodeError_clone(&*owner->contents.err);
9271 }
9272 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
9273         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9274         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9275         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9276         uint64_t ret_ref = tag_ptr(ret_copy, true);
9277         return ret_ref;
9278 }
9279
9280 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9281         LDKFundingCreated ret = *owner->contents.result;
9282         ret.is_owned = false;
9283         return ret;
9284 }
9285 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
9286         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9287         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9288         uint64_t ret_ref = 0;
9289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9291         return ret_ref;
9292 }
9293
9294 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9295 CHECK(!owner->result_ok);
9296         return DecodeError_clone(&*owner->contents.err);
9297 }
9298 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
9299         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9301         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9302         uint64_t ret_ref = tag_ptr(ret_copy, true);
9303         return ret_ref;
9304 }
9305
9306 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9307         LDKFundingSigned ret = *owner->contents.result;
9308         ret.is_owned = false;
9309         return ret;
9310 }
9311 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9312         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9313         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9314         uint64_t ret_ref = 0;
9315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9317         return ret_ref;
9318 }
9319
9320 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9321 CHECK(!owner->result_ok);
9322         return DecodeError_clone(&*owner->contents.err);
9323 }
9324 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
9325         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9326         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9327         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9328         uint64_t ret_ref = tag_ptr(ret_copy, true);
9329         return ret_ref;
9330 }
9331
9332 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9333         LDKChannelReady ret = *owner->contents.result;
9334         ret.is_owned = false;
9335         return ret;
9336 }
9337 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
9338         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9339         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9340         uint64_t ret_ref = 0;
9341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9343         return ret_ref;
9344 }
9345
9346 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9347 CHECK(!owner->result_ok);
9348         return DecodeError_clone(&*owner->contents.err);
9349 }
9350 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
9351         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9353         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9354         uint64_t ret_ref = tag_ptr(ret_copy, true);
9355         return ret_ref;
9356 }
9357
9358 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9359         LDKInit ret = *owner->contents.result;
9360         ret.is_owned = false;
9361         return ret;
9362 }
9363 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
9364         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9365         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9366         uint64_t ret_ref = 0;
9367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9369         return ret_ref;
9370 }
9371
9372 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9373 CHECK(!owner->result_ok);
9374         return DecodeError_clone(&*owner->contents.err);
9375 }
9376 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
9377         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9379         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9380         uint64_t ret_ref = tag_ptr(ret_copy, true);
9381         return ret_ref;
9382 }
9383
9384 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9385         LDKOpenChannel ret = *owner->contents.result;
9386         ret.is_owned = false;
9387         return ret;
9388 }
9389 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
9390         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9391         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9392         uint64_t ret_ref = 0;
9393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9395         return ret_ref;
9396 }
9397
9398 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9399 CHECK(!owner->result_ok);
9400         return DecodeError_clone(&*owner->contents.err);
9401 }
9402 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
9403         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9405         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9406         uint64_t ret_ref = tag_ptr(ret_copy, true);
9407         return ret_ref;
9408 }
9409
9410 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9411         LDKOpenChannelV2 ret = *owner->contents.result;
9412         ret.is_owned = false;
9413         return ret;
9414 }
9415 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
9416         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9417         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9418         uint64_t ret_ref = 0;
9419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9421         return ret_ref;
9422 }
9423
9424 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9425 CHECK(!owner->result_ok);
9426         return DecodeError_clone(&*owner->contents.err);
9427 }
9428 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
9429         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9431         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9432         uint64_t ret_ref = tag_ptr(ret_copy, true);
9433         return ret_ref;
9434 }
9435
9436 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9437         LDKRevokeAndACK ret = *owner->contents.result;
9438         ret.is_owned = false;
9439         return ret;
9440 }
9441 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
9442         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9443         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9444         uint64_t ret_ref = 0;
9445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9447         return ret_ref;
9448 }
9449
9450 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9451 CHECK(!owner->result_ok);
9452         return DecodeError_clone(&*owner->contents.err);
9453 }
9454 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
9455         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9457         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9458         uint64_t ret_ref = tag_ptr(ret_copy, true);
9459         return ret_ref;
9460 }
9461
9462 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9463         LDKShutdown ret = *owner->contents.result;
9464         ret.is_owned = false;
9465         return ret;
9466 }
9467 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
9468         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9469         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9470         uint64_t ret_ref = 0;
9471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9473         return ret_ref;
9474 }
9475
9476 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9477 CHECK(!owner->result_ok);
9478         return DecodeError_clone(&*owner->contents.err);
9479 }
9480 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
9481         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9483         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9484         uint64_t ret_ref = tag_ptr(ret_copy, true);
9485         return ret_ref;
9486 }
9487
9488 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9489         LDKUpdateFailHTLC ret = *owner->contents.result;
9490         ret.is_owned = false;
9491         return ret;
9492 }
9493 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9494         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9495         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9496         uint64_t ret_ref = 0;
9497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9499         return ret_ref;
9500 }
9501
9502 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9503 CHECK(!owner->result_ok);
9504         return DecodeError_clone(&*owner->contents.err);
9505 }
9506 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
9507         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9509         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9510         uint64_t ret_ref = tag_ptr(ret_copy, true);
9511         return ret_ref;
9512 }
9513
9514 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9515         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9516         ret.is_owned = false;
9517         return ret;
9518 }
9519 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9520         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9521         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9522         uint64_t ret_ref = 0;
9523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9525         return ret_ref;
9526 }
9527
9528 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9529 CHECK(!owner->result_ok);
9530         return DecodeError_clone(&*owner->contents.err);
9531 }
9532 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9533         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9535         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9536         uint64_t ret_ref = tag_ptr(ret_copy, true);
9537         return ret_ref;
9538 }
9539
9540 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9541         LDKUpdateFee ret = *owner->contents.result;
9542         ret.is_owned = false;
9543         return ret;
9544 }
9545 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
9546         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9547         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9548         uint64_t ret_ref = 0;
9549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9551         return ret_ref;
9552 }
9553
9554 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9555 CHECK(!owner->result_ok);
9556         return DecodeError_clone(&*owner->contents.err);
9557 }
9558 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
9559         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9561         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9562         uint64_t ret_ref = tag_ptr(ret_copy, true);
9563         return ret_ref;
9564 }
9565
9566 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9567         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9568         ret.is_owned = false;
9569         return ret;
9570 }
9571 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9572         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9573         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9574         uint64_t ret_ref = 0;
9575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9577         return ret_ref;
9578 }
9579
9580 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9581 CHECK(!owner->result_ok);
9582         return DecodeError_clone(&*owner->contents.err);
9583 }
9584 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9585         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9587         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9588         uint64_t ret_ref = tag_ptr(ret_copy, true);
9589         return ret_ref;
9590 }
9591
9592 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9593         LDKOnionPacket ret = *owner->contents.result;
9594         ret.is_owned = false;
9595         return ret;
9596 }
9597 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_ok"))) TS_CResult_OnionPacketDecodeErrorZ_get_ok(uint64_t owner) {
9598         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9599         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9600         uint64_t ret_ref = 0;
9601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9603         return ret_ref;
9604 }
9605
9606 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9607 CHECK(!owner->result_ok);
9608         return DecodeError_clone(&*owner->contents.err);
9609 }
9610 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_get_err"))) TS_CResult_OnionPacketDecodeErrorZ_get_err(uint64_t owner) {
9611         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9613         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9614         uint64_t ret_ref = tag_ptr(ret_copy, true);
9615         return ret_ref;
9616 }
9617
9618 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9619         LDKUpdateAddHTLC ret = *owner->contents.result;
9620         ret.is_owned = false;
9621         return ret;
9622 }
9623 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9624         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9625         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9626         uint64_t ret_ref = 0;
9627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9629         return ret_ref;
9630 }
9631
9632 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9633 CHECK(!owner->result_ok);
9634         return DecodeError_clone(&*owner->contents.err);
9635 }
9636 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9637         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9638         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9639         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9640         uint64_t ret_ref = tag_ptr(ret_copy, true);
9641         return ret_ref;
9642 }
9643
9644 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9645         LDKOnionMessage ret = *owner->contents.result;
9646         ret.is_owned = false;
9647         return ret;
9648 }
9649 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9650         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9651         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9652         uint64_t ret_ref = 0;
9653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9655         return ret_ref;
9656 }
9657
9658 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9659 CHECK(!owner->result_ok);
9660         return DecodeError_clone(&*owner->contents.err);
9661 }
9662 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9663         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9665         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9666         uint64_t ret_ref = tag_ptr(ret_copy, true);
9667         return ret_ref;
9668 }
9669
9670 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9671         LDKFinalOnionHopData ret = *owner->contents.result;
9672         ret.is_owned = false;
9673         return ret;
9674 }
9675 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(uint64_t owner) {
9676         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9677         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9678         uint64_t ret_ref = 0;
9679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9681         return ret_ref;
9682 }
9683
9684 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9685 CHECK(!owner->result_ok);
9686         return DecodeError_clone(&*owner->contents.err);
9687 }
9688 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_get_err(uint64_t owner) {
9689         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9691         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9692         uint64_t ret_ref = tag_ptr(ret_copy, true);
9693         return ret_ref;
9694 }
9695
9696 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9697         LDKPing ret = *owner->contents.result;
9698         ret.is_owned = false;
9699         return ret;
9700 }
9701 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9702         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9703         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9704         uint64_t ret_ref = 0;
9705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9707         return ret_ref;
9708 }
9709
9710 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9711 CHECK(!owner->result_ok);
9712         return DecodeError_clone(&*owner->contents.err);
9713 }
9714 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9715         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9717         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9718         uint64_t ret_ref = tag_ptr(ret_copy, true);
9719         return ret_ref;
9720 }
9721
9722 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9723         LDKPong ret = *owner->contents.result;
9724         ret.is_owned = false;
9725         return ret;
9726 }
9727 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9728         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9729         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9730         uint64_t ret_ref = 0;
9731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9733         return ret_ref;
9734 }
9735
9736 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9737 CHECK(!owner->result_ok);
9738         return DecodeError_clone(&*owner->contents.err);
9739 }
9740 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9741         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9743         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9744         uint64_t ret_ref = tag_ptr(ret_copy, true);
9745         return ret_ref;
9746 }
9747
9748 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9749         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9750         ret.is_owned = false;
9751         return ret;
9752 }
9753 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9754         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9755         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9756         uint64_t ret_ref = 0;
9757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9759         return ret_ref;
9760 }
9761
9762 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9763 CHECK(!owner->result_ok);
9764         return DecodeError_clone(&*owner->contents.err);
9765 }
9766 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9767         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9769         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9770         uint64_t ret_ref = tag_ptr(ret_copy, true);
9771         return ret_ref;
9772 }
9773
9774 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9775         LDKChannelAnnouncement ret = *owner->contents.result;
9776         ret.is_owned = false;
9777         return ret;
9778 }
9779 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9780         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9781         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9782         uint64_t ret_ref = 0;
9783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9785         return ret_ref;
9786 }
9787
9788 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9789 CHECK(!owner->result_ok);
9790         return DecodeError_clone(&*owner->contents.err);
9791 }
9792 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9793         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9794         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9795         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9796         uint64_t ret_ref = tag_ptr(ret_copy, true);
9797         return ret_ref;
9798 }
9799
9800 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9801         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9802         ret.is_owned = false;
9803         return ret;
9804 }
9805 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9806         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9807         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9808         uint64_t ret_ref = 0;
9809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9811         return ret_ref;
9812 }
9813
9814 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9815 CHECK(!owner->result_ok);
9816         return DecodeError_clone(&*owner->contents.err);
9817 }
9818 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9819         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9820         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9821         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9822         uint64_t ret_ref = tag_ptr(ret_copy, true);
9823         return ret_ref;
9824 }
9825
9826 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9827         LDKChannelUpdate ret = *owner->contents.result;
9828         ret.is_owned = false;
9829         return ret;
9830 }
9831 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9832         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9833         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9834         uint64_t ret_ref = 0;
9835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9837         return ret_ref;
9838 }
9839
9840 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9841 CHECK(!owner->result_ok);
9842         return DecodeError_clone(&*owner->contents.err);
9843 }
9844 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9845         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9846         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9847         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9848         uint64_t ret_ref = tag_ptr(ret_copy, true);
9849         return ret_ref;
9850 }
9851
9852 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9853         LDKErrorMessage ret = *owner->contents.result;
9854         ret.is_owned = false;
9855         return ret;
9856 }
9857 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9858         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9859         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9860         uint64_t ret_ref = 0;
9861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9863         return ret_ref;
9864 }
9865
9866 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9867 CHECK(!owner->result_ok);
9868         return DecodeError_clone(&*owner->contents.err);
9869 }
9870 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9871         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9873         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9874         uint64_t ret_ref = tag_ptr(ret_copy, true);
9875         return ret_ref;
9876 }
9877
9878 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9879         LDKWarningMessage ret = *owner->contents.result;
9880         ret.is_owned = false;
9881         return ret;
9882 }
9883 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9884         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9885         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9886         uint64_t ret_ref = 0;
9887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9889         return ret_ref;
9890 }
9891
9892 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9893 CHECK(!owner->result_ok);
9894         return DecodeError_clone(&*owner->contents.err);
9895 }
9896 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9897         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9898         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9899         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9900         uint64_t ret_ref = tag_ptr(ret_copy, true);
9901         return ret_ref;
9902 }
9903
9904 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9905         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9906         ret.is_owned = false;
9907         return ret;
9908 }
9909 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9910         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9911         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9912         uint64_t ret_ref = 0;
9913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9915         return ret_ref;
9916 }
9917
9918 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9919 CHECK(!owner->result_ok);
9920         return DecodeError_clone(&*owner->contents.err);
9921 }
9922 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9923         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9924         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9925         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9926         uint64_t ret_ref = tag_ptr(ret_copy, true);
9927         return ret_ref;
9928 }
9929
9930 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9931         LDKNodeAnnouncement ret = *owner->contents.result;
9932         ret.is_owned = false;
9933         return ret;
9934 }
9935 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9936         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9937         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9938         uint64_t ret_ref = 0;
9939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9941         return ret_ref;
9942 }
9943
9944 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9945 CHECK(!owner->result_ok);
9946         return DecodeError_clone(&*owner->contents.err);
9947 }
9948 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9949         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9951         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9952         uint64_t ret_ref = tag_ptr(ret_copy, true);
9953         return ret_ref;
9954 }
9955
9956 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9957         LDKQueryShortChannelIds ret = *owner->contents.result;
9958         ret.is_owned = false;
9959         return ret;
9960 }
9961 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
9962         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9963         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9964         uint64_t ret_ref = 0;
9965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9967         return ret_ref;
9968 }
9969
9970 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9971 CHECK(!owner->result_ok);
9972         return DecodeError_clone(&*owner->contents.err);
9973 }
9974 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
9975         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9977         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9978         uint64_t ret_ref = tag_ptr(ret_copy, true);
9979         return ret_ref;
9980 }
9981
9982 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9983         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9984         ret.is_owned = false;
9985         return ret;
9986 }
9987 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
9988         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9989         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9990         uint64_t ret_ref = 0;
9991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9993         return ret_ref;
9994 }
9995
9996 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9997 CHECK(!owner->result_ok);
9998         return DecodeError_clone(&*owner->contents.err);
9999 }
10000 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
10001         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10003         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10004         uint64_t ret_ref = tag_ptr(ret_copy, true);
10005         return ret_ref;
10006 }
10007
10008 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10009         LDKQueryChannelRange ret = *owner->contents.result;
10010         ret.is_owned = false;
10011         return ret;
10012 }
10013 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
10014         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10015         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10016         uint64_t ret_ref = 0;
10017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10019         return ret_ref;
10020 }
10021
10022 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10023 CHECK(!owner->result_ok);
10024         return DecodeError_clone(&*owner->contents.err);
10025 }
10026 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
10027         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10028         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10029         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10030         uint64_t ret_ref = tag_ptr(ret_copy, true);
10031         return ret_ref;
10032 }
10033
10034 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10035         LDKReplyChannelRange ret = *owner->contents.result;
10036         ret.is_owned = false;
10037         return ret;
10038 }
10039 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
10040         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10041         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10042         uint64_t ret_ref = 0;
10043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10045         return ret_ref;
10046 }
10047
10048 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10049 CHECK(!owner->result_ok);
10050         return DecodeError_clone(&*owner->contents.err);
10051 }
10052 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
10053         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10054         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10055         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10056         uint64_t ret_ref = tag_ptr(ret_copy, true);
10057         return ret_ref;
10058 }
10059
10060 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10061         LDKGossipTimestampFilter ret = *owner->contents.result;
10062         ret.is_owned = false;
10063         return ret;
10064 }
10065 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
10066         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10067         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10068         uint64_t ret_ref = 0;
10069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10071         return ret_ref;
10072 }
10073
10074 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10075 CHECK(!owner->result_ok);
10076         return DecodeError_clone(&*owner->contents.err);
10077 }
10078 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
10079         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10081         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10082         uint64_t ret_ref = tag_ptr(ret_copy, true);
10083         return ret_ref;
10084 }
10085
10086 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10087         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10088         for (size_t i = 0; i < ret.datalen; i++) {
10089                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10090         }
10091         return ret;
10092 }
10093 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
10094         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10095         switch(obj->tag) {
10096                 case LDKSignOrCreationError_SignError: return 0;
10097                 case LDKSignOrCreationError_CreationError: return 1;
10098                 default: abort();
10099         }
10100 }
10101 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
10102         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10103         assert(obj->tag == LDKSignOrCreationError_CreationError);
10104         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
10105         return creation_error_conv;
10106 }
10107 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10108         LDKBolt11Invoice ret = *owner->contents.result;
10109         ret.is_owned = false;
10110         return ret;
10111 }
10112 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
10113         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10114         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10115         uint64_t ret_ref = 0;
10116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10118         return ret_ref;
10119 }
10120
10121 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10122 CHECK(!owner->result_ok);
10123         return SignOrCreationError_clone(&*owner->contents.err);
10124 }
10125 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
10126         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10127         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10128         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10129         uint64_t ret_ref = tag_ptr(ret_copy, true);
10130         return ret_ref;
10131 }
10132
10133 uint32_t __attribute__((export_name("TS_LDKCOption_InboundHTLCStateDetailsZ_ty_from_ptr"))) TS_LDKCOption_InboundHTLCStateDetailsZ_ty_from_ptr(uint64_t ptr) {
10134         LDKCOption_InboundHTLCStateDetailsZ *obj = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(ptr);
10135         switch(obj->tag) {
10136                 case LDKCOption_InboundHTLCStateDetailsZ_Some: return 0;
10137                 case LDKCOption_InboundHTLCStateDetailsZ_None: return 1;
10138                 default: abort();
10139         }
10140 }
10141 uint32_t __attribute__((export_name("TS_LDKCOption_InboundHTLCStateDetailsZ_Some_get_some"))) TS_LDKCOption_InboundHTLCStateDetailsZ_Some_get_some(uint64_t ptr) {
10142         LDKCOption_InboundHTLCStateDetailsZ *obj = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(ptr);
10143         assert(obj->tag == LDKCOption_InboundHTLCStateDetailsZ_Some);
10144         uint32_t some_conv = LDKInboundHTLCStateDetails_to_js(obj->some);
10145         return some_conv;
10146 }
10147 static inline struct LDKCOption_InboundHTLCStateDetailsZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10148 CHECK(owner->result_ok);
10149         return COption_InboundHTLCStateDetailsZ_clone(&*owner->contents.result);
10150 }
10151 uint64_t  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(uint64_t owner) {
10152         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10153         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
10154         *ret_copy = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_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_InboundHTLCStateDetailsZDecodeErrorZ_get_err(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *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_InboundHTLCStateDetailsZDecodeErrorZ_get_err"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(uint64_t owner) {
10164         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10166         *ret_copy = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(owner_conv);
10167         uint64_t ret_ref = tag_ptr(ret_copy, true);
10168         return ret_ref;
10169 }
10170
10171 static inline struct LDKInboundHTLCDetails CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10172         LDKInboundHTLCDetails ret = *owner->contents.result;
10173         ret.is_owned = false;
10174         return ret;
10175 }
10176 uint64_t  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_get_ok"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(uint64_t owner) {
10177         LDKCResult_InboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10178         LDKInboundHTLCDetails ret_var = CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(owner_conv);
10179         uint64_t ret_ref = 0;
10180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10182         return ret_ref;
10183 }
10184
10185 static inline struct LDKDecodeError CResult_InboundHTLCDetailsDecodeErrorZ_get_err(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10186 CHECK(!owner->result_ok);
10187         return DecodeError_clone(&*owner->contents.err);
10188 }
10189 uint64_t  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_get_err"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_get_err(uint64_t owner) {
10190         LDKCResult_InboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10192         *ret_copy = CResult_InboundHTLCDetailsDecodeErrorZ_get_err(owner_conv);
10193         uint64_t ret_ref = tag_ptr(ret_copy, true);
10194         return ret_ref;
10195 }
10196
10197 uint32_t __attribute__((export_name("TS_LDKCOption_OutboundHTLCStateDetailsZ_ty_from_ptr"))) TS_LDKCOption_OutboundHTLCStateDetailsZ_ty_from_ptr(uint64_t ptr) {
10198         LDKCOption_OutboundHTLCStateDetailsZ *obj = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(ptr);
10199         switch(obj->tag) {
10200                 case LDKCOption_OutboundHTLCStateDetailsZ_Some: return 0;
10201                 case LDKCOption_OutboundHTLCStateDetailsZ_None: return 1;
10202                 default: abort();
10203         }
10204 }
10205 uint32_t __attribute__((export_name("TS_LDKCOption_OutboundHTLCStateDetailsZ_Some_get_some"))) TS_LDKCOption_OutboundHTLCStateDetailsZ_Some_get_some(uint64_t ptr) {
10206         LDKCOption_OutboundHTLCStateDetailsZ *obj = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(ptr);
10207         assert(obj->tag == LDKCOption_OutboundHTLCStateDetailsZ_Some);
10208         uint32_t some_conv = LDKOutboundHTLCStateDetails_to_js(obj->some);
10209         return some_conv;
10210 }
10211 static inline struct LDKCOption_OutboundHTLCStateDetailsZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10212 CHECK(owner->result_ok);
10213         return COption_OutboundHTLCStateDetailsZ_clone(&*owner->contents.result);
10214 }
10215 uint64_t  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(uint64_t owner) {
10216         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10217         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
10218         *ret_copy = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(owner_conv);
10219         uint64_t ret_ref = tag_ptr(ret_copy, true);
10220         return ret_ref;
10221 }
10222
10223 static inline struct LDKDecodeError CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10224 CHECK(!owner->result_ok);
10225         return DecodeError_clone(&*owner->contents.err);
10226 }
10227 uint64_t  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(uint64_t owner) {
10228         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10229         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10230         *ret_copy = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(owner_conv);
10231         uint64_t ret_ref = tag_ptr(ret_copy, true);
10232         return ret_ref;
10233 }
10234
10235 static inline struct LDKOutboundHTLCDetails CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10236         LDKOutboundHTLCDetails ret = *owner->contents.result;
10237         ret.is_owned = false;
10238         return ret;
10239 }
10240 uint64_t  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(uint64_t owner) {
10241         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10242         LDKOutboundHTLCDetails ret_var = CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(owner_conv);
10243         uint64_t ret_ref = 0;
10244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10246         return ret_ref;
10247 }
10248
10249 static inline struct LDKDecodeError CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10250 CHECK(!owner->result_ok);
10251         return DecodeError_clone(&*owner->contents.err);
10252 }
10253 uint64_t  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_get_err"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(uint64_t owner) {
10254         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10255         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10256         *ret_copy = CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(owner_conv);
10257         uint64_t ret_ref = tag_ptr(ret_copy, true);
10258         return ret_ref;
10259 }
10260
10261 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
10262         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
10263         ret.is_owned = false;
10264         return ret;
10265 }
10266 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
10267         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
10268         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
10269         uint64_t ret_ref = 0;
10270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10272         return ret_ref;
10273 }
10274
10275 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
10276 CHECK(!owner->result_ok);
10277         return DecodeError_clone(&*owner->contents.err);
10278 }
10279 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
10280         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
10281         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10282         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
10283         uint64_t ret_ref = tag_ptr(ret_copy, true);
10284         return ret_ref;
10285 }
10286
10287 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
10288         LDKChannelCounterparty ret = *owner->contents.result;
10289         ret.is_owned = false;
10290         return ret;
10291 }
10292 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
10293         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
10294         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
10295         uint64_t ret_ref = 0;
10296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10298         return ret_ref;
10299 }
10300
10301 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
10302 CHECK(!owner->result_ok);
10303         return DecodeError_clone(&*owner->contents.err);
10304 }
10305 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
10306         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
10307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10308         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
10309         uint64_t ret_ref = tag_ptr(ret_copy, true);
10310         return ret_ref;
10311 }
10312
10313 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
10314         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
10315         switch(obj->tag) {
10316                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
10317                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
10318                 default: abort();
10319         }
10320 }
10321 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
10322         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
10323         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
10324         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
10325         return some_conv;
10326 }
10327 static inline LDKCVec_InboundHTLCDetailsZ CVec_InboundHTLCDetailsZ_clone(const LDKCVec_InboundHTLCDetailsZ *orig) {
10328         LDKCVec_InboundHTLCDetailsZ ret = { .data = MALLOC(sizeof(LDKInboundHTLCDetails) * orig->datalen, "LDKCVec_InboundHTLCDetailsZ clone bytes"), .datalen = orig->datalen };
10329         for (size_t i = 0; i < ret.datalen; i++) {
10330                 ret.data[i] = InboundHTLCDetails_clone(&orig->data[i]);
10331         }
10332         return ret;
10333 }
10334 static inline LDKCVec_OutboundHTLCDetailsZ CVec_OutboundHTLCDetailsZ_clone(const LDKCVec_OutboundHTLCDetailsZ *orig) {
10335         LDKCVec_OutboundHTLCDetailsZ ret = { .data = MALLOC(sizeof(LDKOutboundHTLCDetails) * orig->datalen, "LDKCVec_OutboundHTLCDetailsZ clone bytes"), .datalen = orig->datalen };
10336         for (size_t i = 0; i < ret.datalen; i++) {
10337                 ret.data[i] = OutboundHTLCDetails_clone(&orig->data[i]);
10338         }
10339         return ret;
10340 }
10341 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
10342         LDKChannelDetails ret = *owner->contents.result;
10343         ret.is_owned = false;
10344         return ret;
10345 }
10346 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
10347         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
10348         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
10349         uint64_t ret_ref = 0;
10350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10352         return ret_ref;
10353 }
10354
10355 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
10356 CHECK(!owner->result_ok);
10357         return DecodeError_clone(&*owner->contents.err);
10358 }
10359 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
10360         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
10361         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10362         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
10363         uint64_t ret_ref = tag_ptr(ret_copy, true);
10364         return ret_ref;
10365 }
10366
10367 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
10368 CHECK(owner->result_ok);
10369         return ChannelShutdownState_clone(&*owner->contents.result);
10370 }
10371 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
10372         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
10373         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
10374         return ret_conv;
10375 }
10376
10377 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
10378 CHECK(!owner->result_ok);
10379         return DecodeError_clone(&*owner->contents.err);
10380 }
10381 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
10382         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
10383         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10384         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
10385         uint64_t ret_ref = tag_ptr(ret_copy, true);
10386         return ret_ref;
10387 }
10388
10389 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10390 CHECK(owner->result_ok);
10391         return OffersMessage_clone(&*owner->contents.result);
10392 }
10393 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
10394         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10395         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
10396         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
10397         uint64_t ret_ref = tag_ptr(ret_copy, true);
10398         return ret_ref;
10399 }
10400
10401 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10402 CHECK(!owner->result_ok);
10403         return DecodeError_clone(&*owner->contents.err);
10404 }
10405 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
10406         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10407         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10408         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
10409         uint64_t ret_ref = tag_ptr(ret_copy, true);
10410         return ret_ref;
10411 }
10412
10413 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
10414         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10415         switch(obj->tag) {
10416                 case LDKCOption_HTLCClaimZ_Some: return 0;
10417                 case LDKCOption_HTLCClaimZ_None: return 1;
10418                 default: abort();
10419         }
10420 }
10421 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
10422         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10423         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
10424         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
10425         return some_conv;
10426 }
10427 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10428         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
10429         ret.is_owned = false;
10430         return ret;
10431 }
10432 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
10433         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10434         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
10435         uint64_t ret_ref = 0;
10436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10438         return ret_ref;
10439 }
10440
10441 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10442 CHECK(!owner->result_ok);
10443         return DecodeError_clone(&*owner->contents.err);
10444 }
10445 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
10446         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10447         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10448         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
10449         uint64_t ret_ref = tag_ptr(ret_copy, true);
10450         return ret_ref;
10451 }
10452
10453 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10454         LDKTxCreationKeys ret = *owner->contents.result;
10455         ret.is_owned = false;
10456         return ret;
10457 }
10458 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
10459         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10460         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
10461         uint64_t ret_ref = 0;
10462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10464         return ret_ref;
10465 }
10466
10467 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10468 CHECK(!owner->result_ok);
10469         return DecodeError_clone(&*owner->contents.err);
10470 }
10471 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
10472         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10473         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10474         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
10475         uint64_t ret_ref = tag_ptr(ret_copy, true);
10476         return ret_ref;
10477 }
10478
10479 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10480         LDKChannelPublicKeys ret = *owner->contents.result;
10481         ret.is_owned = false;
10482         return ret;
10483 }
10484 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
10485         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10486         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
10487         uint64_t ret_ref = 0;
10488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10490         return ret_ref;
10491 }
10492
10493 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10494 CHECK(!owner->result_ok);
10495         return DecodeError_clone(&*owner->contents.err);
10496 }
10497 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
10498         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10499         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10500         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
10501         uint64_t ret_ref = tag_ptr(ret_copy, true);
10502         return ret_ref;
10503 }
10504
10505 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10506         LDKHTLCOutputInCommitment ret = *owner->contents.result;
10507         ret.is_owned = false;
10508         return ret;
10509 }
10510 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
10511         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10512         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
10513         uint64_t ret_ref = 0;
10514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10516         return ret_ref;
10517 }
10518
10519 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10520 CHECK(!owner->result_ok);
10521         return DecodeError_clone(&*owner->contents.err);
10522 }
10523 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
10524         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10525         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10526         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
10527         uint64_t ret_ref = tag_ptr(ret_copy, true);
10528         return ret_ref;
10529 }
10530
10531 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10532         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
10533         ret.is_owned = false;
10534         return ret;
10535 }
10536 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
10537         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10538         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10539         uint64_t ret_ref = 0;
10540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10542         return ret_ref;
10543 }
10544
10545 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10546 CHECK(!owner->result_ok);
10547         return DecodeError_clone(&*owner->contents.err);
10548 }
10549 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
10550         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10551         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10552         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10553         uint64_t ret_ref = tag_ptr(ret_copy, true);
10554         return ret_ref;
10555 }
10556
10557 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10558         LDKChannelTransactionParameters ret = *owner->contents.result;
10559         ret.is_owned = false;
10560         return ret;
10561 }
10562 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
10563         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10564         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10565         uint64_t ret_ref = 0;
10566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10568         return ret_ref;
10569 }
10570
10571 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10572 CHECK(!owner->result_ok);
10573         return DecodeError_clone(&*owner->contents.err);
10574 }
10575 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
10576         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10577         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10578         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10579         uint64_t ret_ref = tag_ptr(ret_copy, true);
10580         return ret_ref;
10581 }
10582
10583 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10584         LDKHolderCommitmentTransaction ret = *owner->contents.result;
10585         ret.is_owned = false;
10586         return ret;
10587 }
10588 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10589         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10590         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10591         uint64_t ret_ref = 0;
10592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10594         return ret_ref;
10595 }
10596
10597 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10598 CHECK(!owner->result_ok);
10599         return DecodeError_clone(&*owner->contents.err);
10600 }
10601 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10602         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10604         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10605         uint64_t ret_ref = tag_ptr(ret_copy, true);
10606         return ret_ref;
10607 }
10608
10609 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10610         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
10611         ret.is_owned = false;
10612         return ret;
10613 }
10614 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10615         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10616         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10617         uint64_t ret_ref = 0;
10618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10620         return ret_ref;
10621 }
10622
10623 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10624 CHECK(!owner->result_ok);
10625         return DecodeError_clone(&*owner->contents.err);
10626 }
10627 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10628         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10629         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10630         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10631         uint64_t ret_ref = tag_ptr(ret_copy, true);
10632         return ret_ref;
10633 }
10634
10635 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10636         LDKTrustedClosingTransaction ret = *owner->contents.result;
10637         ret.is_owned = false;
10638         return ret;
10639 }
10640 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
10641         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10642         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
10643         uint64_t ret_ref = 0;
10644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10646         return ret_ref;
10647 }
10648
10649 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10650 CHECK(!owner->result_ok);
10651         return *owner->contents.err;
10652 }
10653 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
10654         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10655         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
10656 }
10657
10658 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10659         LDKCommitmentTransaction ret = *owner->contents.result;
10660         ret.is_owned = false;
10661         return ret;
10662 }
10663 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
10664         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10665         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10666         uint64_t ret_ref = 0;
10667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10669         return ret_ref;
10670 }
10671
10672 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10673 CHECK(!owner->result_ok);
10674         return DecodeError_clone(&*owner->contents.err);
10675 }
10676 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
10677         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10678         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10679         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10680         uint64_t ret_ref = tag_ptr(ret_copy, true);
10681         return ret_ref;
10682 }
10683
10684 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10685         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
10686         ret.is_owned = false;
10687         return ret;
10688 }
10689 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
10690         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10691         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
10692         uint64_t ret_ref = 0;
10693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10695         return ret_ref;
10696 }
10697
10698 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10699 CHECK(!owner->result_ok);
10700         return *owner->contents.err;
10701 }
10702 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
10703         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10704         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
10705 }
10706
10707 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10708 CHECK(owner->result_ok);
10709         return *owner->contents.result;
10710 }
10711 ptrArray  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_ok(uint64_t owner) {
10712         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10713         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
10714         ptrArray ret_arr = NULL;
10715         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
10716         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
10717         for (size_t m = 0; m < ret_var.datalen; m++) {
10718                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
10719                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
10720                 ret_arr_ptr[m] = ret_conv_12_arr;
10721         }
10722         
10723         return ret_arr;
10724 }
10725
10726 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10727 CHECK(!owner->result_ok);
10728         return *owner->contents.err;
10729 }
10730 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_get_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_get_err(uint64_t owner) {
10731         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10732         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
10733 }
10734
10735 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_ty_from_ptr"))) TS_LDKCOption_usizeZ_ty_from_ptr(uint64_t ptr) {
10736         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10737         switch(obj->tag) {
10738                 case LDKCOption_usizeZ_Some: return 0;
10739                 case LDKCOption_usizeZ_None: return 1;
10740                 default: abort();
10741         }
10742 }
10743 uint32_t __attribute__((export_name("TS_LDKCOption_usizeZ_Some_get_some"))) TS_LDKCOption_usizeZ_Some_get_some(uint64_t ptr) {
10744         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10745         assert(obj->tag == LDKCOption_usizeZ_Some);
10746         uint32_t some_conv = obj->some;
10747         return some_conv;
10748 }
10749 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10750         LDKShutdownScript ret = *owner->contents.result;
10751         ret.is_owned = false;
10752         return ret;
10753 }
10754 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
10755         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10756         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
10757         uint64_t ret_ref = 0;
10758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10760         return ret_ref;
10761 }
10762
10763 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10764 CHECK(!owner->result_ok);
10765         return DecodeError_clone(&*owner->contents.err);
10766 }
10767 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
10768         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10769         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10770         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
10771         uint64_t ret_ref = tag_ptr(ret_copy, true);
10772         return ret_ref;
10773 }
10774
10775 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10776         LDKShutdownScript ret = *owner->contents.result;
10777         ret.is_owned = false;
10778         return ret;
10779 }
10780 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
10781         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10782         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
10783         uint64_t ret_ref = 0;
10784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10786         return ret_ref;
10787 }
10788
10789 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10790         LDKInvalidShutdownScript ret = *owner->contents.err;
10791         ret.is_owned = false;
10792         return ret;
10793 }
10794 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
10795         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10796         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
10797         uint64_t ret_ref = 0;
10798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10800         return ret_ref;
10801 }
10802
10803 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
10804         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10805         switch(obj->tag) {
10806                 case LDKPaymentPurpose_Bolt11InvoicePayment: return 0;
10807                 case LDKPaymentPurpose_Bolt12OfferPayment: return 1;
10808                 case LDKPaymentPurpose_Bolt12RefundPayment: return 2;
10809                 case LDKPaymentPurpose_SpontaneousPayment: return 3;
10810                 default: abort();
10811         }
10812 }
10813 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage(uint64_t ptr) {
10814         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10815         assert(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
10816         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
10817         return payment_preimage_ref;
10818 }
10819 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret(uint64_t ptr) {
10820         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10821         assert(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
10822         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10823         memcpy(payment_secret_arr->elems, obj->bolt11_invoice_payment.payment_secret.data, 32);
10824         return payment_secret_arr;
10825 }
10826 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage(uint64_t ptr) {
10827         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10828         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10829         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
10830         return payment_preimage_ref;
10831 }
10832 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret(uint64_t ptr) {
10833         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10834         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10835         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10836         memcpy(payment_secret_arr->elems, obj->bolt12_offer_payment.payment_secret.data, 32);
10837         return payment_secret_arr;
10838 }
10839 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context"))) TS_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context(uint64_t ptr) {
10840         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10841         assert(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
10842         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
10843                         uint64_t payment_context_ref = 0;
10844                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
10845                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
10846         return payment_context_ref;
10847 }
10848 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage(uint64_t ptr) {
10849         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10850         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10851         uint64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
10852         return payment_preimage_ref;
10853 }
10854 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret(uint64_t ptr) {
10855         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10856         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10857         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10858         memcpy(payment_secret_arr->elems, obj->bolt12_refund_payment.payment_secret.data, 32);
10859         return payment_secret_arr;
10860 }
10861 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context"))) TS_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context(uint64_t ptr) {
10862         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10863         assert(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
10864         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
10865                         uint64_t payment_context_ref = 0;
10866                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
10867                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
10868         return payment_context_ref;
10869 }
10870 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
10871         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10872         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
10873         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
10874         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
10875         return spontaneous_payment_arr;
10876 }
10877 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10878 CHECK(owner->result_ok);
10879         return PaymentPurpose_clone(&*owner->contents.result);
10880 }
10881 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
10882         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10883         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10884         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
10885         uint64_t ret_ref = tag_ptr(ret_copy, true);
10886         return ret_ref;
10887 }
10888
10889 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10890 CHECK(!owner->result_ok);
10891         return DecodeError_clone(&*owner->contents.err);
10892 }
10893 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
10894         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10895         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10896         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10897         uint64_t ret_ref = tag_ptr(ret_copy, true);
10898         return ret_ref;
10899 }
10900
10901 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10902         LDKClaimedHTLC ret = *owner->contents.result;
10903         ret.is_owned = false;
10904         return ret;
10905 }
10906 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
10907         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10908         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10909         uint64_t ret_ref = 0;
10910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10912         return ret_ref;
10913 }
10914
10915 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10916 CHECK(!owner->result_ok);
10917         return DecodeError_clone(&*owner->contents.err);
10918 }
10919 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_get_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_get_err(uint64_t owner) {
10920         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10921         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10922         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10923         uint64_t ret_ref = tag_ptr(ret_copy, true);
10924         return ret_ref;
10925 }
10926
10927 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
10928         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10929         switch(obj->tag) {
10930                 case LDKPathFailure_InitialSend: return 0;
10931                 case LDKPathFailure_OnPath: return 1;
10932                 default: abort();
10933         }
10934 }
10935 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
10936         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10937         assert(obj->tag == LDKPathFailure_InitialSend);
10938         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10939         return err_ref;
10940 }
10941 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
10942         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10943         assert(obj->tag == LDKPathFailure_OnPath);
10944         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10945         return network_update_ref;
10946 }
10947 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
10948         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10949         switch(obj->tag) {
10950                 case LDKCOption_PathFailureZ_Some: return 0;
10951                 case LDKCOption_PathFailureZ_None: return 1;
10952                 default: abort();
10953         }
10954 }
10955 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
10956         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10957         assert(obj->tag == LDKCOption_PathFailureZ_Some);
10958         uint64_t some_ref = tag_ptr(&obj->some, false);
10959         return some_ref;
10960 }
10961 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10962 CHECK(owner->result_ok);
10963         return COption_PathFailureZ_clone(&*owner->contents.result);
10964 }
10965 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
10966         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10967         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10968         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10969         uint64_t ret_ref = tag_ptr(ret_copy, true);
10970         return ret_ref;
10971 }
10972
10973 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10974 CHECK(!owner->result_ok);
10975         return DecodeError_clone(&*owner->contents.err);
10976 }
10977 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
10978         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10979         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10980         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10981         uint64_t ret_ref = tag_ptr(ret_copy, true);
10982         return ret_ref;
10983 }
10984
10985 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
10986         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10987         switch(obj->tag) {
10988                 case LDKCOption_ClosureReasonZ_Some: return 0;
10989                 case LDKCOption_ClosureReasonZ_None: return 1;
10990                 default: abort();
10991         }
10992 }
10993 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
10994         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10995         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
10996         uint64_t some_ref = tag_ptr(&obj->some, false);
10997         return some_ref;
10998 }
10999 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11000 CHECK(owner->result_ok);
11001         return COption_ClosureReasonZ_clone(&*owner->contents.result);
11002 }
11003 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
11004         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11005         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11006         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
11007         uint64_t ret_ref = tag_ptr(ret_copy, true);
11008         return ret_ref;
11009 }
11010
11011 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11012 CHECK(!owner->result_ok);
11013         return DecodeError_clone(&*owner->contents.err);
11014 }
11015 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
11016         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11017         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11018         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
11019         uint64_t ret_ref = tag_ptr(ret_copy, true);
11020         return ret_ref;
11021 }
11022
11023 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
11024         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11025         switch(obj->tag) {
11026                 case LDKHTLCDestination_NextHopChannel: return 0;
11027                 case LDKHTLCDestination_UnknownNextHop: return 1;
11028                 case LDKHTLCDestination_InvalidForward: return 2;
11029                 case LDKHTLCDestination_InvalidOnion: return 3;
11030                 case LDKHTLCDestination_FailedPayment: return 4;
11031                 default: abort();
11032         }
11033 }
11034 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
11035         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11036         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
11037         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11038         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
11039         return node_id_arr;
11040 }
11041 uint64_t __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
11042         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11043         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
11044         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
11045                         uint64_t channel_id_ref = 0;
11046                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11047                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11048         return channel_id_ref;
11049 }
11050 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
11051         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11052         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
11053         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
11054         return requested_forward_scid_conv;
11055 }
11056 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
11057         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11058         assert(obj->tag == LDKHTLCDestination_InvalidForward);
11059         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
11060         return requested_forward_scid_conv;
11061 }
11062 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
11063         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11064         assert(obj->tag == LDKHTLCDestination_FailedPayment);
11065         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11066         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
11067         return payment_hash_arr;
11068 }
11069 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
11070         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
11071         switch(obj->tag) {
11072                 case LDKCOption_HTLCDestinationZ_Some: return 0;
11073                 case LDKCOption_HTLCDestinationZ_None: return 1;
11074                 default: abort();
11075         }
11076 }
11077 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
11078         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
11079         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
11080         uint64_t some_ref = tag_ptr(&obj->some, false);
11081         return some_ref;
11082 }
11083 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
11084 CHECK(owner->result_ok);
11085         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
11086 }
11087 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
11088         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
11089         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11090         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
11091         uint64_t ret_ref = tag_ptr(ret_copy, true);
11092         return ret_ref;
11093 }
11094
11095 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
11096 CHECK(!owner->result_ok);
11097         return DecodeError_clone(&*owner->contents.err);
11098 }
11099 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
11100         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
11101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11102         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
11103         uint64_t ret_ref = tag_ptr(ret_copy, true);
11104         return ret_ref;
11105 }
11106
11107 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
11108 CHECK(owner->result_ok);
11109         return PaymentFailureReason_clone(&*owner->contents.result);
11110 }
11111 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
11112         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
11113         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
11114         return ret_conv;
11115 }
11116
11117 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
11118 CHECK(!owner->result_ok);
11119         return DecodeError_clone(&*owner->contents.err);
11120 }
11121 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
11122         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
11123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11124         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
11125         uint64_t ret_ref = tag_ptr(ret_copy, true);
11126         return ret_ref;
11127 }
11128
11129 uint32_t __attribute__((export_name("TS_LDKCOption_U128Z_ty_from_ptr"))) TS_LDKCOption_U128Z_ty_from_ptr(uint64_t ptr) {
11130         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
11131         switch(obj->tag) {
11132                 case LDKCOption_U128Z_Some: return 0;
11133                 case LDKCOption_U128Z_None: return 1;
11134                 default: abort();
11135         }
11136 }
11137 int8_tArray __attribute__((export_name("TS_LDKCOption_U128Z_Some_get_some"))) TS_LDKCOption_U128Z_Some_get_some(uint64_t ptr) {
11138         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
11139         assert(obj->tag == LDKCOption_U128Z_Some);
11140         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
11141         memcpy(some_arr->elems, obj->some.le_bytes, 16);
11142         return some_arr;
11143 }
11144 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
11145         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
11146         for (size_t i = 0; i < ret.datalen; i++) {
11147                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
11148         }
11149         return ret;
11150 }
11151 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
11152         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
11153         switch(obj->tag) {
11154                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
11155                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
11156                 default: abort();
11157         }
11158 }
11159 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
11160         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
11161         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
11162         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
11163         return some_conv;
11164 }
11165 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
11166         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11167         switch(obj->tag) {
11168                 case LDKBumpTransactionEvent_ChannelClose: return 0;
11169                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
11170                 default: abort();
11171         }
11172 }
11173 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_channel_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_channel_id(uint64_t ptr) {
11174         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11175         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11176         LDKChannelId channel_id_var = obj->channel_close.channel_id;
11177                         uint64_t channel_id_ref = 0;
11178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11179                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11180         return channel_id_ref;
11181 }
11182 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id(uint64_t ptr) {
11183         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11184         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11185         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11186         memcpy(counterparty_node_id_arr->elems, obj->channel_close.counterparty_node_id.compressed_form, 33);
11187         return counterparty_node_id_arr;
11188 }
11189 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
11190         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11191         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11192         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11193         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
11194         return claim_id_arr;
11195 }
11196 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) {
11197         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11198         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11199         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
11200         return package_target_feerate_sat_per_1000_weight_conv;
11201 }
11202 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
11203         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11204         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11205         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
11206                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
11207                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
11208         return commitment_tx_arr;
11209 }
11210 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
11211         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11212         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11213         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
11214         return commitment_tx_fee_satoshis_conv;
11215 }
11216 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
11217         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11218         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11219         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
11220                         uint64_t anchor_descriptor_ref = 0;
11221                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
11222                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
11223         return anchor_descriptor_ref;
11224 }
11225 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
11226         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11227         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11228         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
11229                         uint64_tArray pending_htlcs_arr = NULL;
11230                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
11231                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
11232                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
11233                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
11234                                 uint64_t pending_htlcs_conv_24_ref = 0;
11235                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
11236                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
11237                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
11238                         }
11239                         
11240         return pending_htlcs_arr;
11241 }
11242 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_channel_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_channel_id(uint64_t ptr) {
11243         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11244         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11245         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
11246                         uint64_t channel_id_ref = 0;
11247                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11248                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11249         return channel_id_ref;
11250 }
11251 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id(uint64_t ptr) {
11252         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11253         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11254         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11255         memcpy(counterparty_node_id_arr->elems, obj->htlc_resolution.counterparty_node_id.compressed_form, 33);
11256         return counterparty_node_id_arr;
11257 }
11258 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
11259         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11260         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11261         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11262         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11263         return claim_id_arr;
11264 }
11265 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) {
11266         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11267         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11268         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11269         return target_feerate_sat_per_1000_weight_conv;
11270 }
11271 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
11272         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11273         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11274         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11275                         uint64_tArray htlc_descriptors_arr = NULL;
11276                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
11277                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11278                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11279                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11280                                 uint64_t htlc_descriptors_conv_16_ref = 0;
11281                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11282                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11283                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11284                         }
11285                         
11286         return htlc_descriptors_arr;
11287 }
11288 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
11289         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11290         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11291         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11292         return tx_lock_time_conv;
11293 }
11294 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
11295         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11296         switch(obj->tag) {
11297                 case LDKEvent_FundingGenerationReady: return 0;
11298                 case LDKEvent_PaymentClaimable: return 1;
11299                 case LDKEvent_PaymentClaimed: return 2;
11300                 case LDKEvent_ConnectionNeeded: return 3;
11301                 case LDKEvent_InvoiceRequestFailed: return 4;
11302                 case LDKEvent_PaymentSent: return 5;
11303                 case LDKEvent_PaymentFailed: return 6;
11304                 case LDKEvent_PaymentPathSuccessful: return 7;
11305                 case LDKEvent_PaymentPathFailed: return 8;
11306                 case LDKEvent_ProbeSuccessful: return 9;
11307                 case LDKEvent_ProbeFailed: return 10;
11308                 case LDKEvent_PendingHTLCsForwardable: return 11;
11309                 case LDKEvent_HTLCIntercepted: return 12;
11310                 case LDKEvent_SpendableOutputs: return 13;
11311                 case LDKEvent_PaymentForwarded: return 14;
11312                 case LDKEvent_ChannelPending: return 15;
11313                 case LDKEvent_ChannelReady: return 16;
11314                 case LDKEvent_ChannelClosed: return 17;
11315                 case LDKEvent_DiscardFunding: return 18;
11316                 case LDKEvent_OpenChannelRequest: return 19;
11317                 case LDKEvent_HTLCHandlingFailed: return 20;
11318                 case LDKEvent_BumpTransaction: return 21;
11319                 default: abort();
11320         }
11321 }
11322 uint64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
11323         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11324         assert(obj->tag == LDKEvent_FundingGenerationReady);
11325         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
11326                         uint64_t temporary_channel_id_ref = 0;
11327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11328                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11329         return temporary_channel_id_ref;
11330 }
11331 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
11332         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11333         assert(obj->tag == LDKEvent_FundingGenerationReady);
11334         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11335         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11336         return counterparty_node_id_arr;
11337 }
11338 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
11339         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11340         assert(obj->tag == LDKEvent_FundingGenerationReady);
11341         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11342         return channel_value_satoshis_conv;
11343 }
11344 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
11345         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11346         assert(obj->tag == LDKEvent_FundingGenerationReady);
11347         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11348                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11349                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11350         return output_script_arr;
11351 }
11352 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
11353         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11354         assert(obj->tag == LDKEvent_FundingGenerationReady);
11355         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11356         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11357         return user_channel_id_arr;
11358 }
11359 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
11360         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11361         assert(obj->tag == LDKEvent_PaymentClaimable);
11362         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11363         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11364         return receiver_node_id_arr;
11365 }
11366 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
11367         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11368         assert(obj->tag == LDKEvent_PaymentClaimable);
11369         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11370         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
11371         return payment_hash_arr;
11372 }
11373 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
11374         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11375         assert(obj->tag == LDKEvent_PaymentClaimable);
11376         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
11377                         uint64_t onion_fields_ref = 0;
11378                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
11379                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
11380         return onion_fields_ref;
11381 }
11382 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
11383         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11384         assert(obj->tag == LDKEvent_PaymentClaimable);
11385         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
11386         return amount_msat_conv;
11387 }
11388 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
11389         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11390         assert(obj->tag == LDKEvent_PaymentClaimable);
11391         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
11392         return counterparty_skimmed_fee_msat_conv;
11393 }
11394 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
11395         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11396         assert(obj->tag == LDKEvent_PaymentClaimable);
11397         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
11398         return purpose_ref;
11399 }
11400 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
11401         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11402         assert(obj->tag == LDKEvent_PaymentClaimable);
11403         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
11404                         uint64_t via_channel_id_ref = 0;
11405                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
11406                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
11407         return via_channel_id_ref;
11408 }
11409 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
11410         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11411         assert(obj->tag == LDKEvent_PaymentClaimable);
11412         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
11413         return via_user_channel_id_ref;
11414 }
11415 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
11416         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11417         assert(obj->tag == LDKEvent_PaymentClaimable);
11418         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
11419         return claim_deadline_ref;
11420 }
11421 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
11422         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11423         assert(obj->tag == LDKEvent_PaymentClaimed);
11424         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11425         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
11426         return receiver_node_id_arr;
11427 }
11428 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
11429         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11430         assert(obj->tag == LDKEvent_PaymentClaimed);
11431         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11432         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
11433         return payment_hash_arr;
11434 }
11435 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
11436         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11437         assert(obj->tag == LDKEvent_PaymentClaimed);
11438         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
11439         return amount_msat_conv;
11440 }
11441 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
11442         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11443         assert(obj->tag == LDKEvent_PaymentClaimed);
11444         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
11445         return purpose_ref;
11446 }
11447 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_htlcs"))) TS_LDKEvent_PaymentClaimed_get_htlcs(uint64_t ptr) {
11448         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11449         assert(obj->tag == LDKEvent_PaymentClaimed);
11450         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
11451                         uint64_tArray htlcs_arr = NULL;
11452                         htlcs_arr = init_uint64_tArray(htlcs_var.datalen, __LINE__);
11453                         uint64_t *htlcs_arr_ptr = (uint64_t*)(((uint8_t*)htlcs_arr) + 8);
11454                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
11455                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
11456                                 uint64_t htlcs_conv_13_ref = 0;
11457                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
11458                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
11459                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
11460                         }
11461                         
11462         return htlcs_arr;
11463 }
11464 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat"))) TS_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(uint64_t ptr) {
11465         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11466         assert(obj->tag == LDKEvent_PaymentClaimed);
11467         uint64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
11468         return sender_intended_total_msat_ref;
11469 }
11470 int8_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_node_id"))) TS_LDKEvent_ConnectionNeeded_get_node_id(uint64_t ptr) {
11471         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11472         assert(obj->tag == LDKEvent_ConnectionNeeded);
11473         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11474         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
11475         return node_id_arr;
11476 }
11477 uint64_tArray __attribute__((export_name("TS_LDKEvent_ConnectionNeeded_get_addresses"))) TS_LDKEvent_ConnectionNeeded_get_addresses(uint64_t ptr) {
11478         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11479         assert(obj->tag == LDKEvent_ConnectionNeeded);
11480         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
11481                         uint64_tArray addresses_arr = NULL;
11482                         addresses_arr = init_uint64_tArray(addresses_var.datalen, __LINE__);
11483                         uint64_t *addresses_arr_ptr = (uint64_t*)(((uint8_t*)addresses_arr) + 8);
11484                         for (size_t p = 0; p < addresses_var.datalen; p++) {
11485                                 uint64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
11486                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
11487                         }
11488                         
11489         return addresses_arr;
11490 }
11491 int8_tArray __attribute__((export_name("TS_LDKEvent_InvoiceRequestFailed_get_payment_id"))) TS_LDKEvent_InvoiceRequestFailed_get_payment_id(uint64_t ptr) {
11492         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11493         assert(obj->tag == LDKEvent_InvoiceRequestFailed);
11494         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11495         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
11496         return payment_id_arr;
11497 }
11498 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
11499         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11500         assert(obj->tag == LDKEvent_PaymentSent);
11501         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
11502         return payment_id_ref;
11503 }
11504 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
11505         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11506         assert(obj->tag == LDKEvent_PaymentSent);
11507         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11508         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
11509         return payment_preimage_arr;
11510 }
11511 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
11512         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11513         assert(obj->tag == LDKEvent_PaymentSent);
11514         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11515         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
11516         return payment_hash_arr;
11517 }
11518 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
11519         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11520         assert(obj->tag == LDKEvent_PaymentSent);
11521         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
11522         return fee_paid_msat_ref;
11523 }
11524 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
11525         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11526         assert(obj->tag == LDKEvent_PaymentFailed);
11527         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11528         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
11529         return payment_id_arr;
11530 }
11531 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
11532         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11533         assert(obj->tag == LDKEvent_PaymentFailed);
11534         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11535         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
11536         return payment_hash_arr;
11537 }
11538 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
11539         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11540         assert(obj->tag == LDKEvent_PaymentFailed);
11541         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
11542         return reason_ref;
11543 }
11544 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
11545         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11546         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11547         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11548         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
11549         return payment_id_arr;
11550 }
11551 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
11552         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11553         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11554         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
11555         return payment_hash_ref;
11556 }
11557 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
11558         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11559         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
11560         LDKPath path_var = obj->payment_path_successful.path;
11561                         uint64_t path_ref = 0;
11562                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11563                         path_ref = tag_ptr(path_var.inner, false);
11564         return path_ref;
11565 }
11566 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
11567         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11568         assert(obj->tag == LDKEvent_PaymentPathFailed);
11569         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
11570         return payment_id_ref;
11571 }
11572 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
11573         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11574         assert(obj->tag == LDKEvent_PaymentPathFailed);
11575         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11576         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
11577         return payment_hash_arr;
11578 }
11579 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
11580         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11581         assert(obj->tag == LDKEvent_PaymentPathFailed);
11582         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
11583         return payment_failed_permanently_conv;
11584 }
11585 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
11586         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11587         assert(obj->tag == LDKEvent_PaymentPathFailed);
11588         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
11589         return failure_ref;
11590 }
11591 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
11592         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11593         assert(obj->tag == LDKEvent_PaymentPathFailed);
11594         LDKPath path_var = obj->payment_path_failed.path;
11595                         uint64_t path_ref = 0;
11596                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11597                         path_ref = tag_ptr(path_var.inner, false);
11598         return path_ref;
11599 }
11600 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
11601         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11602         assert(obj->tag == LDKEvent_PaymentPathFailed);
11603         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
11604         return short_channel_id_ref;
11605 }
11606 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
11607         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11608         assert(obj->tag == LDKEvent_ProbeSuccessful);
11609         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11610         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
11611         return payment_id_arr;
11612 }
11613 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
11614         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11615         assert(obj->tag == LDKEvent_ProbeSuccessful);
11616         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11617         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
11618         return payment_hash_arr;
11619 }
11620 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
11621         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11622         assert(obj->tag == LDKEvent_ProbeSuccessful);
11623         LDKPath path_var = obj->probe_successful.path;
11624                         uint64_t path_ref = 0;
11625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11626                         path_ref = tag_ptr(path_var.inner, false);
11627         return path_ref;
11628 }
11629 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
11630         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11631         assert(obj->tag == LDKEvent_ProbeFailed);
11632         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11633         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
11634         return payment_id_arr;
11635 }
11636 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
11637         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11638         assert(obj->tag == LDKEvent_ProbeFailed);
11639         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11640         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
11641         return payment_hash_arr;
11642 }
11643 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
11644         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11645         assert(obj->tag == LDKEvent_ProbeFailed);
11646         LDKPath path_var = obj->probe_failed.path;
11647                         uint64_t path_ref = 0;
11648                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11649                         path_ref = tag_ptr(path_var.inner, false);
11650         return path_ref;
11651 }
11652 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
11653         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11654         assert(obj->tag == LDKEvent_ProbeFailed);
11655         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
11656         return short_channel_id_ref;
11657 }
11658 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
11659         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11660         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
11661         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
11662         return time_forwardable_conv;
11663 }
11664 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
11665         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11666         assert(obj->tag == LDKEvent_HTLCIntercepted);
11667         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
11668         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
11669         return intercept_id_arr;
11670 }
11671 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
11672         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11673         assert(obj->tag == LDKEvent_HTLCIntercepted);
11674         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
11675         return requested_next_hop_scid_conv;
11676 }
11677 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
11678         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11679         assert(obj->tag == LDKEvent_HTLCIntercepted);
11680         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11681         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
11682         return payment_hash_arr;
11683 }
11684 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
11685         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11686         assert(obj->tag == LDKEvent_HTLCIntercepted);
11687         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
11688         return inbound_amount_msat_conv;
11689 }
11690 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
11691         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11692         assert(obj->tag == LDKEvent_HTLCIntercepted);
11693         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
11694         return expected_outbound_amount_msat_conv;
11695 }
11696 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
11697         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11698         assert(obj->tag == LDKEvent_SpendableOutputs);
11699         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
11700                         uint64_tArray outputs_arr = NULL;
11701                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
11702                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
11703                         for (size_t b = 0; b < outputs_var.datalen; b++) {
11704                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
11705                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
11706                         }
11707                         
11708         return outputs_arr;
11709 }
11710 uint64_t __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_channel_id"))) TS_LDKEvent_SpendableOutputs_get_channel_id(uint64_t ptr) {
11711         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11712         assert(obj->tag == LDKEvent_SpendableOutputs);
11713         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
11714                         uint64_t channel_id_ref = 0;
11715                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11716                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11717         return channel_id_ref;
11718 }
11719 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
11720         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11721         assert(obj->tag == LDKEvent_PaymentForwarded);
11722         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
11723                         uint64_t prev_channel_id_ref = 0;
11724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
11725                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
11726         return prev_channel_id_ref;
11727 }
11728 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
11729         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11730         assert(obj->tag == LDKEvent_PaymentForwarded);
11731         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
11732                         uint64_t next_channel_id_ref = 0;
11733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
11734                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
11735         return next_channel_id_ref;
11736 }
11737 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_user_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_user_channel_id(uint64_t ptr) {
11738         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11739         assert(obj->tag == LDKEvent_PaymentForwarded);
11740         uint64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
11741         return prev_user_channel_id_ref;
11742 }
11743 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_user_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_user_channel_id(uint64_t ptr) {
11744         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11745         assert(obj->tag == LDKEvent_PaymentForwarded);
11746         uint64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
11747         return next_user_channel_id_ref;
11748 }
11749 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_total_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_total_fee_earned_msat(uint64_t ptr) {
11750         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11751         assert(obj->tag == LDKEvent_PaymentForwarded);
11752         uint64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
11753         return total_fee_earned_msat_ref;
11754 }
11755 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_skimmed_fee_msat"))) TS_LDKEvent_PaymentForwarded_get_skimmed_fee_msat(uint64_t ptr) {
11756         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11757         assert(obj->tag == LDKEvent_PaymentForwarded);
11758         uint64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
11759         return skimmed_fee_msat_ref;
11760 }
11761 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
11762         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11763         assert(obj->tag == LDKEvent_PaymentForwarded);
11764         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
11765         return claim_from_onchain_tx_conv;
11766 }
11767 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
11768         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11769         assert(obj->tag == LDKEvent_PaymentForwarded);
11770         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
11771         return outbound_amount_forwarded_msat_ref;
11772 }
11773 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
11774         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11775         assert(obj->tag == LDKEvent_ChannelPending);
11776         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
11777                         uint64_t channel_id_ref = 0;
11778                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11779                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11780         return channel_id_ref;
11781 }
11782 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
11783         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11784         assert(obj->tag == LDKEvent_ChannelPending);
11785         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11786         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
11787         return user_channel_id_arr;
11788 }
11789 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
11790         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11791         assert(obj->tag == LDKEvent_ChannelPending);
11792         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
11793                         uint64_t former_temporary_channel_id_ref = 0;
11794                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
11795                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
11796         return former_temporary_channel_id_ref;
11797 }
11798 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
11799         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11800         assert(obj->tag == LDKEvent_ChannelPending);
11801         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11802         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
11803         return counterparty_node_id_arr;
11804 }
11805 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
11806         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11807         assert(obj->tag == LDKEvent_ChannelPending);
11808         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
11809                         uint64_t funding_txo_ref = 0;
11810                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
11811                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
11812         return funding_txo_ref;
11813 }
11814 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_type"))) TS_LDKEvent_ChannelPending_get_channel_type(uint64_t ptr) {
11815         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11816         assert(obj->tag == LDKEvent_ChannelPending);
11817         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
11818                         uint64_t channel_type_ref = 0;
11819                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11820                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11821         return channel_type_ref;
11822 }
11823 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
11824         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11825         assert(obj->tag == LDKEvent_ChannelReady);
11826         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
11827                         uint64_t channel_id_ref = 0;
11828                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11829                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11830         return channel_id_ref;
11831 }
11832 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
11833         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11834         assert(obj->tag == LDKEvent_ChannelReady);
11835         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11836         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
11837         return user_channel_id_arr;
11838 }
11839 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
11840         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11841         assert(obj->tag == LDKEvent_ChannelReady);
11842         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11843         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
11844         return counterparty_node_id_arr;
11845 }
11846 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
11847         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11848         assert(obj->tag == LDKEvent_ChannelReady);
11849         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
11850                         uint64_t channel_type_ref = 0;
11851                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11852                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11853         return channel_type_ref;
11854 }
11855 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
11856         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11857         assert(obj->tag == LDKEvent_ChannelClosed);
11858         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
11859                         uint64_t channel_id_ref = 0;
11860                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11861                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11862         return channel_id_ref;
11863 }
11864 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
11865         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11866         assert(obj->tag == LDKEvent_ChannelClosed);
11867         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11868         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
11869         return user_channel_id_arr;
11870 }
11871 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
11872         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11873         assert(obj->tag == LDKEvent_ChannelClosed);
11874         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
11875         return reason_ref;
11876 }
11877 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_counterparty_node_id"))) TS_LDKEvent_ChannelClosed_get_counterparty_node_id(uint64_t ptr) {
11878         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11879         assert(obj->tag == LDKEvent_ChannelClosed);
11880         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11881         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
11882         return counterparty_node_id_arr;
11883 }
11884 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_capacity_sats"))) TS_LDKEvent_ChannelClosed_get_channel_capacity_sats(uint64_t ptr) {
11885         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11886         assert(obj->tag == LDKEvent_ChannelClosed);
11887         uint64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
11888         return channel_capacity_sats_ref;
11889 }
11890 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_funding_txo"))) TS_LDKEvent_ChannelClosed_get_channel_funding_txo(uint64_t ptr) {
11891         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11892         assert(obj->tag == LDKEvent_ChannelClosed);
11893         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
11894                         uint64_t channel_funding_txo_ref = 0;
11895                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
11896                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
11897         return channel_funding_txo_ref;
11898 }
11899 uint64_t __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
11900         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11901         assert(obj->tag == LDKEvent_DiscardFunding);
11902         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
11903                         uint64_t channel_id_ref = 0;
11904                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11905                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11906         return channel_id_ref;
11907 }
11908 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
11909         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11910         assert(obj->tag == LDKEvent_DiscardFunding);
11911         LDKTransaction transaction_var = obj->discard_funding.transaction;
11912                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
11913                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
11914         return transaction_arr;
11915 }
11916 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
11917         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11918         assert(obj->tag == LDKEvent_OpenChannelRequest);
11919         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
11920                         uint64_t temporary_channel_id_ref = 0;
11921                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11922                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11923         return temporary_channel_id_ref;
11924 }
11925 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
11926         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11927         assert(obj->tag == LDKEvent_OpenChannelRequest);
11928         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11929         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
11930         return counterparty_node_id_arr;
11931 }
11932 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
11933         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11934         assert(obj->tag == LDKEvent_OpenChannelRequest);
11935         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
11936         return funding_satoshis_conv;
11937 }
11938 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
11939         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11940         assert(obj->tag == LDKEvent_OpenChannelRequest);
11941         int64_t push_msat_conv = obj->open_channel_request.push_msat;
11942         return push_msat_conv;
11943 }
11944 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
11945         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11946         assert(obj->tag == LDKEvent_OpenChannelRequest);
11947         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11948                         uint64_t channel_type_ref = 0;
11949                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11950                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11951         return channel_type_ref;
11952 }
11953 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
11954         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11955         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11956         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
11957                         uint64_t prev_channel_id_ref = 0;
11958                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
11959                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
11960         return prev_channel_id_ref;
11961 }
11962 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
11963         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11964         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
11965         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11966         return failed_next_destination_ref;
11967 }
11968 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
11969         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11970         assert(obj->tag == LDKEvent_BumpTransaction);
11971         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11972         return bump_transaction_ref;
11973 }
11974 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
11975         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11976         switch(obj->tag) {
11977                 case LDKCOption_EventZ_Some: return 0;
11978                 case LDKCOption_EventZ_None: return 1;
11979                 default: abort();
11980         }
11981 }
11982 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
11983         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11984         assert(obj->tag == LDKCOption_EventZ_Some);
11985         uint64_t some_ref = tag_ptr(&obj->some, false);
11986         return some_ref;
11987 }
11988 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11989 CHECK(owner->result_ok);
11990         return COption_EventZ_clone(&*owner->contents.result);
11991 }
11992 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
11993         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11994         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11995         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11996         uint64_t ret_ref = tag_ptr(ret_copy, true);
11997         return ret_ref;
11998 }
11999
12000 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12001 CHECK(!owner->result_ok);
12002         return DecodeError_clone(&*owner->contents.err);
12003 }
12004 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
12005         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12006         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12007         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
12008         uint64_t ret_ref = tag_ptr(ret_copy, true);
12009         return ret_ref;
12010 }
12011
12012 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
12013         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12014         switch(obj->tag) {
12015                 case LDKBolt11ParseError_Bech32Error: return 0;
12016                 case LDKBolt11ParseError_ParseAmountError: return 1;
12017                 case LDKBolt11ParseError_MalformedSignature: return 2;
12018                 case LDKBolt11ParseError_BadPrefix: return 3;
12019                 case LDKBolt11ParseError_UnknownCurrency: return 4;
12020                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
12021                 case LDKBolt11ParseError_MalformedHRP: return 6;
12022                 case LDKBolt11ParseError_TooShortDataPart: return 7;
12023                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
12024                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
12025                 case LDKBolt11ParseError_PaddingError: return 10;
12026                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
12027                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
12028                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
12029                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
12030                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
12031                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
12032                 case LDKBolt11ParseError_Skip: return 17;
12033                 default: abort();
12034         }
12035 }
12036 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
12037         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12038         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
12039         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
12040         return bech32_error_ref;
12041 }
12042 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
12043         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12044         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
12045         /*obj->parse_amount_error*/
12046         return 0;
12047 }
12048 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
12049         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12050         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
12051         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
12052         return malformed_signature_conv;
12053 }
12054 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
12055         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12056         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
12057         /*obj->description_decode_error*/
12058         return 0;
12059 }
12060 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
12061         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12062         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
12063         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
12064                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
12065         return invalid_slice_length_conv;
12066 }
12067 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12068 CHECK(owner->result_ok);
12069         return SiPrefix_clone(&*owner->contents.result);
12070 }
12071 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
12072         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12073         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
12074         return ret_conv;
12075 }
12076
12077 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12078 CHECK(!owner->result_ok);
12079         return Bolt11ParseError_clone(&*owner->contents.err);
12080 }
12081 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
12082         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12083         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12084         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
12085         uint64_t ret_ref = tag_ptr(ret_copy, true);
12086         return ret_ref;
12087 }
12088
12089 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
12090         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12091         switch(obj->tag) {
12092                 case LDKParseOrSemanticError_ParseError: return 0;
12093                 case LDKParseOrSemanticError_SemanticError: return 1;
12094                 default: abort();
12095         }
12096 }
12097 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
12098         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12099         assert(obj->tag == LDKParseOrSemanticError_ParseError);
12100         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
12101         return parse_error_ref;
12102 }
12103 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
12104         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12105         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
12106         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
12107         return semantic_error_conv;
12108 }
12109 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12110         LDKBolt11Invoice ret = *owner->contents.result;
12111         ret.is_owned = false;
12112         return ret;
12113 }
12114 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
12115         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12116         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
12117         uint64_t ret_ref = 0;
12118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12120         return ret_ref;
12121 }
12122
12123 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12124 CHECK(!owner->result_ok);
12125         return ParseOrSemanticError_clone(&*owner->contents.err);
12126 }
12127 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
12128         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12129         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
12130         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
12131         uint64_t ret_ref = tag_ptr(ret_copy, true);
12132         return ret_ref;
12133 }
12134
12135 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12136         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
12137         ret.is_owned = false;
12138         return ret;
12139 }
12140 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
12141         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12142         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
12143         uint64_t ret_ref = 0;
12144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12146         return ret_ref;
12147 }
12148
12149 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12150 CHECK(!owner->result_ok);
12151         return Bolt11ParseError_clone(&*owner->contents.err);
12152 }
12153 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
12154         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12155         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12156         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
12157         uint64_t ret_ref = tag_ptr(ret_copy, true);
12158         return ret_ref;
12159 }
12160
12161 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12162         LDKRawBolt11Invoice ret = owner->a;
12163         ret.is_owned = false;
12164         return ret;
12165 }
12166 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
12167         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12168         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
12169         uint64_t ret_ref = 0;
12170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12172         return ret_ref;
12173 }
12174
12175 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12176         return ThirtyTwoBytes_clone(&owner->b);
12177 }
12178 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
12179         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12180         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12181         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
12182         return ret_arr;
12183 }
12184
12185 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12186         LDKBolt11InvoiceSignature ret = owner->c;
12187         ret.is_owned = false;
12188         return ret;
12189 }
12190 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
12191         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12192         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12193         uint64_t ret_ref = 0;
12194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12196         return ret_ref;
12197 }
12198
12199 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12200         LDKPayeePubKey ret = *owner->contents.result;
12201         ret.is_owned = false;
12202         return ret;
12203 }
12204 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(uint64_t owner) {
12205         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12206         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
12207         uint64_t ret_ref = 0;
12208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12210         return ret_ref;
12211 }
12212
12213 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12214 CHECK(!owner->result_ok);
12215         return *owner->contents.err;
12216 }
12217 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_get_err(uint64_t owner) {
12218         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12219         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
12220         return ret_conv;
12221 }
12222
12223 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
12224         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
12225         for (size_t i = 0; i < ret.datalen; i++) {
12226                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
12227         }
12228         return ret;
12229 }
12230 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12231         LDKPositiveTimestamp ret = *owner->contents.result;
12232         ret.is_owned = false;
12233         return ret;
12234 }
12235 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
12236         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12237         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
12238         uint64_t ret_ref = 0;
12239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12241         return ret_ref;
12242 }
12243
12244 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12245 CHECK(!owner->result_ok);
12246         return CreationError_clone(&*owner->contents.err);
12247 }
12248 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
12249         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12250         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
12251         return ret_conv;
12252 }
12253
12254 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12255 CHECK(owner->result_ok);
12256         return *owner->contents.result;
12257 }
12258 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
12259         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12260         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
12261 }
12262
12263 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12264 CHECK(!owner->result_ok);
12265         return Bolt11SemanticError_clone(&*owner->contents.err);
12266 }
12267 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
12268         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12269         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
12270         return ret_conv;
12271 }
12272
12273 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12274         LDKBolt11Invoice ret = *owner->contents.result;
12275         ret.is_owned = false;
12276         return ret;
12277 }
12278 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
12279         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12280         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
12281         uint64_t ret_ref = 0;
12282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12284         return ret_ref;
12285 }
12286
12287 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12288 CHECK(!owner->result_ok);
12289         return Bolt11SemanticError_clone(&*owner->contents.err);
12290 }
12291 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
12292         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12293         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
12294         return ret_conv;
12295 }
12296
12297 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12298         LDKDescription ret = *owner->contents.result;
12299         ret.is_owned = false;
12300         return ret;
12301 }
12302 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
12303         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12304         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
12305         uint64_t ret_ref = 0;
12306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12308         return ret_ref;
12309 }
12310
12311 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12312 CHECK(!owner->result_ok);
12313         return CreationError_clone(&*owner->contents.err);
12314 }
12315 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
12316         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12317         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12318         return ret_conv;
12319 }
12320
12321 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12322         LDKPrivateRoute ret = *owner->contents.result;
12323         ret.is_owned = false;
12324         return ret;
12325 }
12326 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
12327         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12328         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12329         uint64_t ret_ref = 0;
12330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12332         return ret_ref;
12333 }
12334
12335 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12336 CHECK(!owner->result_ok);
12337         return CreationError_clone(&*owner->contents.err);
12338 }
12339 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
12340         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12341         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12342         return ret_conv;
12343 }
12344
12345 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12346         LDKOutPoint ret = *owner->contents.result;
12347         ret.is_owned = false;
12348         return ret;
12349 }
12350 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
12351         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12352         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12353         uint64_t ret_ref = 0;
12354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12356         return ret_ref;
12357 }
12358
12359 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12360 CHECK(!owner->result_ok);
12361         return DecodeError_clone(&*owner->contents.err);
12362 }
12363 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
12364         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12366         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12367         uint64_t ret_ref = tag_ptr(ret_copy, true);
12368         return ret_ref;
12369 }
12370
12371 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12372         LDKBigSize ret = *owner->contents.result;
12373         ret.is_owned = false;
12374         return ret;
12375 }
12376 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
12377         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12378         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
12379         uint64_t ret_ref = 0;
12380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12382         return ret_ref;
12383 }
12384
12385 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12386 CHECK(!owner->result_ok);
12387         return DecodeError_clone(&*owner->contents.err);
12388 }
12389 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
12390         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12392         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
12393         uint64_t ret_ref = tag_ptr(ret_copy, true);
12394         return ret_ref;
12395 }
12396
12397 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12398         LDKHostname ret = *owner->contents.result;
12399         ret.is_owned = false;
12400         return ret;
12401 }
12402 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
12403         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12404         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
12405         uint64_t ret_ref = 0;
12406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12408         return ret_ref;
12409 }
12410
12411 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12412 CHECK(!owner->result_ok);
12413         return DecodeError_clone(&*owner->contents.err);
12414 }
12415 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
12416         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12417         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12418         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
12419         uint64_t ret_ref = tag_ptr(ret_copy, true);
12420         return ret_ref;
12421 }
12422
12423 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12424         LDKTransactionU16LenLimited ret = *owner->contents.result;
12425         ret.is_owned = false;
12426         return ret;
12427 }
12428 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
12429         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12430         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
12431         uint64_t ret_ref = 0;
12432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12434         return ret_ref;
12435 }
12436
12437 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12438 CHECK(!owner->result_ok);
12439         return *owner->contents.err;
12440 }
12441 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
12442         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12443         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
12444 }
12445
12446 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12447         LDKTransactionU16LenLimited ret = *owner->contents.result;
12448         ret.is_owned = false;
12449         return ret;
12450 }
12451 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
12452         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12453         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
12454         uint64_t ret_ref = 0;
12455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12457         return ret_ref;
12458 }
12459
12460 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12461 CHECK(!owner->result_ok);
12462         return DecodeError_clone(&*owner->contents.err);
12463 }
12464 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
12465         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12466         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12467         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
12468         uint64_t ret_ref = tag_ptr(ret_copy, true);
12469         return ret_ref;
12470 }
12471
12472 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12473         LDKUntrustedString ret = *owner->contents.result;
12474         ret.is_owned = false;
12475         return ret;
12476 }
12477 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
12478         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12479         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
12480         uint64_t ret_ref = 0;
12481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12483         return ret_ref;
12484 }
12485
12486 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12487 CHECK(!owner->result_ok);
12488         return DecodeError_clone(&*owner->contents.err);
12489 }
12490 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
12491         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12492         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12493         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
12494         uint64_t ret_ref = tag_ptr(ret_copy, true);
12495         return ret_ref;
12496 }
12497
12498 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12499         LDKChannelId ret = *owner->contents.result;
12500         ret.is_owned = false;
12501         return ret;
12502 }
12503 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_get_ok"))) TS_CResult_ChannelIdDecodeErrorZ_get_ok(uint64_t owner) {
12504         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12505         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
12506         uint64_t ret_ref = 0;
12507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12509         return ret_ref;
12510 }
12511
12512 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12513 CHECK(!owner->result_ok);
12514         return DecodeError_clone(&*owner->contents.err);
12515 }
12516 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_get_err"))) TS_CResult_ChannelIdDecodeErrorZ_get_err(uint64_t owner) {
12517         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12518         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12519         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
12520         uint64_t ret_ref = tag_ptr(ret_copy, true);
12521         return ret_ref;
12522 }
12523
12524 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12525         return ThirtyTwoBytes_clone(&owner->a);
12526 }
12527 int8_tArray  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_a"))) TS_C2Tuple__u832u16Z_get_a(uint64_t owner) {
12528         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12529         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12530         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
12531         return ret_arr;
12532 }
12533
12534 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12535         return owner->b;
12536 }
12537 int16_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_get_b"))) TS_C2Tuple__u832u16Z_get_b(uint64_t owner) {
12538         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12539         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
12540         return ret_conv;
12541 }
12542
12543 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12544         LDKPaymentRelay ret = *owner->contents.result;
12545         ret.is_owned = false;
12546         return ret;
12547 }
12548 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_get_ok(uint64_t owner) {
12549         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12550         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
12551         uint64_t ret_ref = 0;
12552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12554         return ret_ref;
12555 }
12556
12557 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12558 CHECK(!owner->result_ok);
12559         return DecodeError_clone(&*owner->contents.err);
12560 }
12561 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_get_err"))) TS_CResult_PaymentRelayDecodeErrorZ_get_err(uint64_t owner) {
12562         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12563         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12564         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
12565         uint64_t ret_ref = tag_ptr(ret_copy, true);
12566         return ret_ref;
12567 }
12568
12569 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12570         LDKPaymentConstraints ret = *owner->contents.result;
12571         ret.is_owned = false;
12572         return ret;
12573 }
12574 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_ok(uint64_t owner) {
12575         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12576         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
12577         uint64_t ret_ref = 0;
12578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12580         return ret_ref;
12581 }
12582
12583 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12584 CHECK(!owner->result_ok);
12585         return DecodeError_clone(&*owner->contents.err);
12586 }
12587 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_get_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_get_err(uint64_t owner) {
12588         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12590         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
12591         uint64_t ret_ref = tag_ptr(ret_copy, true);
12592         return ret_ref;
12593 }
12594
12595 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
12596 CHECK(owner->result_ok);
12597         return PaymentContext_clone(&*owner->contents.result);
12598 }
12599 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_get_ok"))) TS_CResult_PaymentContextDecodeErrorZ_get_ok(uint64_t owner) {
12600         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
12601         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
12602         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
12603         uint64_t ret_ref = tag_ptr(ret_copy, true);
12604         return ret_ref;
12605 }
12606
12607 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
12608 CHECK(!owner->result_ok);
12609         return DecodeError_clone(&*owner->contents.err);
12610 }
12611 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_get_err"))) TS_CResult_PaymentContextDecodeErrorZ_get_err(uint64_t owner) {
12612         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
12613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12614         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
12615         uint64_t ret_ref = tag_ptr(ret_copy, true);
12616         return ret_ref;
12617 }
12618
12619 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
12620         LDKUnknownPaymentContext ret = *owner->contents.result;
12621         ret.is_owned = false;
12622         return ret;
12623 }
12624 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_get_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_get_ok(uint64_t owner) {
12625         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
12626         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
12627         uint64_t ret_ref = 0;
12628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12630         return ret_ref;
12631 }
12632
12633 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
12634 CHECK(!owner->result_ok);
12635         return DecodeError_clone(&*owner->contents.err);
12636 }
12637 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_get_err"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_get_err(uint64_t owner) {
12638         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
12639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12640         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
12641         uint64_t ret_ref = tag_ptr(ret_copy, true);
12642         return ret_ref;
12643 }
12644
12645 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
12646         LDKBolt12OfferContext ret = *owner->contents.result;
12647         ret.is_owned = false;
12648         return ret;
12649 }
12650 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_get_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_get_ok(uint64_t owner) {
12651         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
12652         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
12653         uint64_t ret_ref = 0;
12654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12656         return ret_ref;
12657 }
12658
12659 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
12660 CHECK(!owner->result_ok);
12661         return DecodeError_clone(&*owner->contents.err);
12662 }
12663 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_get_err"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_get_err(uint64_t owner) {
12664         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
12665         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12666         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
12667         uint64_t ret_ref = tag_ptr(ret_copy, true);
12668         return ret_ref;
12669 }
12670
12671 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
12672         LDKBolt12RefundContext ret = *owner->contents.result;
12673         ret.is_owned = false;
12674         return ret;
12675 }
12676 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_get_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_get_ok(uint64_t owner) {
12677         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
12678         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
12679         uint64_t ret_ref = 0;
12680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12682         return ret_ref;
12683 }
12684
12685 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
12686 CHECK(!owner->result_ok);
12687         return DecodeError_clone(&*owner->contents.err);
12688 }
12689 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_get_err"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_get_err(uint64_t owner) {
12690         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
12691         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12692         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
12693         uint64_t ret_ref = tag_ptr(ret_copy, true);
12694         return ret_ref;
12695 }
12696
12697 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12698 CHECK(owner->result_ok);
12699         return *owner->contents.result;
12700 }
12701 jstring  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_ok"))) TS_CResult_StrSecp256k1ErrorZ_get_ok(uint64_t owner) {
12702         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12703         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
12704         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
12705         return ret_conv;
12706 }
12707
12708 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12709 CHECK(!owner->result_ok);
12710         return *owner->contents.err;
12711 }
12712 uint32_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_get_err"))) TS_CResult_StrSecp256k1ErrorZ_get_err(uint64_t owner) {
12713         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12714         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
12715         return ret_conv;
12716 }
12717
12718 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12719         return ThirtyTwoBytes_clone(&owner->a);
12720 }
12721 int8_tArray  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(uint64_t owner) {
12722         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12723         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12724         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
12725         return ret_arr;
12726 }
12727
12728 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12729         LDKRecipientOnionFields ret = owner->b;
12730         ret.is_owned = false;
12731         return ret;
12732 }
12733 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(uint64_t owner) {
12734         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12735         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
12736         uint64_t ret_ref = 0;
12737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12739         return ret_ref;
12740 }
12741
12742 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12743         LDKRouteParameters ret = owner->c;
12744         ret.is_owned = false;
12745         return ret;
12746 }
12747 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(uint64_t owner) {
12748         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12749         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
12750         uint64_t ret_ref = 0;
12751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12753         return ret_ref;
12754 }
12755
12756 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12757 CHECK(owner->result_ok);
12758         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
12759 }
12760 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(uint64_t owner) {
12761         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12762         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
12763         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
12764         return tag_ptr(ret_conv, true);
12765 }
12766
12767 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12768 CHECK(!owner->result_ok);
12769         return *owner->contents.err;
12770 }
12771 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(uint64_t owner) {
12772         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12773         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
12774 }
12775
12776 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12777         return owner->a;
12778 }
12779 int8_tArray  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(uint64_t owner) {
12780         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12781         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
12782         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
12783         return ret_arr;
12784 }
12785
12786 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12787         LDKOnionMessage ret = owner->b;
12788         ret.is_owned = false;
12789         return ret;
12790 }
12791 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(uint64_t owner) {
12792         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12793         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
12794         uint64_t ret_ref = 0;
12795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12797         return ret_ref;
12798 }
12799
12800 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12801         return COption_CVec_SocketAddressZZ_clone(&owner->c);
12802 }
12803 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(uint64_t owner) {
12804         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12805         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
12806         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
12807         uint64_t ret_ref = tag_ptr(ret_copy, true);
12808         return ret_ref;
12809 }
12810
12811 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
12812         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12813         switch(obj->tag) {
12814                 case LDKSendError_Secp256k1: return 0;
12815                 case LDKSendError_TooBigPacket: return 1;
12816                 case LDKSendError_TooFewBlindedHops: return 2;
12817                 case LDKSendError_InvalidFirstHop: return 3;
12818                 case LDKSendError_PathNotFound: return 4;
12819                 case LDKSendError_InvalidMessage: return 5;
12820                 case LDKSendError_BufferFull: return 6;
12821                 case LDKSendError_GetNodeIdFailed: return 7;
12822                 case LDKSendError_UnresolvedIntroductionNode: return 8;
12823                 case LDKSendError_BlindedPathAdvanceFailed: return 9;
12824                 default: abort();
12825         }
12826 }
12827 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
12828         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12829         assert(obj->tag == LDKSendError_Secp256k1);
12830         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
12831         return secp256k1_conv;
12832 }
12833 int8_tArray __attribute__((export_name("TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop"))) TS_LDKSendError_InvalidFirstHop_get_invalid_first_hop(uint64_t ptr) {
12834         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12835         assert(obj->tag == LDKSendError_InvalidFirstHop);
12836         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
12837         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
12838         return invalid_first_hop_arr;
12839 }
12840 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12841 CHECK(owner->result_ok);
12842         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
12843 }
12844 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(uint64_t owner) {
12845         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12846         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
12847         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
12848         return tag_ptr(ret_conv, true);
12849 }
12850
12851 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12852 CHECK(!owner->result_ok);
12853         return SendError_clone(&*owner->contents.err);
12854 }
12855 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(uint64_t owner) {
12856         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12857         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12858         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
12859         uint64_t ret_ref = tag_ptr(ret_copy, true);
12860         return ret_ref;
12861 }
12862
12863 uint32_t __attribute__((export_name("TS_LDKNextMessageHop_ty_from_ptr"))) TS_LDKNextMessageHop_ty_from_ptr(uint64_t ptr) {
12864         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12865         switch(obj->tag) {
12866                 case LDKNextMessageHop_NodeId: return 0;
12867                 case LDKNextMessageHop_ShortChannelId: return 1;
12868                 default: abort();
12869         }
12870 }
12871 int8_tArray __attribute__((export_name("TS_LDKNextMessageHop_NodeId_get_node_id"))) TS_LDKNextMessageHop_NodeId_get_node_id(uint64_t ptr) {
12872         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12873         assert(obj->tag == LDKNextMessageHop_NodeId);
12874         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
12875         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
12876         return node_id_arr;
12877 }
12878 int64_t __attribute__((export_name("TS_LDKNextMessageHop_ShortChannelId_get_short_channel_id"))) TS_LDKNextMessageHop_ShortChannelId_get_short_channel_id(uint64_t ptr) {
12879         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
12880         assert(obj->tag == LDKNextMessageHop_ShortChannelId);
12881         int64_t short_channel_id_conv = obj->short_channel_id;
12882         return short_channel_id_conv;
12883 }
12884 uint32_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_ty_from_ptr"))) TS_LDKParsedOnionMessageContents_ty_from_ptr(uint64_t ptr) {
12885         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12886         switch(obj->tag) {
12887                 case LDKParsedOnionMessageContents_Offers: return 0;
12888                 case LDKParsedOnionMessageContents_Custom: return 1;
12889                 default: abort();
12890         }
12891 }
12892 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Offers_get_offers"))) TS_LDKParsedOnionMessageContents_Offers_get_offers(uint64_t ptr) {
12893         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12894         assert(obj->tag == LDKParsedOnionMessageContents_Offers);
12895         uint64_t offers_ref = tag_ptr(&obj->offers, false);
12896         return offers_ref;
12897 }
12898 uint64_t __attribute__((export_name("TS_LDKParsedOnionMessageContents_Custom_get_custom"))) TS_LDKParsedOnionMessageContents_Custom_get_custom(uint64_t ptr) {
12899         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12900         assert(obj->tag == LDKParsedOnionMessageContents_Custom);
12901         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
12902         *custom_ret = OnionMessageContents_clone(&obj->custom);
12903         return tag_ptr(custom_ret, true);
12904 }
12905 uint32_t __attribute__((export_name("TS_LDKPeeledOnion_ty_from_ptr"))) TS_LDKPeeledOnion_ty_from_ptr(uint64_t ptr) {
12906         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12907         switch(obj->tag) {
12908                 case LDKPeeledOnion_Forward: return 0;
12909                 case LDKPeeledOnion_Receive: return 1;
12910                 default: abort();
12911         }
12912 }
12913 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__0"))) TS_LDKPeeledOnion_Forward_get__0(uint64_t ptr) {
12914         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12915         assert(obj->tag == LDKPeeledOnion_Forward);
12916         uint64_t _0_ref = tag_ptr(&obj->forward._0, false);
12917         return _0_ref;
12918 }
12919 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Forward_get__1"))) TS_LDKPeeledOnion_Forward_get__1(uint64_t ptr) {
12920         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12921         assert(obj->tag == LDKPeeledOnion_Forward);
12922         LDKOnionMessage _1_var = obj->forward._1;
12923                         uint64_t _1_ref = 0;
12924                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
12925                         _1_ref = tag_ptr(_1_var.inner, false);
12926         return _1_ref;
12927 }
12928 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__0"))) TS_LDKPeeledOnion_Receive_get__0(uint64_t ptr) {
12929         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12930         assert(obj->tag == LDKPeeledOnion_Receive);
12931         uint64_t _0_ref = tag_ptr(&obj->receive._0, false);
12932         return _0_ref;
12933 }
12934 int8_tArray __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__1"))) TS_LDKPeeledOnion_Receive_get__1(uint64_t ptr) {
12935         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12936         assert(obj->tag == LDKPeeledOnion_Receive);
12937         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
12938         memcpy(_1_arr->elems, obj->receive._1.data, 32);
12939         return _1_arr;
12940 }
12941 uint64_t __attribute__((export_name("TS_LDKPeeledOnion_Receive_get__2"))) TS_LDKPeeledOnion_Receive_get__2(uint64_t ptr) {
12942         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12943         assert(obj->tag == LDKPeeledOnion_Receive);
12944         LDKBlindedPath _2_var = obj->receive._2;
12945                         uint64_t _2_ref = 0;
12946                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
12947                         _2_ref = tag_ptr(_2_var.inner, false);
12948         return _2_ref;
12949 }
12950 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12951 CHECK(owner->result_ok);
12952         return PeeledOnion_clone(&*owner->contents.result);
12953 }
12954 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_ok"))) TS_CResult_PeeledOnionNoneZ_get_ok(uint64_t owner) {
12955         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12956         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
12957         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
12958         uint64_t ret_ref = tag_ptr(ret_copy, true);
12959         return ret_ref;
12960 }
12961
12962 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12963 CHECK(!owner->result_ok);
12964         return *owner->contents.err;
12965 }
12966 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_get_err"))) TS_CResult_PeeledOnionNoneZ_get_err(uint64_t owner) {
12967         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12968         CResult_PeeledOnionNoneZ_get_err(owner_conv);
12969 }
12970
12971 uint32_t __attribute__((export_name("TS_LDKSendSuccess_ty_from_ptr"))) TS_LDKSendSuccess_ty_from_ptr(uint64_t ptr) {
12972         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12973         switch(obj->tag) {
12974                 case LDKSendSuccess_Buffered: return 0;
12975                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
12976                 default: abort();
12977         }
12978 }
12979 int8_tArray __attribute__((export_name("TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection"))) TS_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(uint64_t ptr) {
12980         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12981         assert(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
12982         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
12983         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
12984         return buffered_awaiting_connection_arr;
12985 }
12986 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12987 CHECK(owner->result_ok);
12988         return SendSuccess_clone(&*owner->contents.result);
12989 }
12990 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_ok"))) TS_CResult_SendSuccessSendErrorZ_get_ok(uint64_t owner) {
12991         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12992         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
12993         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
12994         uint64_t ret_ref = tag_ptr(ret_copy, true);
12995         return ret_ref;
12996 }
12997
12998 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12999 CHECK(!owner->result_ok);
13000         return SendError_clone(&*owner->contents.err);
13001 }
13002 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_get_err"))) TS_CResult_SendSuccessSendErrorZ_get_err(uint64_t owner) {
13003         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
13004         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13005         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
13006         uint64_t ret_ref = tag_ptr(ret_copy, true);
13007         return ret_ref;
13008 }
13009
13010 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13011         LDKBlindedPath ret = *owner->contents.result;
13012         ret.is_owned = false;
13013         return ret;
13014 }
13015 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
13016         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13017         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
13018         uint64_t ret_ref = 0;
13019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13021         return ret_ref;
13022 }
13023
13024 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13025 CHECK(!owner->result_ok);
13026         return *owner->contents.err;
13027 }
13028 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
13029         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13030         CResult_BlindedPathNoneZ_get_err(owner_conv);
13031 }
13032
13033 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
13034 CHECK(owner->result_ok);
13035         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
13036 }
13037 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(uint64_t owner) {
13038         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
13039         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13040         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
13041         return tag_ptr(ret_conv, true);
13042 }
13043
13044 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
13045 CHECK(!owner->result_ok);
13046         return *owner->contents.err;
13047 }
13048 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(uint64_t owner) {
13049         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
13050         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
13051 }
13052
13053 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
13054         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
13055         for (size_t i = 0; i < ret.datalen; i++) {
13056                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
13057         }
13058         return ret;
13059 }
13060 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13061         LDKBlindedPath ret = *owner->contents.result;
13062         ret.is_owned = false;
13063         return ret;
13064 }
13065 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
13066         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13067         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
13068         uint64_t ret_ref = 0;
13069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13071         return ret_ref;
13072 }
13073
13074 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13075 CHECK(!owner->result_ok);
13076         return DecodeError_clone(&*owner->contents.err);
13077 }
13078 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
13079         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13081         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
13082         uint64_t ret_ref = tag_ptr(ret_copy, true);
13083         return ret_ref;
13084 }
13085
13086 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13087         LDKBlindedHop ret = *owner->contents.result;
13088         ret.is_owned = false;
13089         return ret;
13090 }
13091 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
13092         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13093         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
13094         uint64_t ret_ref = 0;
13095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13097         return ret_ref;
13098 }
13099
13100 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13101 CHECK(!owner->result_ok);
13102         return DecodeError_clone(&*owner->contents.err);
13103 }
13104 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
13105         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13106         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13107         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
13108         uint64_t ret_ref = tag_ptr(ret_copy, true);
13109         return ret_ref;
13110 }
13111
13112 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13113         LDKInvoiceError ret = *owner->contents.result;
13114         ret.is_owned = false;
13115         return ret;
13116 }
13117 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
13118         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13119         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
13120         uint64_t ret_ref = 0;
13121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13123         return ret_ref;
13124 }
13125
13126 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13127 CHECK(!owner->result_ok);
13128         return DecodeError_clone(&*owner->contents.err);
13129 }
13130 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
13131         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13132         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13133         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
13134         uint64_t ret_ref = tag_ptr(ret_copy, true);
13135         return ret_ref;
13136 }
13137
13138 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
13139         LDKTrackedSpendableOutput ret = *owner->contents.result;
13140         ret.is_owned = false;
13141         return ret;
13142 }
13143 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(uint64_t owner) {
13144         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
13145         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
13146         uint64_t ret_ref = 0;
13147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13149         return ret_ref;
13150 }
13151
13152 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
13153 CHECK(!owner->result_ok);
13154         return DecodeError_clone(&*owner->contents.err);
13155 }
13156 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_err"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_get_err(uint64_t owner) {
13157         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
13158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13159         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
13160         uint64_t ret_ref = tag_ptr(ret_copy, true);
13161         return ret_ref;
13162 }
13163
13164 uint32_t __attribute__((export_name("TS_LDKOutputSpendStatus_ty_from_ptr"))) TS_LDKOutputSpendStatus_ty_from_ptr(uint64_t ptr) {
13165         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13166         switch(obj->tag) {
13167                 case LDKOutputSpendStatus_PendingInitialBroadcast: return 0;
13168                 case LDKOutputSpendStatus_PendingFirstConfirmation: return 1;
13169                 case LDKOutputSpendStatus_PendingThresholdConfirmations: return 2;
13170                 default: abort();
13171         }
13172 }
13173 uint64_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height"))) TS_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height(uint64_t ptr) {
13174         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13175         assert(obj->tag == LDKOutputSpendStatus_PendingInitialBroadcast);
13176         uint64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
13177         return delayed_until_height_ref;
13178 }
13179 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash(uint64_t ptr) {
13180         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13181         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13182         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13183         memcpy(first_broadcast_hash_arr->elems, obj->pending_first_confirmation.first_broadcast_hash.data, 32);
13184         return first_broadcast_hash_arr;
13185 }
13186 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height(uint64_t ptr) {
13187         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13188         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13189         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
13190         return latest_broadcast_height_conv;
13191 }
13192 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx"))) TS_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx(uint64_t ptr) {
13193         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13194         assert(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13195         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
13196                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13197                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13198         return latest_spending_tx_arr;
13199 }
13200 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash(uint64_t ptr) {
13201         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13202         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13203         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13204         memcpy(first_broadcast_hash_arr->elems, obj->pending_threshold_confirmations.first_broadcast_hash.data, 32);
13205         return first_broadcast_hash_arr;
13206 }
13207 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height(uint64_t ptr) {
13208         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13209         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13210         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
13211         return latest_broadcast_height_conv;
13212 }
13213 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx(uint64_t ptr) {
13214         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13215         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13216         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
13217                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13218                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13219         return latest_spending_tx_arr;
13220 }
13221 int32_t __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height(uint64_t ptr) {
13222         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13223         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13224         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
13225         return confirmation_height_conv;
13226 }
13227 int8_tArray __attribute__((export_name("TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash"))) TS_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash(uint64_t ptr) {
13228         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13229         assert(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13230         int8_tArray confirmation_hash_arr = init_int8_tArray(32, __LINE__);
13231         memcpy(confirmation_hash_arr->elems, obj->pending_threshold_confirmations.confirmation_hash.data, 32);
13232         return confirmation_hash_arr;
13233 }
13234 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13235 CHECK(owner->result_ok);
13236         return OutputSpendStatus_clone(&*owner->contents.result);
13237 }
13238 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_get_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_get_ok(uint64_t owner) {
13239         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13240         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
13241         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
13242         uint64_t ret_ref = tag_ptr(ret_copy, true);
13243         return ret_ref;
13244 }
13245
13246 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13247 CHECK(!owner->result_ok);
13248         return DecodeError_clone(&*owner->contents.err);
13249 }
13250 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_get_err"))) TS_CResult_OutputSpendStatusDecodeErrorZ_get_err(uint64_t owner) {
13251         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13253         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
13254         uint64_t ret_ref = tag_ptr(ret_copy, true);
13255         return ret_ref;
13256 }
13257
13258 typedef struct LDKFilter_JCalls {
13259         atomic_size_t refcnt;
13260         uint32_t instance_ptr;
13261 } LDKFilter_JCalls;
13262 static void LDKFilter_JCalls_free(void* this_arg) {
13263         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13264         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13265                 FREE(j_calls);
13266         }
13267 }
13268 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13269         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13270         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13271         memcpy(txid_arr->elems, *txid, 32);
13272         LDKu8slice script_pubkey_var = script_pubkey;
13273         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
13274         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
13275         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
13276 }
13277 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13278         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13279         LDKWatchedOutput output_var = output;
13280         uint64_t output_ref = 0;
13281         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13282         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13283         js_invoke_function_buuuuu(j_calls->instance_ptr, 48, output_ref, 0, 0, 0, 0, 0);
13284 }
13285 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13286         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13287         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13288 }
13289 static inline LDKFilter LDKFilter_init (JSValue o) {
13290         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13291         atomic_init(&calls->refcnt, 1);
13292         calls->instance_ptr = o;
13293
13294         LDKFilter ret = {
13295                 .this_arg = (void*) calls,
13296                 .register_tx = register_tx_LDKFilter_jcall,
13297                 .register_output = register_output_LDKFilter_jcall,
13298                 .free = LDKFilter_JCalls_free,
13299         };
13300         return ret;
13301 }
13302 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
13303         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13304         *res_ptr = LDKFilter_init(o);
13305         return tag_ptr(res_ptr, true);
13306 }
13307 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
13308         void* this_arg_ptr = untag_ptr(this_arg);
13309         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13310         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13311         uint8_t txid_arr[32];
13312         CHECK(txid->arr_len == 32);
13313         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13314         uint8_t (*txid_ref)[32] = &txid_arr;
13315         LDKu8slice script_pubkey_ref;
13316         script_pubkey_ref.datalen = script_pubkey->arr_len;
13317         script_pubkey_ref.data = script_pubkey->elems;
13318         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13319         FREE(script_pubkey);
13320 }
13321
13322 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
13323         void* this_arg_ptr = untag_ptr(this_arg);
13324         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13325         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13326         LDKWatchedOutput output_conv;
13327         output_conv.inner = untag_ptr(output);
13328         output_conv.is_owned = ptr_is_owned(output);
13329         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13330         output_conv = WatchedOutput_clone(&output_conv);
13331         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13332 }
13333
13334 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
13335         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13336         switch(obj->tag) {
13337                 case LDKCOption_FilterZ_Some: return 0;
13338                 case LDKCOption_FilterZ_None: return 1;
13339                 default: abort();
13340         }
13341 }
13342 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
13343         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13344         assert(obj->tag == LDKCOption_FilterZ_Some);
13345         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13346         *some_ret = obj->some;
13347                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13348                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13349                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13350                                 LDKFilter_JCalls_cloned(&(*some_ret));
13351                         }
13352         return tag_ptr(some_ret, true);
13353 }
13354 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
13355         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
13356         for (size_t i = 0; i < ret.datalen; i++) {
13357                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
13358         }
13359         return ret;
13360 }
13361 typedef struct LDKChangeDestinationSource_JCalls {
13362         atomic_size_t refcnt;
13363         uint32_t instance_ptr;
13364 } LDKChangeDestinationSource_JCalls;
13365 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
13366         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13367         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13368                 FREE(j_calls);
13369         }
13370 }
13371 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
13372         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13373         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
13374         void* ret_ptr = untag_ptr(ret);
13375         CHECK_ACCESS(ret_ptr);
13376         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
13377         FREE(untag_ptr(ret));
13378         return ret_conv;
13379 }
13380 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
13381         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
13382         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13383 }
13384 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (JSValue o) {
13385         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
13386         atomic_init(&calls->refcnt, 1);
13387         calls->instance_ptr = o;
13388
13389         LDKChangeDestinationSource ret = {
13390                 .this_arg = (void*) calls,
13391                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
13392                 .free = LDKChangeDestinationSource_JCalls_free,
13393         };
13394         return ret;
13395 }
13396 uint64_t  __attribute__((export_name("TS_LDKChangeDestinationSource_new"))) TS_LDKChangeDestinationSource_new(JSValue o) {
13397         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
13398         *res_ptr = LDKChangeDestinationSource_init(o);
13399         return tag_ptr(res_ptr, true);
13400 }
13401 uint64_t  __attribute__((export_name("TS_ChangeDestinationSource_get_change_destination_script"))) TS_ChangeDestinationSource_get_change_destination_script(uint64_t this_arg) {
13402         void* this_arg_ptr = untag_ptr(this_arg);
13403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13404         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
13405         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
13406         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
13407         return tag_ptr(ret_conv, true);
13408 }
13409
13410 typedef struct LDKKVStore_JCalls {
13411         atomic_size_t refcnt;
13412         uint32_t instance_ptr;
13413 } LDKKVStore_JCalls;
13414 static void LDKKVStore_JCalls_free(void* this_arg) {
13415         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13416         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13417                 FREE(j_calls);
13418         }
13419 }
13420 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
13421         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13422         LDKStr primary_namespace_str = primary_namespace;
13423         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13424         Str_free(primary_namespace_str);
13425         LDKStr secondary_namespace_str = secondary_namespace;
13426         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13427         Str_free(secondary_namespace_str);
13428         LDKStr key_str = key;
13429         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13430         Str_free(key_str);
13431         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, primary_namespace_conv, secondary_namespace_conv, key_conv, 0, 0, 0);
13432         void* ret_ptr = untag_ptr(ret);
13433         CHECK_ACCESS(ret_ptr);
13434         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
13435         FREE(untag_ptr(ret));
13436         return ret_conv;
13437 }
13438 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
13439         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13440         LDKStr primary_namespace_str = primary_namespace;
13441         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13442         Str_free(primary_namespace_str);
13443         LDKStr secondary_namespace_str = secondary_namespace;
13444         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13445         Str_free(secondary_namespace_str);
13446         LDKStr key_str = key;
13447         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13448         Str_free(key_str);
13449         LDKu8slice buf_var = buf;
13450         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
13451         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
13452         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, primary_namespace_conv, secondary_namespace_conv, key_conv, (uint32_t)buf_arr, 0, 0);
13453         void* ret_ptr = untag_ptr(ret);
13454         CHECK_ACCESS(ret_ptr);
13455         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13456         FREE(untag_ptr(ret));
13457         return ret_conv;
13458 }
13459 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
13460         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13461         LDKStr primary_namespace_str = primary_namespace;
13462         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13463         Str_free(primary_namespace_str);
13464         LDKStr secondary_namespace_str = secondary_namespace;
13465         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13466         Str_free(secondary_namespace_str);
13467         LDKStr key_str = key;
13468         jstring key_conv = str_ref_to_ts(key_str.chars, key_str.len);
13469         Str_free(key_str);
13470         jboolean lazy_conv = lazy;
13471         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv, 0, 0);
13472         void* ret_ptr = untag_ptr(ret);
13473         CHECK_ACCESS(ret_ptr);
13474         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13475         FREE(untag_ptr(ret));
13476         return ret_conv;
13477 }
13478 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
13479         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13480         LDKStr primary_namespace_str = primary_namespace;
13481         jstring primary_namespace_conv = str_ref_to_ts(primary_namespace_str.chars, primary_namespace_str.len);
13482         Str_free(primary_namespace_str);
13483         LDKStr secondary_namespace_str = secondary_namespace;
13484         jstring secondary_namespace_conv = str_ref_to_ts(secondary_namespace_str.chars, secondary_namespace_str.len);
13485         Str_free(secondary_namespace_str);
13486         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, primary_namespace_conv, secondary_namespace_conv, 0, 0, 0, 0);
13487         void* ret_ptr = untag_ptr(ret);
13488         CHECK_ACCESS(ret_ptr);
13489         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
13490         FREE(untag_ptr(ret));
13491         return ret_conv;
13492 }
13493 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
13494         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
13495         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13496 }
13497 static inline LDKKVStore LDKKVStore_init (JSValue o) {
13498         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
13499         atomic_init(&calls->refcnt, 1);
13500         calls->instance_ptr = o;
13501
13502         LDKKVStore ret = {
13503                 .this_arg = (void*) calls,
13504                 .read = read_LDKKVStore_jcall,
13505                 .write = write_LDKKVStore_jcall,
13506                 .remove = remove_LDKKVStore_jcall,
13507                 .list = list_LDKKVStore_jcall,
13508                 .free = LDKKVStore_JCalls_free,
13509         };
13510         return ret;
13511 }
13512 uint64_t  __attribute__((export_name("TS_LDKKVStore_new"))) TS_LDKKVStore_new(JSValue o) {
13513         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
13514         *res_ptr = LDKKVStore_init(o);
13515         return tag_ptr(res_ptr, true);
13516 }
13517 uint64_t  __attribute__((export_name("TS_KVStore_read"))) TS_KVStore_read(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
13518         void* this_arg_ptr = untag_ptr(this_arg);
13519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13520         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13521         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13522         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13523         LDKStr key_conv = str_ref_to_owned_c(key);
13524         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
13525         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
13526         return tag_ptr(ret_conv, true);
13527 }
13528
13529 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) {
13530         void* this_arg_ptr = untag_ptr(this_arg);
13531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13532         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13533         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13534         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13535         LDKStr key_conv = str_ref_to_owned_c(key);
13536         LDKu8slice buf_ref;
13537         buf_ref.datalen = buf->arr_len;
13538         buf_ref.data = buf->elems;
13539         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13540         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
13541         FREE(buf);
13542         return tag_ptr(ret_conv, true);
13543 }
13544
13545 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) {
13546         void* this_arg_ptr = untag_ptr(this_arg);
13547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13548         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13549         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13550         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13551         LDKStr key_conv = str_ref_to_owned_c(key);
13552         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13553         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
13554         return tag_ptr(ret_conv, true);
13555 }
13556
13557 uint64_t  __attribute__((export_name("TS_KVStore_list"))) TS_KVStore_list(uint64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
13558         void* this_arg_ptr = untag_ptr(this_arg);
13559         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13560         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13561         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13562         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13563         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
13564         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
13565         return tag_ptr(ret_conv, true);
13566 }
13567
13568 typedef struct LDKOutputSpender_JCalls {
13569         atomic_size_t refcnt;
13570         uint32_t instance_ptr;
13571 } LDKOutputSpender_JCalls;
13572 static void LDKOutputSpender_JCalls_free(void* this_arg) {
13573         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
13574         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13575                 FREE(j_calls);
13576         }
13577 }
13578 LDKCResult_TransactionNoneZ spend_spendable_outputs_LDKOutputSpender_jcall(const void* this_arg, LDKCVec_SpendableOutputDescriptorZ descriptors, LDKCVec_TxOutZ outputs, LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, LDKCOption_u32Z locktime) {
13579         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
13580         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
13581         uint64_tArray descriptors_arr = NULL;
13582         descriptors_arr = init_uint64_tArray(descriptors_var.datalen, __LINE__);
13583         uint64_t *descriptors_arr_ptr = (uint64_t*)(((uint8_t*)descriptors_arr) + 8);
13584         for (size_t b = 0; b < descriptors_var.datalen; b++) {
13585                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
13586                 *descriptors_conv_27_copy = descriptors_var.data[b];
13587                 uint64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
13588                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
13589         }
13590         
13591         FREE(descriptors_var.data);
13592         LDKCVec_TxOutZ outputs_var = outputs;
13593         uint64_tArray outputs_arr = NULL;
13594         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
13595         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
13596         for (size_t h = 0; h < outputs_var.datalen; h++) {
13597                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13598                 *outputs_conv_7_ref = outputs_var.data[h];
13599                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
13600         }
13601         
13602         FREE(outputs_var.data);
13603         LDKCVec_u8Z change_destination_script_var = change_destination_script;
13604         int8_tArray change_destination_script_arr = init_int8_tArray(change_destination_script_var.datalen, __LINE__);
13605         memcpy(change_destination_script_arr->elems, change_destination_script_var.data, change_destination_script_var.datalen);
13606         CVec_u8Z_free(change_destination_script_var);
13607         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
13608         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13609         *locktime_copy = locktime;
13610         uint64_t locktime_ref = tag_ptr(locktime_copy, true);
13611         uint64_t ret = js_invoke_function_uuuubu(j_calls->instance_ptr, 54, (uint32_t)descriptors_arr, (uint32_t)outputs_arr, (uint32_t)change_destination_script_arr, feerate_sat_per_1000_weight_conv, locktime_ref, 0);
13612         void* ret_ptr = untag_ptr(ret);
13613         CHECK_ACCESS(ret_ptr);
13614         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
13615         FREE(untag_ptr(ret));
13616         return ret_conv;
13617 }
13618 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
13619         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
13620         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13621 }
13622 static inline LDKOutputSpender LDKOutputSpender_init (JSValue o) {
13623         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
13624         atomic_init(&calls->refcnt, 1);
13625         calls->instance_ptr = o;
13626
13627         LDKOutputSpender ret = {
13628                 .this_arg = (void*) calls,
13629                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
13630                 .free = LDKOutputSpender_JCalls_free,
13631         };
13632         return ret;
13633 }
13634 uint64_t  __attribute__((export_name("TS_LDKOutputSpender_new"))) TS_LDKOutputSpender_new(JSValue o) {
13635         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
13636         *res_ptr = LDKOutputSpender_init(o);
13637         return tag_ptr(res_ptr, true);
13638 }
13639 uint64_t  __attribute__((export_name("TS_OutputSpender_spend_spendable_outputs"))) TS_OutputSpender_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) {
13640         void* this_arg_ptr = untag_ptr(this_arg);
13641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13642         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
13643         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
13644         descriptors_constr.datalen = descriptors->arr_len;
13645         if (descriptors_constr.datalen > 0)
13646                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13647         else
13648                 descriptors_constr.data = NULL;
13649         uint64_t* descriptors_vals = descriptors->elems;
13650         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
13651                 uint64_t descriptors_conv_27 = descriptors_vals[b];
13652                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
13653                 CHECK_ACCESS(descriptors_conv_27_ptr);
13654                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
13655                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
13656                 descriptors_constr.data[b] = descriptors_conv_27_conv;
13657         }
13658         FREE(descriptors);
13659         LDKCVec_TxOutZ outputs_constr;
13660         outputs_constr.datalen = outputs->arr_len;
13661         if (outputs_constr.datalen > 0)
13662                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13663         else
13664                 outputs_constr.data = NULL;
13665         uint64_t* outputs_vals = outputs->elems;
13666         for (size_t h = 0; h < outputs_constr.datalen; h++) {
13667                 uint64_t outputs_conv_7 = outputs_vals[h];
13668                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
13669                 CHECK_ACCESS(outputs_conv_7_ptr);
13670                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
13671                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
13672                 outputs_constr.data[h] = outputs_conv_7_conv;
13673         }
13674         FREE(outputs);
13675         LDKCVec_u8Z change_destination_script_ref;
13676         change_destination_script_ref.datalen = change_destination_script->arr_len;
13677         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
13678         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
13679         void* locktime_ptr = untag_ptr(locktime);
13680         CHECK_ACCESS(locktime_ptr);
13681         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
13682         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
13683         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13684         *ret_conv = (this_arg_conv->spend_spendable_outputs)(this_arg_conv->this_arg, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
13685         return tag_ptr(ret_conv, true);
13686 }
13687
13688 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
13689         LDKOutputSweeper ret = *owner->contents.result;
13690         ret.is_owned = false;
13691         return ret;
13692 }
13693 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_get_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_get_ok(uint64_t owner) {
13694         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
13695         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
13696         uint64_t ret_ref = 0;
13697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13699         return ret_ref;
13700 }
13701
13702 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
13703 CHECK(!owner->result_ok);
13704         return DecodeError_clone(&*owner->contents.err);
13705 }
13706 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_get_err"))) TS_CResult_OutputSweeperDecodeErrorZ_get_err(uint64_t owner) {
13707         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
13708         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13709         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
13710         uint64_t ret_ref = tag_ptr(ret_copy, true);
13711         return ret_ref;
13712 }
13713
13714 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
13715         LDKBestBlock ret = owner->a;
13716         ret.is_owned = false;
13717         return ret;
13718 }
13719 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_get_a"))) TS_C2Tuple_BestBlockOutputSweeperZ_get_a(uint64_t owner) {
13720         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
13721         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
13722         uint64_t ret_ref = 0;
13723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13725         return ret_ref;
13726 }
13727
13728 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
13729         LDKOutputSweeper ret = owner->b;
13730         ret.is_owned = false;
13731         return ret;
13732 }
13733 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_get_b"))) TS_C2Tuple_BestBlockOutputSweeperZ_get_b(uint64_t owner) {
13734         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
13735         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
13736         uint64_t ret_ref = 0;
13737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13739         return ret_ref;
13740 }
13741
13742 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
13743 CHECK(owner->result_ok);
13744         return &*owner->contents.result;
13745 }
13746 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(uint64_t owner) {
13747         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
13748         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
13749         return ret_ret;
13750 }
13751
13752 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
13753 CHECK(!owner->result_ok);
13754         return DecodeError_clone(&*owner->contents.err);
13755 }
13756 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(uint64_t owner) {
13757         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
13758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13759         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
13760         uint64_t ret_ref = tag_ptr(ret_copy, true);
13761         return ret_ref;
13762 }
13763
13764 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
13765         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
13766         ret.is_owned = false;
13767         return ret;
13768 }
13769 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13770         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
13771         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
13772         uint64_t ret_ref = 0;
13773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13775         return ret_ref;
13776 }
13777
13778 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
13779 CHECK(!owner->result_ok);
13780         return DecodeError_clone(&*owner->contents.err);
13781 }
13782 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(uint64_t owner) {
13783         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
13784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13785         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
13786         uint64_t ret_ref = tag_ptr(ret_copy, true);
13787         return ret_ref;
13788 }
13789
13790 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
13791         LDKDelayedPaymentKey ret = *owner->contents.result;
13792         ret.is_owned = false;
13793         return ret;
13794 }
13795 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(uint64_t owner) {
13796         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
13797         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
13798         uint64_t ret_ref = 0;
13799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13801         return ret_ref;
13802 }
13803
13804 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
13805 CHECK(!owner->result_ok);
13806         return DecodeError_clone(&*owner->contents.err);
13807 }
13808 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(uint64_t owner) {
13809         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
13810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13811         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
13812         uint64_t ret_ref = tag_ptr(ret_copy, true);
13813         return ret_ref;
13814 }
13815
13816 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
13817         LDKHtlcBasepoint ret = *owner->contents.result;
13818         ret.is_owned = false;
13819         return ret;
13820 }
13821 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13822         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
13823         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
13824         uint64_t ret_ref = 0;
13825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13827         return ret_ref;
13828 }
13829
13830 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
13831 CHECK(!owner->result_ok);
13832         return DecodeError_clone(&*owner->contents.err);
13833 }
13834 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_get_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_get_err(uint64_t owner) {
13835         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
13836         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13837         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
13838         uint64_t ret_ref = tag_ptr(ret_copy, true);
13839         return ret_ref;
13840 }
13841
13842 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
13843         LDKHtlcKey ret = *owner->contents.result;
13844         ret.is_owned = false;
13845         return ret;
13846 }
13847 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_get_ok(uint64_t owner) {
13848         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
13849         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
13850         uint64_t ret_ref = 0;
13851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13853         return ret_ref;
13854 }
13855
13856 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
13857 CHECK(!owner->result_ok);
13858         return DecodeError_clone(&*owner->contents.err);
13859 }
13860 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_get_err"))) TS_CResult_HtlcKeyDecodeErrorZ_get_err(uint64_t owner) {
13861         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
13862         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13863         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
13864         uint64_t ret_ref = tag_ptr(ret_copy, true);
13865         return ret_ref;
13866 }
13867
13868 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
13869         LDKRevocationBasepoint ret = *owner->contents.result;
13870         ret.is_owned = false;
13871         return ret;
13872 }
13873 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_ok(uint64_t owner) {
13874         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
13875         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
13876         uint64_t ret_ref = 0;
13877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13879         return ret_ref;
13880 }
13881
13882 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
13883 CHECK(!owner->result_ok);
13884         return DecodeError_clone(&*owner->contents.err);
13885 }
13886 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_get_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_get_err(uint64_t owner) {
13887         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
13888         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13889         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
13890         uint64_t ret_ref = tag_ptr(ret_copy, true);
13891         return ret_ref;
13892 }
13893
13894 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
13895         LDKRevocationKey ret = *owner->contents.result;
13896         ret.is_owned = false;
13897         return ret;
13898 }
13899 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_get_ok(uint64_t owner) {
13900         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
13901         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
13902         uint64_t ret_ref = 0;
13903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13905         return ret_ref;
13906 }
13907
13908 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
13909 CHECK(!owner->result_ok);
13910         return DecodeError_clone(&*owner->contents.err);
13911 }
13912 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_get_err"))) TS_CResult_RevocationKeyDecodeErrorZ_get_err(uint64_t owner) {
13913         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
13914         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13915         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
13916         uint64_t ret_ref = tag_ptr(ret_copy, true);
13917         return ret_ref;
13918 }
13919
13920 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13921         LDKLockedChannelMonitor ret = *owner->contents.result;
13922         ret.is_owned = false;
13923         return ret;
13924 }
13925 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
13926         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13927         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
13928         uint64_t ret_ref = 0;
13929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13931         return ret_ref;
13932 }
13933
13934 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13935 CHECK(!owner->result_ok);
13936         return *owner->contents.err;
13937 }
13938 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
13939         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13940         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
13941 }
13942
13943 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
13944         LDKOutPoint ret = owner->a;
13945         ret.is_owned = false;
13946         return ret;
13947 }
13948 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_get_a"))) TS_C2Tuple_OutPointChannelIdZ_get_a(uint64_t owner) {
13949         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
13950         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
13951         uint64_t ret_ref = 0;
13952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13954         return ret_ref;
13955 }
13956
13957 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
13958         LDKChannelId ret = owner->b;
13959         ret.is_owned = false;
13960         return ret;
13961 }
13962 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_get_b"))) TS_C2Tuple_OutPointChannelIdZ_get_b(uint64_t owner) {
13963         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
13964         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
13965         uint64_t ret_ref = 0;
13966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13968         return ret_ref;
13969 }
13970
13971 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
13972         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
13973         for (size_t i = 0; i < ret.datalen; i++) {
13974                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
13975         }
13976         return ret;
13977 }
13978 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
13979         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
13980         for (size_t i = 0; i < ret.datalen; i++) {
13981                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
13982         }
13983         return ret;
13984 }
13985 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13986         LDKOutPoint ret = owner->a;
13987         ret.is_owned = false;
13988         return ret;
13989 }
13990 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
13991         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13992         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
13993         uint64_t ret_ref = 0;
13994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13996         return ret_ref;
13997 }
13998
13999 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14000         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14001 }
14002 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
14003         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14004         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14005         uint64_tArray ret_arr = NULL;
14006         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14007         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14008         for (size_t r = 0; r < ret_var.datalen; r++) {
14009                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14010                 uint64_t ret_conv_17_ref = 0;
14011                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14012                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14013                 ret_arr_ptr[r] = ret_conv_17_ref;
14014         }
14015         
14016         FREE(ret_var.data);
14017         return ret_arr;
14018 }
14019
14020 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14021         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14022         for (size_t i = 0; i < ret.datalen; i++) {
14023                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14024         }
14025         return ret;
14026 }
14027 uint32_t __attribute__((export_name("TS_LDKCandidateRouteHop_ty_from_ptr"))) TS_LDKCandidateRouteHop_ty_from_ptr(uint64_t ptr) {
14028         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
14029         switch(obj->tag) {
14030                 case LDKCandidateRouteHop_FirstHop: return 0;
14031                 case LDKCandidateRouteHop_PublicHop: return 1;
14032                 case LDKCandidateRouteHop_PrivateHop: return 2;
14033                 case LDKCandidateRouteHop_Blinded: return 3;
14034                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
14035                 default: abort();
14036         }
14037 }
14038 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_FirstHop_get_first_hop"))) TS_LDKCandidateRouteHop_FirstHop_get_first_hop(uint64_t ptr) {
14039         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
14040         assert(obj->tag == LDKCandidateRouteHop_FirstHop);
14041         LDKFirstHopCandidate first_hop_var = obj->first_hop;
14042                         uint64_t first_hop_ref = 0;
14043                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
14044                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
14045         return first_hop_ref;
14046 }
14047 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PublicHop_get_public_hop"))) TS_LDKCandidateRouteHop_PublicHop_get_public_hop(uint64_t ptr) {
14048         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
14049         assert(obj->tag == LDKCandidateRouteHop_PublicHop);
14050         LDKPublicHopCandidate public_hop_var = obj->public_hop;
14051                         uint64_t public_hop_ref = 0;
14052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
14053                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
14054         return public_hop_ref;
14055 }
14056 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_PrivateHop_get_private_hop"))) TS_LDKCandidateRouteHop_PrivateHop_get_private_hop(uint64_t ptr) {
14057         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
14058         assert(obj->tag == LDKCandidateRouteHop_PrivateHop);
14059         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
14060                         uint64_t private_hop_ref = 0;
14061                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
14062                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
14063         return private_hop_ref;
14064 }
14065 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_Blinded_get_blinded"))) TS_LDKCandidateRouteHop_Blinded_get_blinded(uint64_t ptr) {
14066         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
14067         assert(obj->tag == LDKCandidateRouteHop_Blinded);
14068         LDKBlindedPathCandidate blinded_var = obj->blinded;
14069                         uint64_t blinded_ref = 0;
14070                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
14071                         blinded_ref = tag_ptr(blinded_var.inner, false);
14072         return blinded_ref;
14073 }
14074 uint64_t __attribute__((export_name("TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded"))) TS_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(uint64_t ptr) {
14075         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
14076         assert(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
14077         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
14078                         uint64_t one_hop_blinded_ref = 0;
14079                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
14080                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
14081         return one_hop_blinded_ref;
14082 }
14083 typedef struct LDKScoreLookUp_JCalls {
14084         atomic_size_t refcnt;
14085         uint32_t instance_ptr;
14086 } LDKScoreLookUp_JCalls;
14087 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
14088         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
14089         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14090                 FREE(j_calls);
14091         }
14092 }
14093 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
14094         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
14095         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
14096         *ret_candidate = CandidateRouteHop_clone(candidate);
14097         uint64_t ref_candidate = tag_ptr(ret_candidate, true);
14098         LDKChannelUsage usage_var = usage;
14099         uint64_t usage_ref = 0;
14100         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
14101         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
14102         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
14103         uint64_t score_params_ref = 0;
14104         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
14105         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
14106         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
14107         return js_invoke_function_bbbuuu(j_calls->instance_ptr, 55, ref_candidate, usage_ref, score_params_ref, 0, 0, 0);
14108 }
14109 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
14110         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
14111         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14112 }
14113 static inline LDKScoreLookUp LDKScoreLookUp_init (JSValue o) {
14114         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
14115         atomic_init(&calls->refcnt, 1);
14116         calls->instance_ptr = o;
14117
14118         LDKScoreLookUp ret = {
14119                 .this_arg = (void*) calls,
14120                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
14121                 .free = LDKScoreLookUp_JCalls_free,
14122         };
14123         return ret;
14124 }
14125 uint64_t  __attribute__((export_name("TS_LDKScoreLookUp_new"))) TS_LDKScoreLookUp_new(JSValue o) {
14126         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
14127         *res_ptr = LDKScoreLookUp_init(o);
14128         return tag_ptr(res_ptr, true);
14129 }
14130 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) {
14131         void* this_arg_ptr = untag_ptr(this_arg);
14132         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14133         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
14134         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
14135         LDKChannelUsage usage_conv;
14136         usage_conv.inner = untag_ptr(usage);
14137         usage_conv.is_owned = ptr_is_owned(usage);
14138         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
14139         usage_conv = ChannelUsage_clone(&usage_conv);
14140         LDKProbabilisticScoringFeeParameters score_params_conv;
14141         score_params_conv.inner = untag_ptr(score_params);
14142         score_params_conv.is_owned = ptr_is_owned(score_params);
14143         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
14144         score_params_conv.is_owned = false;
14145         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
14146         return ret_conv;
14147 }
14148
14149 typedef struct LDKScoreUpdate_JCalls {
14150         atomic_size_t refcnt;
14151         uint32_t instance_ptr;
14152 } LDKScoreUpdate_JCalls;
14153 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
14154         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14155         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14156                 FREE(j_calls);
14157         }
14158 }
14159 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
14160         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14161         LDKPath path_var = *path;
14162         uint64_t path_ref = 0;
14163         path_var = Path_clone(&path_var);
14164         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14165         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14166         int64_t short_channel_id_conv = short_channel_id;
14167         int64_t duration_since_epoch_conv = duration_since_epoch;
14168         js_invoke_function_bbbuuu(j_calls->instance_ptr, 56, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
14169 }
14170 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
14171         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14172         LDKPath path_var = *path;
14173         uint64_t path_ref = 0;
14174         path_var = Path_clone(&path_var);
14175         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14176         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14177         int64_t duration_since_epoch_conv = duration_since_epoch;
14178         js_invoke_function_bbuuuu(j_calls->instance_ptr, 57, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
14179 }
14180 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
14181         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14182         LDKPath path_var = *path;
14183         uint64_t path_ref = 0;
14184         path_var = Path_clone(&path_var);
14185         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14186         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14187         int64_t short_channel_id_conv = short_channel_id;
14188         int64_t duration_since_epoch_conv = duration_since_epoch;
14189         js_invoke_function_bbbuuu(j_calls->instance_ptr, 58, path_ref, short_channel_id_conv, duration_since_epoch_conv, 0, 0, 0);
14190 }
14191 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
14192         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14193         LDKPath path_var = *path;
14194         uint64_t path_ref = 0;
14195         path_var = Path_clone(&path_var);
14196         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14197         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
14198         int64_t duration_since_epoch_conv = duration_since_epoch;
14199         js_invoke_function_bbuuuu(j_calls->instance_ptr, 59, path_ref, duration_since_epoch_conv, 0, 0, 0, 0);
14200 }
14201 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
14202         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
14203         int64_t duration_since_epoch_conv = duration_since_epoch;
14204         js_invoke_function_buuuuu(j_calls->instance_ptr, 60, duration_since_epoch_conv, 0, 0, 0, 0, 0);
14205 }
14206 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
14207         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
14208         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14209 }
14210 static inline LDKScoreUpdate LDKScoreUpdate_init (JSValue o) {
14211         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
14212         atomic_init(&calls->refcnt, 1);
14213         calls->instance_ptr = o;
14214
14215         LDKScoreUpdate ret = {
14216                 .this_arg = (void*) calls,
14217                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
14218                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
14219                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
14220                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
14221                 .time_passed = time_passed_LDKScoreUpdate_jcall,
14222                 .free = LDKScoreUpdate_JCalls_free,
14223         };
14224         return ret;
14225 }
14226 uint64_t  __attribute__((export_name("TS_LDKScoreUpdate_new"))) TS_LDKScoreUpdate_new(JSValue o) {
14227         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
14228         *res_ptr = LDKScoreUpdate_init(o);
14229         return tag_ptr(res_ptr, true);
14230 }
14231 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) {
14232         void* this_arg_ptr = untag_ptr(this_arg);
14233         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14234         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14235         LDKPath path_conv;
14236         path_conv.inner = untag_ptr(path);
14237         path_conv.is_owned = ptr_is_owned(path);
14238         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14239         path_conv.is_owned = false;
14240         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
14241 }
14242
14243 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) {
14244         void* this_arg_ptr = untag_ptr(this_arg);
14245         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14246         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14247         LDKPath path_conv;
14248         path_conv.inner = untag_ptr(path);
14249         path_conv.is_owned = ptr_is_owned(path);
14250         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14251         path_conv.is_owned = false;
14252         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
14253 }
14254
14255 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) {
14256         void* this_arg_ptr = untag_ptr(this_arg);
14257         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14258         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14259         LDKPath path_conv;
14260         path_conv.inner = untag_ptr(path);
14261         path_conv.is_owned = ptr_is_owned(path);
14262         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14263         path_conv.is_owned = false;
14264         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
14265 }
14266
14267 void  __attribute__((export_name("TS_ScoreUpdate_probe_successful"))) TS_ScoreUpdate_probe_successful(uint64_t this_arg, uint64_t path, int64_t duration_since_epoch) {
14268         void* this_arg_ptr = untag_ptr(this_arg);
14269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14270         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14271         LDKPath path_conv;
14272         path_conv.inner = untag_ptr(path);
14273         path_conv.is_owned = ptr_is_owned(path);
14274         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
14275         path_conv.is_owned = false;
14276         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
14277 }
14278
14279 void  __attribute__((export_name("TS_ScoreUpdate_time_passed"))) TS_ScoreUpdate_time_passed(uint64_t this_arg, int64_t duration_since_epoch) {
14280         void* this_arg_ptr = untag_ptr(this_arg);
14281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14282         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
14283         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
14284 }
14285
14286 typedef struct LDKLockableScore_JCalls {
14287         atomic_size_t refcnt;
14288         uint32_t instance_ptr;
14289 } LDKLockableScore_JCalls;
14290 static void LDKLockableScore_JCalls_free(void* this_arg) {
14291         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14292         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14293                 FREE(j_calls);
14294         }
14295 }
14296 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
14297         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14298         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
14299         void* ret_ptr = untag_ptr(ret);
14300         CHECK_ACCESS(ret_ptr);
14301         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
14302         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
14303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14304                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
14305         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
14306         
14307         return ret_conv;
14308 }
14309 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
14310         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
14311         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
14312         void* ret_ptr = untag_ptr(ret);
14313         CHECK_ACCESS(ret_ptr);
14314         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
14315         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
14316                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14317                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
14318         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
14319         
14320         return ret_conv;
14321 }
14322 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
14323         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
14324         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14325 }
14326 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
14327         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
14328         atomic_init(&calls->refcnt, 1);
14329         calls->instance_ptr = o;
14330
14331         LDKLockableScore ret = {
14332                 .this_arg = (void*) calls,
14333                 .read_lock = read_lock_LDKLockableScore_jcall,
14334                 .write_lock = write_lock_LDKLockableScore_jcall,
14335                 .free = LDKLockableScore_JCalls_free,
14336         };
14337         return ret;
14338 }
14339 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
14340         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
14341         *res_ptr = LDKLockableScore_init(o);
14342         return tag_ptr(res_ptr, true);
14343 }
14344 uint64_t  __attribute__((export_name("TS_LockableScore_read_lock"))) TS_LockableScore_read_lock(uint64_t this_arg) {
14345         void* this_arg_ptr = untag_ptr(this_arg);
14346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14347         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14348         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
14349         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
14350         return tag_ptr(ret_ret, true);
14351 }
14352
14353 uint64_t  __attribute__((export_name("TS_LockableScore_write_lock"))) TS_LockableScore_write_lock(uint64_t this_arg) {
14354         void* this_arg_ptr = untag_ptr(this_arg);
14355         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14356         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
14357         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
14358         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
14359         return tag_ptr(ret_ret, true);
14360 }
14361
14362 typedef struct LDKWriteableScore_JCalls {
14363         atomic_size_t refcnt;
14364         uint32_t instance_ptr;
14365         LDKLockableScore_JCalls* LockableScore;
14366 } LDKWriteableScore_JCalls;
14367 static void LDKWriteableScore_JCalls_free(void* this_arg) {
14368         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
14369         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14370                 FREE(j_calls);
14371         }
14372 }
14373 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
14374         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
14375         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, 0, 0, 0, 0, 0, 0);
14376         LDKCVec_u8Z ret_ref;
14377         ret_ref.datalen = ret->arr_len;
14378         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
14379         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
14380         return ret_ref;
14381 }
14382 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
14383         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
14384         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14385         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
14386 }
14387 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
14388         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
14389         atomic_init(&calls->refcnt, 1);
14390         calls->instance_ptr = o;
14391
14392         LDKWriteableScore ret = {
14393                 .this_arg = (void*) calls,
14394                 .write = write_LDKWriteableScore_jcall,
14395                 .free = LDKWriteableScore_JCalls_free,
14396                 .LockableScore = LDKLockableScore_init(LockableScore),
14397         };
14398         calls->LockableScore = ret.LockableScore.this_arg;
14399         return ret;
14400 }
14401 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
14402         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
14403         *res_ptr = LDKWriteableScore_init(o, LockableScore);
14404         return tag_ptr(res_ptr, true);
14405 }
14406 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
14407         void* this_arg_ptr = untag_ptr(this_arg);
14408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14409         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
14410         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
14411         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
14412         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
14413         CVec_u8Z_free(ret_var);
14414         return ret_arr;
14415 }
14416
14417 typedef struct LDKPersister_JCalls {
14418         atomic_size_t refcnt;
14419         uint32_t instance_ptr;
14420 } LDKPersister_JCalls;
14421 static void LDKPersister_JCalls_free(void* this_arg) {
14422         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14423         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14424                 FREE(j_calls);
14425         }
14426 }
14427 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14428         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14429         LDKChannelManager channel_manager_var = *channel_manager;
14430         uint64_t channel_manager_ref = 0;
14431         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14432         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14433         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14434         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 64, channel_manager_ref, 0, 0, 0, 0, 0);
14435         void* ret_ptr = untag_ptr(ret);
14436         CHECK_ACCESS(ret_ptr);
14437         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14438         FREE(untag_ptr(ret));
14439         return ret_conv;
14440 }
14441 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14442         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14443         LDKNetworkGraph network_graph_var = *network_graph;
14444         uint64_t network_graph_ref = 0;
14445         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14446         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14447         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14448         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 65, network_graph_ref, 0, 0, 0, 0, 0);
14449         void* ret_ptr = untag_ptr(ret);
14450         CHECK_ACCESS(ret_ptr);
14451         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14452         FREE(untag_ptr(ret));
14453         return ret_conv;
14454 }
14455 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14456         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14457         // WARNING: This object doesn't live past this scope, needs clone!
14458         uint64_t ret_scorer = tag_ptr(scorer, false);
14459         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 66, ret_scorer, 0, 0, 0, 0, 0);
14460         void* ret_ptr = untag_ptr(ret);
14461         CHECK_ACCESS(ret_ptr);
14462         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14463         FREE(untag_ptr(ret));
14464         return ret_conv;
14465 }
14466 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14467         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14468         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14469 }
14470 static inline LDKPersister LDKPersister_init (JSValue o) {
14471         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14472         atomic_init(&calls->refcnt, 1);
14473         calls->instance_ptr = o;
14474
14475         LDKPersister ret = {
14476                 .this_arg = (void*) calls,
14477                 .persist_manager = persist_manager_LDKPersister_jcall,
14478                 .persist_graph = persist_graph_LDKPersister_jcall,
14479                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14480                 .free = LDKPersister_JCalls_free,
14481         };
14482         return ret;
14483 }
14484 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
14485         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14486         *res_ptr = LDKPersister_init(o);
14487         return tag_ptr(res_ptr, true);
14488 }
14489 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
14490         void* this_arg_ptr = untag_ptr(this_arg);
14491         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14492         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14493         LDKChannelManager channel_manager_conv;
14494         channel_manager_conv.inner = untag_ptr(channel_manager);
14495         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14496         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14497         channel_manager_conv.is_owned = false;
14498         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14499         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14500         return tag_ptr(ret_conv, true);
14501 }
14502
14503 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
14504         void* this_arg_ptr = untag_ptr(this_arg);
14505         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14506         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14507         LDKNetworkGraph network_graph_conv;
14508         network_graph_conv.inner = untag_ptr(network_graph);
14509         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14510         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14511         network_graph_conv.is_owned = false;
14512         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14513         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14514         return tag_ptr(ret_conv, true);
14515 }
14516
14517 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
14518         void* this_arg_ptr = untag_ptr(this_arg);
14519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14520         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14521         void* scorer_ptr = untag_ptr(scorer);
14522         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14523         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14524         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14525         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14526         return tag_ptr(ret_conv, true);
14527 }
14528
14529 typedef struct LDKPersist_JCalls {
14530         atomic_size_t refcnt;
14531         uint32_t instance_ptr;
14532 } LDKPersist_JCalls;
14533 static void LDKPersist_JCalls_free(void* this_arg) {
14534         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14535         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14536                 FREE(j_calls);
14537         }
14538 }
14539 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14540         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14541         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14542         uint64_t channel_funding_outpoint_ref = 0;
14543         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14544         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14545         LDKChannelMonitor data_var = *data;
14546         uint64_t data_ref = 0;
14547         data_var = ChannelMonitor_clone(&data_var);
14548         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14549         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14550         LDKMonitorUpdateId update_id_var = update_id;
14551         uint64_t update_id_ref = 0;
14552         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14553         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14554         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 67, channel_funding_outpoint_ref, data_ref, update_id_ref, 0, 0, 0);
14555         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
14556         return ret_conv;
14557 }
14558 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14559         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14560         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14561         uint64_t channel_funding_outpoint_ref = 0;
14562         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14563         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14564         LDKChannelMonitorUpdate update_var = update;
14565         uint64_t update_ref = 0;
14566         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14567         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14568         LDKChannelMonitor data_var = *data;
14569         uint64_t data_ref = 0;
14570         data_var = ChannelMonitor_clone(&data_var);
14571         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14572         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14573         LDKMonitorUpdateId update_id_var = update_id;
14574         uint64_t update_id_ref = 0;
14575         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14576         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14577         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 68, channel_funding_outpoint_ref, update_ref, data_ref, update_id_ref, 0, 0);
14578         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
14579         return ret_conv;
14580 }
14581 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
14582         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14583         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14584         uint64_t channel_funding_outpoint_ref = 0;
14585         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14586         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14587         js_invoke_function_buuuuu(j_calls->instance_ptr, 69, channel_funding_outpoint_ref, 0, 0, 0, 0, 0);
14588 }
14589 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14590         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14591         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14592 }
14593 static inline LDKPersist LDKPersist_init (JSValue o) {
14594         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14595         atomic_init(&calls->refcnt, 1);
14596         calls->instance_ptr = o;
14597
14598         LDKPersist ret = {
14599                 .this_arg = (void*) calls,
14600                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14601                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14602                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
14603                 .free = LDKPersist_JCalls_free,
14604         };
14605         return ret;
14606 }
14607 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
14608         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14609         *res_ptr = LDKPersist_init(o);
14610         return tag_ptr(res_ptr, true);
14611 }
14612 uint32_t  __attribute__((export_name("TS_Persist_persist_new_channel"))) TS_Persist_persist_new_channel(uint64_t this_arg, uint64_t channel_funding_outpoint, uint64_t data, uint64_t update_id) {
14613         void* this_arg_ptr = untag_ptr(this_arg);
14614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14615         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14616         LDKOutPoint channel_funding_outpoint_conv;
14617         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14618         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14619         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14620         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14621         LDKChannelMonitor data_conv;
14622         data_conv.inner = untag_ptr(data);
14623         data_conv.is_owned = ptr_is_owned(data);
14624         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14625         data_conv.is_owned = false;
14626         LDKMonitorUpdateId update_id_conv;
14627         update_id_conv.inner = untag_ptr(update_id);
14628         update_id_conv.is_owned = ptr_is_owned(update_id);
14629         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14630         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14631         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, &data_conv, update_id_conv));
14632         return ret_conv;
14633 }
14634
14635 uint32_t  __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS_Persist_update_persisted_channel(uint64_t this_arg, uint64_t channel_funding_outpoint, uint64_t update, uint64_t data, uint64_t update_id) {
14636         void* this_arg_ptr = untag_ptr(this_arg);
14637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14638         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14639         LDKOutPoint channel_funding_outpoint_conv;
14640         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14641         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14642         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14643         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14644         LDKChannelMonitorUpdate update_conv;
14645         update_conv.inner = untag_ptr(update);
14646         update_conv.is_owned = ptr_is_owned(update);
14647         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14648         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14649         LDKChannelMonitor data_conv;
14650         data_conv.inner = untag_ptr(data);
14651         data_conv.is_owned = ptr_is_owned(data);
14652         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14653         data_conv.is_owned = false;
14654         LDKMonitorUpdateId update_id_conv;
14655         update_id_conv.inner = untag_ptr(update_id);
14656         update_id_conv.is_owned = ptr_is_owned(update_id);
14657         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14658         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14659         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, update_conv, &data_conv, update_id_conv));
14660         return ret_conv;
14661 }
14662
14663 void  __attribute__((export_name("TS_Persist_archive_persisted_channel"))) TS_Persist_archive_persisted_channel(uint64_t this_arg, uint64_t channel_funding_outpoint) {
14664         void* this_arg_ptr = untag_ptr(this_arg);
14665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14666         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14667         LDKOutPoint channel_funding_outpoint_conv;
14668         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14669         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14670         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14671         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14672         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
14673 }
14674
14675 typedef struct LDKListen_JCalls {
14676         atomic_size_t refcnt;
14677         uint32_t instance_ptr;
14678 } LDKListen_JCalls;
14679 static void LDKListen_JCalls_free(void* this_arg) {
14680         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14681         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14682                 FREE(j_calls);
14683         }
14684 }
14685 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14686         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14687         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14688         memcpy(header_arr->elems, *header, 80);
14689         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14690         uint64_tArray txdata_arr = NULL;
14691         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
14692         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
14693         for (size_t c = 0; c < txdata_var.datalen; c++) {
14694                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14695                 *txdata_conv_28_conv = txdata_var.data[c];
14696                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14697         }
14698         
14699         FREE(txdata_var.data);
14700         int32_t height_conv = height;
14701         js_invoke_function_uuuuuu(j_calls->instance_ptr, 70, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
14702 }
14703 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14704         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14705         LDKu8slice block_var = block;
14706         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
14707         memcpy(block_arr->elems, block_var.data, block_var.datalen);
14708         int32_t height_conv = height;
14709         js_invoke_function_uuuuuu(j_calls->instance_ptr, 71, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
14710 }
14711 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14712         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14713         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14714         memcpy(header_arr->elems, *header, 80);
14715         int32_t height_conv = height;
14716         js_invoke_function_uuuuuu(j_calls->instance_ptr, 72, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
14717 }
14718 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14719         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14720         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14721 }
14722 static inline LDKListen LDKListen_init (JSValue o) {
14723         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14724         atomic_init(&calls->refcnt, 1);
14725         calls->instance_ptr = o;
14726
14727         LDKListen ret = {
14728                 .this_arg = (void*) calls,
14729                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14730                 .block_connected = block_connected_LDKListen_jcall,
14731                 .block_disconnected = block_disconnected_LDKListen_jcall,
14732                 .free = LDKListen_JCalls_free,
14733         };
14734         return ret;
14735 }
14736 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
14737         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14738         *res_ptr = LDKListen_init(o);
14739         return tag_ptr(res_ptr, true);
14740 }
14741 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) {
14742         void* this_arg_ptr = untag_ptr(this_arg);
14743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14744         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14745         uint8_t header_arr[80];
14746         CHECK(header->arr_len == 80);
14747         memcpy(header_arr, header->elems, 80); FREE(header);
14748         uint8_t (*header_ref)[80] = &header_arr;
14749         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14750         txdata_constr.datalen = txdata->arr_len;
14751         if (txdata_constr.datalen > 0)
14752                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14753         else
14754                 txdata_constr.data = NULL;
14755         uint64_t* txdata_vals = txdata->elems;
14756         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14757                 uint64_t txdata_conv_28 = txdata_vals[c];
14758                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14759                 CHECK_ACCESS(txdata_conv_28_ptr);
14760                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14761                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14762                 txdata_constr.data[c] = txdata_conv_28_conv;
14763         }
14764         FREE(txdata);
14765         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14766 }
14767
14768 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
14769         void* this_arg_ptr = untag_ptr(this_arg);
14770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14771         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14772         LDKu8slice block_ref;
14773         block_ref.datalen = block->arr_len;
14774         block_ref.data = block->elems;
14775         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
14776         FREE(block);
14777 }
14778
14779 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
14780         void* this_arg_ptr = untag_ptr(this_arg);
14781         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14782         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14783         uint8_t header_arr[80];
14784         CHECK(header->arr_len == 80);
14785         memcpy(header_arr, header->elems, 80); FREE(header);
14786         uint8_t (*header_ref)[80] = &header_arr;
14787         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
14788 }
14789
14790 typedef struct LDKConfirm_JCalls {
14791         atomic_size_t refcnt;
14792         uint32_t instance_ptr;
14793 } LDKConfirm_JCalls;
14794 static void LDKConfirm_JCalls_free(void* this_arg) {
14795         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14796         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14797                 FREE(j_calls);
14798         }
14799 }
14800 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14801         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14802         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14803         memcpy(header_arr->elems, *header, 80);
14804         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14805         uint64_tArray txdata_arr = NULL;
14806         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
14807         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
14808         for (size_t c = 0; c < txdata_var.datalen; c++) {
14809                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14810                 *txdata_conv_28_conv = txdata_var.data[c];
14811                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14812         }
14813         
14814         FREE(txdata_var.data);
14815         int32_t height_conv = height;
14816         js_invoke_function_uuuuuu(j_calls->instance_ptr, 73, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
14817 }
14818 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
14819         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14820         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
14821         memcpy(txid_arr->elems, *txid, 32);
14822         js_invoke_function_uuuuuu(j_calls->instance_ptr, 74, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
14823 }
14824 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14825         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14826         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14827         memcpy(header_arr->elems, *header, 80);
14828         int32_t height_conv = height;
14829         js_invoke_function_uuuuuu(j_calls->instance_ptr, 75, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
14830 }
14831 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
14832         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14833         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 76, 0, 0, 0, 0, 0, 0);
14834         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
14835         ret_constr.datalen = ret->arr_len;
14836         if (ret_constr.datalen > 0)
14837                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
14838         else
14839                 ret_constr.data = NULL;
14840         uint64_t* ret_vals = ret->elems;
14841         for (size_t c = 0; c < ret_constr.datalen; c++) {
14842                 uint64_t ret_conv_54 = ret_vals[c];
14843                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
14844                 CHECK_ACCESS(ret_conv_54_ptr);
14845                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
14846                 FREE(untag_ptr(ret_conv_54));
14847                 ret_constr.data[c] = ret_conv_54_conv;
14848         }
14849         FREE(ret);
14850         return ret_constr;
14851 }
14852 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
14853         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
14854         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14855 }
14856 static inline LDKConfirm LDKConfirm_init (JSValue o) {
14857         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
14858         atomic_init(&calls->refcnt, 1);
14859         calls->instance_ptr = o;
14860
14861         LDKConfirm ret = {
14862                 .this_arg = (void*) calls,
14863                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
14864                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
14865                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
14866                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
14867                 .free = LDKConfirm_JCalls_free,
14868         };
14869         return ret;
14870 }
14871 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
14872         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14873         *res_ptr = LDKConfirm_init(o);
14874         return tag_ptr(res_ptr, true);
14875 }
14876 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) {
14877         void* this_arg_ptr = untag_ptr(this_arg);
14878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14879         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14880         uint8_t header_arr[80];
14881         CHECK(header->arr_len == 80);
14882         memcpy(header_arr, header->elems, 80); FREE(header);
14883         uint8_t (*header_ref)[80] = &header_arr;
14884         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14885         txdata_constr.datalen = txdata->arr_len;
14886         if (txdata_constr.datalen > 0)
14887                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14888         else
14889                 txdata_constr.data = NULL;
14890         uint64_t* txdata_vals = txdata->elems;
14891         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14892                 uint64_t txdata_conv_28 = txdata_vals[c];
14893                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14894                 CHECK_ACCESS(txdata_conv_28_ptr);
14895                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14896                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14897                 txdata_constr.data[c] = txdata_conv_28_conv;
14898         }
14899         FREE(txdata);
14900         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14901 }
14902
14903 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
14904         void* this_arg_ptr = untag_ptr(this_arg);
14905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14906         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14907         uint8_t txid_arr[32];
14908         CHECK(txid->arr_len == 32);
14909         memcpy(txid_arr, txid->elems, 32); FREE(txid);
14910         uint8_t (*txid_ref)[32] = &txid_arr;
14911         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
14912 }
14913
14914 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
14915         void* this_arg_ptr = untag_ptr(this_arg);
14916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14917         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14918         uint8_t header_arr[80];
14919         CHECK(header->arr_len == 80);
14920         memcpy(header_arr, header->elems, 80); FREE(header);
14921         uint8_t (*header_ref)[80] = &header_arr;
14922         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
14923 }
14924
14925 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
14926         void* this_arg_ptr = untag_ptr(this_arg);
14927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14928         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14929         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
14930         uint64_tArray ret_arr = NULL;
14931         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
14932         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
14933         for (size_t c = 0; c < ret_var.datalen; c++) {
14934                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
14935                 *ret_conv_54_conv = ret_var.data[c];
14936                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
14937         }
14938         
14939         FREE(ret_var.data);
14940         return ret_arr;
14941 }
14942
14943 uint32_t __attribute__((export_name("TS_LDKSpendingDelay_ty_from_ptr"))) TS_LDKSpendingDelay_ty_from_ptr(uint64_t ptr) {
14944         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14945         switch(obj->tag) {
14946                 case LDKSpendingDelay_Relative: return 0;
14947                 case LDKSpendingDelay_Absolute: return 1;
14948                 default: abort();
14949         }
14950 }
14951 int32_t __attribute__((export_name("TS_LDKSpendingDelay_Relative_get_num_blocks"))) TS_LDKSpendingDelay_Relative_get_num_blocks(uint64_t ptr) {
14952         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14953         assert(obj->tag == LDKSpendingDelay_Relative);
14954         int32_t num_blocks_conv = obj->relative.num_blocks;
14955         return num_blocks_conv;
14956 }
14957 int32_t __attribute__((export_name("TS_LDKSpendingDelay_Absolute_get_height"))) TS_LDKSpendingDelay_Absolute_get_height(uint64_t ptr) {
14958         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
14959         assert(obj->tag == LDKSpendingDelay_Absolute);
14960         int32_t height_conv = obj->absolute.height;
14961         return height_conv;
14962 }
14963 typedef struct LDKFutureCallback_JCalls {
14964         atomic_size_t refcnt;
14965         uint32_t instance_ptr;
14966 } LDKFutureCallback_JCalls;
14967 static void LDKFutureCallback_JCalls_free(void* this_arg) {
14968         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14969         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14970                 FREE(j_calls);
14971         }
14972 }
14973 void call_LDKFutureCallback_jcall(const void* this_arg) {
14974         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14975         js_invoke_function_uuuuuu(j_calls->instance_ptr, 77, 0, 0, 0, 0, 0, 0);
14976 }
14977 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
14978         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
14979         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14980 }
14981 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
14982         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
14983         atomic_init(&calls->refcnt, 1);
14984         calls->instance_ptr = o;
14985
14986         LDKFutureCallback ret = {
14987                 .this_arg = (void*) calls,
14988                 .call = call_LDKFutureCallback_jcall,
14989                 .free = LDKFutureCallback_JCalls_free,
14990         };
14991         return ret;
14992 }
14993 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
14994         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
14995         *res_ptr = LDKFutureCallback_init(o);
14996         return tag_ptr(res_ptr, true);
14997 }
14998 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
14999         void* this_arg_ptr = untag_ptr(this_arg);
15000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15001         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15002         (this_arg_conv->call)(this_arg_conv->this_arg);
15003 }
15004
15005 typedef struct LDKEventHandler_JCalls {
15006         atomic_size_t refcnt;
15007         uint32_t instance_ptr;
15008 } LDKEventHandler_JCalls;
15009 static void LDKEventHandler_JCalls_free(void* this_arg) {
15010         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15011         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15012                 FREE(j_calls);
15013         }
15014 }
15015 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
15016         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15017         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15018         *event_copy = event;
15019         uint64_t event_ref = tag_ptr(event_copy, true);
15020         js_invoke_function_buuuuu(j_calls->instance_ptr, 78, event_ref, 0, 0, 0, 0, 0);
15021 }
15022 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
15023         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
15024         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15025 }
15026 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
15027         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
15028         atomic_init(&calls->refcnt, 1);
15029         calls->instance_ptr = o;
15030
15031         LDKEventHandler ret = {
15032                 .this_arg = (void*) calls,
15033                 .handle_event = handle_event_LDKEventHandler_jcall,
15034                 .free = LDKEventHandler_JCalls_free,
15035         };
15036         return ret;
15037 }
15038 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
15039         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15040         *res_ptr = LDKEventHandler_init(o);
15041         return tag_ptr(res_ptr, true);
15042 }
15043 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
15044         void* this_arg_ptr = untag_ptr(this_arg);
15045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15046         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
15047         void* event_ptr = untag_ptr(event);
15048         CHECK_ACCESS(event_ptr);
15049         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
15050         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
15051         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
15052 }
15053
15054 typedef struct LDKEventsProvider_JCalls {
15055         atomic_size_t refcnt;
15056         uint32_t instance_ptr;
15057 } LDKEventsProvider_JCalls;
15058 static void LDKEventsProvider_JCalls_free(void* this_arg) {
15059         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15060         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15061                 FREE(j_calls);
15062         }
15063 }
15064 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
15065         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15066         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15067         *handler_ret = handler;
15068         js_invoke_function_buuuuu(j_calls->instance_ptr, 79, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
15069 }
15070 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
15071         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
15072         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15073 }
15074 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
15075         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
15076         atomic_init(&calls->refcnt, 1);
15077         calls->instance_ptr = o;
15078
15079         LDKEventsProvider ret = {
15080                 .this_arg = (void*) calls,
15081                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
15082                 .free = LDKEventsProvider_JCalls_free,
15083         };
15084         return ret;
15085 }
15086 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
15087         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15088         *res_ptr = LDKEventsProvider_init(o);
15089         return tag_ptr(res_ptr, true);
15090 }
15091 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
15092         void* this_arg_ptr = untag_ptr(this_arg);
15093         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15094         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
15095         void* handler_ptr = untag_ptr(handler);
15096         CHECK_ACCESS(handler_ptr);
15097         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
15098         if (handler_conv.free == LDKEventHandler_JCalls_free) {
15099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15100                 LDKEventHandler_JCalls_cloned(&handler_conv);
15101         }
15102         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
15103 }
15104
15105 uint32_t __attribute__((export_name("TS_LDKFailureCode_ty_from_ptr"))) TS_LDKFailureCode_ty_from_ptr(uint64_t ptr) {
15106         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15107         switch(obj->tag) {
15108                 case LDKFailureCode_TemporaryNodeFailure: return 0;
15109                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
15110                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
15111                 case LDKFailureCode_InvalidOnionPayload: return 3;
15112                 default: abort();
15113         }
15114 }
15115 uint64_t __attribute__((export_name("TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload"))) TS_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(uint64_t ptr) {
15116         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15117         assert(obj->tag == LDKFailureCode_InvalidOnionPayload);
15118         uint64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
15119         return invalid_onion_payload_ref;
15120 }
15121 typedef struct LDKMessageSendEventsProvider_JCalls {
15122         atomic_size_t refcnt;
15123         uint32_t instance_ptr;
15124 } LDKMessageSendEventsProvider_JCalls;
15125 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
15126         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15127         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15128                 FREE(j_calls);
15129         }
15130 }
15131 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
15132         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15133         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, 0, 0, 0, 0, 0, 0);
15134         LDKCVec_MessageSendEventZ ret_constr;
15135         ret_constr.datalen = ret->arr_len;
15136         if (ret_constr.datalen > 0)
15137                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15138         else
15139                 ret_constr.data = NULL;
15140         uint64_t* ret_vals = ret->elems;
15141         for (size_t s = 0; s < ret_constr.datalen; s++) {
15142                 uint64_t ret_conv_18 = ret_vals[s];
15143                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
15144                 CHECK_ACCESS(ret_conv_18_ptr);
15145                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
15146                 FREE(untag_ptr(ret_conv_18));
15147                 ret_constr.data[s] = ret_conv_18_conv;
15148         }
15149         FREE(ret);
15150         return ret_constr;
15151 }
15152 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
15153         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15154         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15155 }
15156 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
15157         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
15158         atomic_init(&calls->refcnt, 1);
15159         calls->instance_ptr = o;
15160
15161         LDKMessageSendEventsProvider ret = {
15162                 .this_arg = (void*) calls,
15163                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
15164                 .free = LDKMessageSendEventsProvider_JCalls_free,
15165         };
15166         return ret;
15167 }
15168 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
15169         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15170         *res_ptr = LDKMessageSendEventsProvider_init(o);
15171         return tag_ptr(res_ptr, true);
15172 }
15173 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) {
15174         void* this_arg_ptr = untag_ptr(this_arg);
15175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15176         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
15177         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
15178         uint64_tArray ret_arr = NULL;
15179         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
15180         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
15181         for (size_t s = 0; s < ret_var.datalen; s++) {
15182                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15183                 *ret_conv_18_copy = ret_var.data[s];
15184                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15185                 ret_arr_ptr[s] = ret_conv_18_ref;
15186         }
15187         
15188         FREE(ret_var.data);
15189         return ret_arr;
15190 }
15191
15192 typedef struct LDKChannelMessageHandler_JCalls {
15193         atomic_size_t refcnt;
15194         uint32_t instance_ptr;
15195         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15196 } LDKChannelMessageHandler_JCalls;
15197 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15198         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15199         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15200                 FREE(j_calls);
15201         }
15202 }
15203 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15204         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15205         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15206         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15207         LDKOpenChannel msg_var = *msg;
15208         uint64_t msg_ref = 0;
15209         msg_var = OpenChannel_clone(&msg_var);
15210         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15211         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15212         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15213 }
15214 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15215         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15216         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15217         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15218         LDKOpenChannelV2 msg_var = *msg;
15219         uint64_t msg_ref = 0;
15220         msg_var = OpenChannelV2_clone(&msg_var);
15221         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15222         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15223         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15224 }
15225 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15226         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15227         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15228         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15229         LDKAcceptChannel msg_var = *msg;
15230         uint64_t msg_ref = 0;
15231         msg_var = AcceptChannel_clone(&msg_var);
15232         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15233         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15234         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15235 }
15236 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15237         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15238         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15239         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15240         LDKAcceptChannelV2 msg_var = *msg;
15241         uint64_t msg_ref = 0;
15242         msg_var = AcceptChannelV2_clone(&msg_var);
15243         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15244         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15245         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15246 }
15247 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15248         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15249         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15250         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15251         LDKFundingCreated msg_var = *msg;
15252         uint64_t msg_ref = 0;
15253         msg_var = FundingCreated_clone(&msg_var);
15254         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15255         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15256         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15257 }
15258 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15259         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15260         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15261         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15262         LDKFundingSigned msg_var = *msg;
15263         uint64_t msg_ref = 0;
15264         msg_var = FundingSigned_clone(&msg_var);
15265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15266         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15267         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15268 }
15269 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15270         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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         LDKChannelReady msg_var = *msg;
15274         uint64_t msg_ref = 0;
15275         msg_var = ChannelReady_clone(&msg_var);
15276         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15277         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15278         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15279 }
15280 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15281         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15282         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15283         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15284         LDKShutdown msg_var = *msg;
15285         uint64_t msg_ref = 0;
15286         msg_var = Shutdown_clone(&msg_var);
15287         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15288         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15289         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15290 }
15291 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15292         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15293         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15294         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15295         LDKClosingSigned msg_var = *msg;
15296         uint64_t msg_ref = 0;
15297         msg_var = ClosingSigned_clone(&msg_var);
15298         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15299         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15300         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15301 }
15302 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
15303         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15304         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15305         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15306         LDKStfu msg_var = *msg;
15307         uint64_t msg_ref = 0;
15308         msg_var = Stfu_clone(&msg_var);
15309         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15310         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15311         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15312 }
15313 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15314         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15315         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15316         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15317         LDKTxAddInput msg_var = *msg;
15318         uint64_t msg_ref = 0;
15319         msg_var = TxAddInput_clone(&msg_var);
15320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15321         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15322         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15323 }
15324 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15325         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15326         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15327         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15328         LDKTxAddOutput msg_var = *msg;
15329         uint64_t msg_ref = 0;
15330         msg_var = TxAddOutput_clone(&msg_var);
15331         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15332         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15333         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15334 }
15335 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15336         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15337         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15338         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15339         LDKTxRemoveInput msg_var = *msg;
15340         uint64_t msg_ref = 0;
15341         msg_var = TxRemoveInput_clone(&msg_var);
15342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15343         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15344         js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15345 }
15346 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15347         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15348         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15349         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15350         LDKTxRemoveOutput msg_var = *msg;
15351         uint64_t msg_ref = 0;
15352         msg_var = TxRemoveOutput_clone(&msg_var);
15353         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15354         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15355         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15356 }
15357 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15358         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15359         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15360         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15361         LDKTxComplete msg_var = *msg;
15362         uint64_t msg_ref = 0;
15363         msg_var = TxComplete_clone(&msg_var);
15364         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15365         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15366         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15367 }
15368 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15369         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15370         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15371         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15372         LDKTxSignatures msg_var = *msg;
15373         uint64_t msg_ref = 0;
15374         msg_var = TxSignatures_clone(&msg_var);
15375         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15376         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15377         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15378 }
15379 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15380         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15381         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15382         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15383         LDKTxInitRbf msg_var = *msg;
15384         uint64_t msg_ref = 0;
15385         msg_var = TxInitRbf_clone(&msg_var);
15386         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15387         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15388         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15389 }
15390 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15391         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15392         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15393         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15394         LDKTxAckRbf msg_var = *msg;
15395         uint64_t msg_ref = 0;
15396         msg_var = TxAckRbf_clone(&msg_var);
15397         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15398         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15399         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15400 }
15401 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15402         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15403         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15404         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15405         LDKTxAbort msg_var = *msg;
15406         uint64_t msg_ref = 0;
15407         msg_var = TxAbort_clone(&msg_var);
15408         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15409         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15410         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15411 }
15412 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15413         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15414         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15415         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15416         LDKUpdateAddHTLC msg_var = *msg;
15417         uint64_t msg_ref = 0;
15418         msg_var = UpdateAddHTLC_clone(&msg_var);
15419         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15420         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15421         js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15422 }
15423 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15424         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15425         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15426         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15427         LDKUpdateFulfillHTLC msg_var = *msg;
15428         uint64_t msg_ref = 0;
15429         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15430         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15431         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15432         js_invoke_function_ubuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15433 }
15434 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15435         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15436         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15437         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15438         LDKUpdateFailHTLC msg_var = *msg;
15439         uint64_t msg_ref = 0;
15440         msg_var = UpdateFailHTLC_clone(&msg_var);
15441         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15442         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15443         js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15444 }
15445 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15446         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15447         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15448         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15449         LDKUpdateFailMalformedHTLC msg_var = *msg;
15450         uint64_t msg_ref = 0;
15451         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15452         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15453         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15454         js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15455 }
15456 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15457         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15458         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15459         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15460         LDKCommitmentSigned msg_var = *msg;
15461         uint64_t msg_ref = 0;
15462         msg_var = CommitmentSigned_clone(&msg_var);
15463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15464         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15465         js_invoke_function_ubuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15466 }
15467 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15468         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15469         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15470         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15471         LDKRevokeAndACK msg_var = *msg;
15472         uint64_t msg_ref = 0;
15473         msg_var = RevokeAndACK_clone(&msg_var);
15474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15475         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15476         js_invoke_function_ubuuuu(j_calls->instance_ptr, 105, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15477 }
15478 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15479         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15480         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15481         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15482         LDKUpdateFee msg_var = *msg;
15483         uint64_t msg_ref = 0;
15484         msg_var = UpdateFee_clone(&msg_var);
15485         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15486         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15487         js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15488 }
15489 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15490         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15491         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15492         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15493         LDKAnnouncementSignatures msg_var = *msg;
15494         uint64_t msg_ref = 0;
15495         msg_var = AnnouncementSignatures_clone(&msg_var);
15496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15497         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15498         js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15499 }
15500 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15501         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15502         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15503         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15504         js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15505 }
15506 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15507         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15508         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15509         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15510         LDKInit msg_var = *msg;
15511         uint64_t msg_ref = 0;
15512         msg_var = Init_clone(&msg_var);
15513         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15514         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15515         jboolean inbound_conv = inbound;
15516         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);
15517         void* ret_ptr = untag_ptr(ret);
15518         CHECK_ACCESS(ret_ptr);
15519         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15520         FREE(untag_ptr(ret));
15521         return ret_conv;
15522 }
15523 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15524         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15525         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15526         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15527         LDKChannelReestablish msg_var = *msg;
15528         uint64_t msg_ref = 0;
15529         msg_var = ChannelReestablish_clone(&msg_var);
15530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15531         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15532         js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15533 }
15534 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15535         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15536         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15537         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15538         LDKChannelUpdate msg_var = *msg;
15539         uint64_t msg_ref = 0;
15540         msg_var = ChannelUpdate_clone(&msg_var);
15541         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15542         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15543         js_invoke_function_ubuuuu(j_calls->instance_ptr, 111, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15544 }
15545 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15546         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15547         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15548         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15549         LDKErrorMessage msg_var = *msg;
15550         uint64_t msg_ref = 0;
15551         msg_var = ErrorMessage_clone(&msg_var);
15552         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15553         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15554         js_invoke_function_ubuuuu(j_calls->instance_ptr, 112, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
15555 }
15556 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15557         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15558         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
15559         LDKNodeFeatures ret_conv;
15560         ret_conv.inner = untag_ptr(ret);
15561         ret_conv.is_owned = ptr_is_owned(ret);
15562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15563         return ret_conv;
15564 }
15565 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15566         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15567         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15568         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15569         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
15570         LDKInitFeatures ret_conv;
15571         ret_conv.inner = untag_ptr(ret);
15572         ret_conv.is_owned = ptr_is_owned(ret);
15573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15574         return ret_conv;
15575 }
15576 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15577         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15578         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0);
15579         void* ret_ptr = untag_ptr(ret);
15580         CHECK_ACCESS(ret_ptr);
15581         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
15582         FREE(untag_ptr(ret));
15583         return ret_conv;
15584 }
15585 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
15586         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
15587         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15588         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15589 }
15590 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
15591         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
15592         atomic_init(&calls->refcnt, 1);
15593         calls->instance_ptr = o;
15594
15595         LDKChannelMessageHandler ret = {
15596                 .this_arg = (void*) calls,
15597                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
15598                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
15599                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
15600                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
15601                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
15602                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
15603                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
15604                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
15605                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
15606                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
15607                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
15608                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
15609                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
15610                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
15611                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
15612                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
15613                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
15614                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
15615                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
15616                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
15617                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
15618                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
15619                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
15620                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
15621                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
15622                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
15623                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
15624                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
15625                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
15626                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
15627                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
15628                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
15629                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
15630                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
15631                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
15632                 .free = LDKChannelMessageHandler_JCalls_free,
15633                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15634         };
15635         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15636         return ret;
15637 }
15638 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
15639         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15640         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
15641         return tag_ptr(res_ptr, true);
15642 }
15643 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) {
15644         void* this_arg_ptr = untag_ptr(this_arg);
15645         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15646         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15647         LDKPublicKey their_node_id_ref;
15648         CHECK(their_node_id->arr_len == 33);
15649         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15650         LDKOpenChannel msg_conv;
15651         msg_conv.inner = untag_ptr(msg);
15652         msg_conv.is_owned = ptr_is_owned(msg);
15653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15654         msg_conv.is_owned = false;
15655         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15656 }
15657
15658 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) {
15659         void* this_arg_ptr = untag_ptr(this_arg);
15660         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15661         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15662         LDKPublicKey their_node_id_ref;
15663         CHECK(their_node_id->arr_len == 33);
15664         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15665         LDKOpenChannelV2 msg_conv;
15666         msg_conv.inner = untag_ptr(msg);
15667         msg_conv.is_owned = ptr_is_owned(msg);
15668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15669         msg_conv.is_owned = false;
15670         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15671 }
15672
15673 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) {
15674         void* this_arg_ptr = untag_ptr(this_arg);
15675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15676         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15677         LDKPublicKey their_node_id_ref;
15678         CHECK(their_node_id->arr_len == 33);
15679         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15680         LDKAcceptChannel msg_conv;
15681         msg_conv.inner = untag_ptr(msg);
15682         msg_conv.is_owned = ptr_is_owned(msg);
15683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15684         msg_conv.is_owned = false;
15685         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15686 }
15687
15688 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) {
15689         void* this_arg_ptr = untag_ptr(this_arg);
15690         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15691         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15692         LDKPublicKey their_node_id_ref;
15693         CHECK(their_node_id->arr_len == 33);
15694         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15695         LDKAcceptChannelV2 msg_conv;
15696         msg_conv.inner = untag_ptr(msg);
15697         msg_conv.is_owned = ptr_is_owned(msg);
15698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15699         msg_conv.is_owned = false;
15700         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15701 }
15702
15703 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) {
15704         void* this_arg_ptr = untag_ptr(this_arg);
15705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15706         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15707         LDKPublicKey their_node_id_ref;
15708         CHECK(their_node_id->arr_len == 33);
15709         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15710         LDKFundingCreated msg_conv;
15711         msg_conv.inner = untag_ptr(msg);
15712         msg_conv.is_owned = ptr_is_owned(msg);
15713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15714         msg_conv.is_owned = false;
15715         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15716 }
15717
15718 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) {
15719         void* this_arg_ptr = untag_ptr(this_arg);
15720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15721         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15722         LDKPublicKey their_node_id_ref;
15723         CHECK(their_node_id->arr_len == 33);
15724         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15725         LDKFundingSigned msg_conv;
15726         msg_conv.inner = untag_ptr(msg);
15727         msg_conv.is_owned = ptr_is_owned(msg);
15728         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15729         msg_conv.is_owned = false;
15730         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15731 }
15732
15733 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) {
15734         void* this_arg_ptr = untag_ptr(this_arg);
15735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15736         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15737         LDKPublicKey their_node_id_ref;
15738         CHECK(their_node_id->arr_len == 33);
15739         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15740         LDKChannelReady msg_conv;
15741         msg_conv.inner = untag_ptr(msg);
15742         msg_conv.is_owned = ptr_is_owned(msg);
15743         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15744         msg_conv.is_owned = false;
15745         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15746 }
15747
15748 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15749         void* this_arg_ptr = untag_ptr(this_arg);
15750         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15751         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15752         LDKPublicKey their_node_id_ref;
15753         CHECK(their_node_id->arr_len == 33);
15754         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15755         LDKShutdown msg_conv;
15756         msg_conv.inner = untag_ptr(msg);
15757         msg_conv.is_owned = ptr_is_owned(msg);
15758         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15759         msg_conv.is_owned = false;
15760         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15761 }
15762
15763 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) {
15764         void* this_arg_ptr = untag_ptr(this_arg);
15765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15766         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15767         LDKPublicKey their_node_id_ref;
15768         CHECK(their_node_id->arr_len == 33);
15769         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15770         LDKClosingSigned msg_conv;
15771         msg_conv.inner = untag_ptr(msg);
15772         msg_conv.is_owned = ptr_is_owned(msg);
15773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15774         msg_conv.is_owned = false;
15775         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15776 }
15777
15778 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_stfu"))) TS_ChannelMessageHandler_handle_stfu(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
15779         void* this_arg_ptr = untag_ptr(this_arg);
15780         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15781         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15782         LDKPublicKey their_node_id_ref;
15783         CHECK(their_node_id->arr_len == 33);
15784         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15785         LDKStfu msg_conv;
15786         msg_conv.inner = untag_ptr(msg);
15787         msg_conv.is_owned = ptr_is_owned(msg);
15788         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15789         msg_conv.is_owned = false;
15790         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15791 }
15792
15793 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) {
15794         void* this_arg_ptr = untag_ptr(this_arg);
15795         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15796         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15797         LDKPublicKey their_node_id_ref;
15798         CHECK(their_node_id->arr_len == 33);
15799         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15800         LDKTxAddInput msg_conv;
15801         msg_conv.inner = untag_ptr(msg);
15802         msg_conv.is_owned = ptr_is_owned(msg);
15803         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15804         msg_conv.is_owned = false;
15805         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15806 }
15807
15808 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) {
15809         void* this_arg_ptr = untag_ptr(this_arg);
15810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15811         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15812         LDKPublicKey their_node_id_ref;
15813         CHECK(their_node_id->arr_len == 33);
15814         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15815         LDKTxAddOutput msg_conv;
15816         msg_conv.inner = untag_ptr(msg);
15817         msg_conv.is_owned = ptr_is_owned(msg);
15818         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15819         msg_conv.is_owned = false;
15820         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15821 }
15822
15823 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) {
15824         void* this_arg_ptr = untag_ptr(this_arg);
15825         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15826         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15827         LDKPublicKey their_node_id_ref;
15828         CHECK(their_node_id->arr_len == 33);
15829         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15830         LDKTxRemoveInput msg_conv;
15831         msg_conv.inner = untag_ptr(msg);
15832         msg_conv.is_owned = ptr_is_owned(msg);
15833         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15834         msg_conv.is_owned = false;
15835         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15836 }
15837
15838 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) {
15839         void* this_arg_ptr = untag_ptr(this_arg);
15840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15841         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15842         LDKPublicKey their_node_id_ref;
15843         CHECK(their_node_id->arr_len == 33);
15844         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15845         LDKTxRemoveOutput msg_conv;
15846         msg_conv.inner = untag_ptr(msg);
15847         msg_conv.is_owned = ptr_is_owned(msg);
15848         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15849         msg_conv.is_owned = false;
15850         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15851 }
15852
15853 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) {
15854         void* this_arg_ptr = untag_ptr(this_arg);
15855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15856         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15857         LDKPublicKey their_node_id_ref;
15858         CHECK(their_node_id->arr_len == 33);
15859         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15860         LDKTxComplete msg_conv;
15861         msg_conv.inner = untag_ptr(msg);
15862         msg_conv.is_owned = ptr_is_owned(msg);
15863         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15864         msg_conv.is_owned = false;
15865         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15866 }
15867
15868 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) {
15869         void* this_arg_ptr = untag_ptr(this_arg);
15870         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15871         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15872         LDKPublicKey their_node_id_ref;
15873         CHECK(their_node_id->arr_len == 33);
15874         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15875         LDKTxSignatures msg_conv;
15876         msg_conv.inner = untag_ptr(msg);
15877         msg_conv.is_owned = ptr_is_owned(msg);
15878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15879         msg_conv.is_owned = false;
15880         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15881 }
15882
15883 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) {
15884         void* this_arg_ptr = untag_ptr(this_arg);
15885         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15886         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15887         LDKPublicKey their_node_id_ref;
15888         CHECK(their_node_id->arr_len == 33);
15889         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15890         LDKTxInitRbf msg_conv;
15891         msg_conv.inner = untag_ptr(msg);
15892         msg_conv.is_owned = ptr_is_owned(msg);
15893         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15894         msg_conv.is_owned = false;
15895         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15896 }
15897
15898 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) {
15899         void* this_arg_ptr = untag_ptr(this_arg);
15900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15901         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15902         LDKPublicKey their_node_id_ref;
15903         CHECK(their_node_id->arr_len == 33);
15904         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15905         LDKTxAckRbf msg_conv;
15906         msg_conv.inner = untag_ptr(msg);
15907         msg_conv.is_owned = ptr_is_owned(msg);
15908         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15909         msg_conv.is_owned = false;
15910         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15911 }
15912
15913 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) {
15914         void* this_arg_ptr = untag_ptr(this_arg);
15915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15916         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15917         LDKPublicKey their_node_id_ref;
15918         CHECK(their_node_id->arr_len == 33);
15919         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15920         LDKTxAbort msg_conv;
15921         msg_conv.inner = untag_ptr(msg);
15922         msg_conv.is_owned = ptr_is_owned(msg);
15923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15924         msg_conv.is_owned = false;
15925         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15926 }
15927
15928 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) {
15929         void* this_arg_ptr = untag_ptr(this_arg);
15930         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15931         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15932         LDKPublicKey their_node_id_ref;
15933         CHECK(their_node_id->arr_len == 33);
15934         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15935         LDKUpdateAddHTLC msg_conv;
15936         msg_conv.inner = untag_ptr(msg);
15937         msg_conv.is_owned = ptr_is_owned(msg);
15938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15939         msg_conv.is_owned = false;
15940         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15941 }
15942
15943 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) {
15944         void* this_arg_ptr = untag_ptr(this_arg);
15945         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15946         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15947         LDKPublicKey their_node_id_ref;
15948         CHECK(their_node_id->arr_len == 33);
15949         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15950         LDKUpdateFulfillHTLC msg_conv;
15951         msg_conv.inner = untag_ptr(msg);
15952         msg_conv.is_owned = ptr_is_owned(msg);
15953         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15954         msg_conv.is_owned = false;
15955         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15956 }
15957
15958 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) {
15959         void* this_arg_ptr = untag_ptr(this_arg);
15960         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15961         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15962         LDKPublicKey their_node_id_ref;
15963         CHECK(their_node_id->arr_len == 33);
15964         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15965         LDKUpdateFailHTLC msg_conv;
15966         msg_conv.inner = untag_ptr(msg);
15967         msg_conv.is_owned = ptr_is_owned(msg);
15968         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15969         msg_conv.is_owned = false;
15970         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15971 }
15972
15973 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) {
15974         void* this_arg_ptr = untag_ptr(this_arg);
15975         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15976         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15977         LDKPublicKey their_node_id_ref;
15978         CHECK(their_node_id->arr_len == 33);
15979         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15980         LDKUpdateFailMalformedHTLC msg_conv;
15981         msg_conv.inner = untag_ptr(msg);
15982         msg_conv.is_owned = ptr_is_owned(msg);
15983         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15984         msg_conv.is_owned = false;
15985         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15986 }
15987
15988 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) {
15989         void* this_arg_ptr = untag_ptr(this_arg);
15990         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15991         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15992         LDKPublicKey their_node_id_ref;
15993         CHECK(their_node_id->arr_len == 33);
15994         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15995         LDKCommitmentSigned msg_conv;
15996         msg_conv.inner = untag_ptr(msg);
15997         msg_conv.is_owned = ptr_is_owned(msg);
15998         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15999         msg_conv.is_owned = false;
16000         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16001 }
16002
16003 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) {
16004         void* this_arg_ptr = untag_ptr(this_arg);
16005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16006         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16007         LDKPublicKey their_node_id_ref;
16008         CHECK(their_node_id->arr_len == 33);
16009         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16010         LDKRevokeAndACK msg_conv;
16011         msg_conv.inner = untag_ptr(msg);
16012         msg_conv.is_owned = ptr_is_owned(msg);
16013         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16014         msg_conv.is_owned = false;
16015         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16016 }
16017
16018 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) {
16019         void* this_arg_ptr = untag_ptr(this_arg);
16020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16021         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16022         LDKPublicKey their_node_id_ref;
16023         CHECK(their_node_id->arr_len == 33);
16024         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16025         LDKUpdateFee msg_conv;
16026         msg_conv.inner = untag_ptr(msg);
16027         msg_conv.is_owned = ptr_is_owned(msg);
16028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16029         msg_conv.is_owned = false;
16030         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16031 }
16032
16033 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) {
16034         void* this_arg_ptr = untag_ptr(this_arg);
16035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16036         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16037         LDKPublicKey their_node_id_ref;
16038         CHECK(their_node_id->arr_len == 33);
16039         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16040         LDKAnnouncementSignatures msg_conv;
16041         msg_conv.inner = untag_ptr(msg);
16042         msg_conv.is_owned = ptr_is_owned(msg);
16043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16044         msg_conv.is_owned = false;
16045         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16046 }
16047
16048 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
16049         void* this_arg_ptr = untag_ptr(this_arg);
16050         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16051         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16052         LDKPublicKey their_node_id_ref;
16053         CHECK(their_node_id->arr_len == 33);
16054         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16055         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16056 }
16057
16058 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) {
16059         void* this_arg_ptr = untag_ptr(this_arg);
16060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16061         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16062         LDKPublicKey their_node_id_ref;
16063         CHECK(their_node_id->arr_len == 33);
16064         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16065         LDKInit msg_conv;
16066         msg_conv.inner = untag_ptr(msg);
16067         msg_conv.is_owned = ptr_is_owned(msg);
16068         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16069         msg_conv.is_owned = false;
16070         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16071         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
16072         return tag_ptr(ret_conv, true);
16073 }
16074
16075 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) {
16076         void* this_arg_ptr = untag_ptr(this_arg);
16077         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16078         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16079         LDKPublicKey their_node_id_ref;
16080         CHECK(their_node_id->arr_len == 33);
16081         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16082         LDKChannelReestablish msg_conv;
16083         msg_conv.inner = untag_ptr(msg);
16084         msg_conv.is_owned = ptr_is_owned(msg);
16085         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16086         msg_conv.is_owned = false;
16087         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16088 }
16089
16090 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) {
16091         void* this_arg_ptr = untag_ptr(this_arg);
16092         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16093         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16094         LDKPublicKey their_node_id_ref;
16095         CHECK(their_node_id->arr_len == 33);
16096         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16097         LDKChannelUpdate msg_conv;
16098         msg_conv.inner = untag_ptr(msg);
16099         msg_conv.is_owned = ptr_is_owned(msg);
16100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16101         msg_conv.is_owned = false;
16102         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16103 }
16104
16105 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
16106         void* this_arg_ptr = untag_ptr(this_arg);
16107         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16108         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16109         LDKPublicKey their_node_id_ref;
16110         CHECK(their_node_id->arr_len == 33);
16111         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16112         LDKErrorMessage msg_conv;
16113         msg_conv.inner = untag_ptr(msg);
16114         msg_conv.is_owned = ptr_is_owned(msg);
16115         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16116         msg_conv.is_owned = false;
16117         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16118 }
16119
16120 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
16121         void* this_arg_ptr = untag_ptr(this_arg);
16122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16123         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16124         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16125         uint64_t ret_ref = 0;
16126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16128         return ret_ref;
16129 }
16130
16131 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16132         void* this_arg_ptr = untag_ptr(this_arg);
16133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16134         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16135         LDKPublicKey their_node_id_ref;
16136         CHECK(their_node_id->arr_len == 33);
16137         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16138         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16139         uint64_t ret_ref = 0;
16140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16142         return ret_ref;
16143 }
16144
16145 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_chain_hashes"))) TS_ChannelMessageHandler_get_chain_hashes(uint64_t this_arg) {
16146         void* this_arg_ptr = untag_ptr(this_arg);
16147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16148         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16149         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
16150         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
16151         uint64_t ret_ref = tag_ptr(ret_copy, true);
16152         return ret_ref;
16153 }
16154
16155 typedef struct LDKOffersMessageHandler_JCalls {
16156         atomic_size_t refcnt;
16157         uint32_t instance_ptr;
16158 } LDKOffersMessageHandler_JCalls;
16159 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
16160         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16161         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16162                 FREE(j_calls);
16163         }
16164 }
16165 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
16166         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16167         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
16168         *message_copy = message;
16169         uint64_t message_ref = tag_ptr(message_copy, true);
16170         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, message_ref, 0, 0, 0, 0, 0);
16171         void* ret_ptr = untag_ptr(ret);
16172         CHECK_ACCESS(ret_ptr);
16173         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
16174         FREE(untag_ptr(ret));
16175         return ret_conv;
16176 }
16177 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
16178         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16179         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, 0, 0, 0, 0, 0, 0);
16180         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
16181         ret_constr.datalen = ret->arr_len;
16182         if (ret_constr.datalen > 0)
16183                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
16184         else
16185                 ret_constr.data = NULL;
16186         uint64_t* ret_vals = ret->elems;
16187         for (size_t x = 0; x < ret_constr.datalen; x++) {
16188                 uint64_t ret_conv_49 = ret_vals[x];
16189                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
16190                 CHECK_ACCESS(ret_conv_49_ptr);
16191                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
16192                 FREE(untag_ptr(ret_conv_49));
16193                 ret_constr.data[x] = ret_conv_49_conv;
16194         }
16195         FREE(ret);
16196         return ret_constr;
16197 }
16198 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
16199         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
16200         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16201 }
16202 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
16203         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
16204         atomic_init(&calls->refcnt, 1);
16205         calls->instance_ptr = o;
16206
16207         LDKOffersMessageHandler ret = {
16208                 .this_arg = (void*) calls,
16209                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
16210                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
16211                 .free = LDKOffersMessageHandler_JCalls_free,
16212         };
16213         return ret;
16214 }
16215 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
16216         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
16217         *res_ptr = LDKOffersMessageHandler_init(o);
16218         return tag_ptr(res_ptr, true);
16219 }
16220 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
16221         void* this_arg_ptr = untag_ptr(this_arg);
16222         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16223         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16224         void* message_ptr = untag_ptr(message);
16225         CHECK_ACCESS(message_ptr);
16226         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
16227         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
16228         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
16229         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
16230         uint64_t ret_ref = tag_ptr(ret_copy, true);
16231         return ret_ref;
16232 }
16233
16234 uint64_tArray  __attribute__((export_name("TS_OffersMessageHandler_release_pending_messages"))) TS_OffersMessageHandler_release_pending_messages(uint64_t this_arg) {
16235         void* this_arg_ptr = untag_ptr(this_arg);
16236         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16237         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16238         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
16239         uint64_tArray ret_arr = NULL;
16240         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16241         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16242         for (size_t x = 0; x < ret_var.datalen; x++) {
16243                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
16244                 *ret_conv_49_conv = ret_var.data[x];
16245                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16246         }
16247         
16248         FREE(ret_var.data);
16249         return ret_arr;
16250 }
16251
16252 typedef struct LDKNodeIdLookUp_JCalls {
16253         atomic_size_t refcnt;
16254         uint32_t instance_ptr;
16255 } LDKNodeIdLookUp_JCalls;
16256 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
16257         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16258         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16259                 FREE(j_calls);
16260         }
16261 }
16262 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
16263         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16264         int64_t short_channel_id_conv = short_channel_id;
16265         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 118, short_channel_id_conv, 0, 0, 0, 0, 0);
16266         LDKPublicKey ret_ref;
16267         CHECK(ret->arr_len == 33);
16268         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
16269         return ret_ref;
16270 }
16271 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
16272         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
16273         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16274 }
16275 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (JSValue o) {
16276         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
16277         atomic_init(&calls->refcnt, 1);
16278         calls->instance_ptr = o;
16279
16280         LDKNodeIdLookUp ret = {
16281                 .this_arg = (void*) calls,
16282                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
16283                 .free = LDKNodeIdLookUp_JCalls_free,
16284         };
16285         return ret;
16286 }
16287 uint64_t  __attribute__((export_name("TS_LDKNodeIdLookUp_new"))) TS_LDKNodeIdLookUp_new(JSValue o) {
16288         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
16289         *res_ptr = LDKNodeIdLookUp_init(o);
16290         return tag_ptr(res_ptr, true);
16291 }
16292 int8_tArray  __attribute__((export_name("TS_NodeIdLookUp_next_node_id"))) TS_NodeIdLookUp_next_node_id(uint64_t this_arg, int64_t short_channel_id) {
16293         void* this_arg_ptr = untag_ptr(this_arg);
16294         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16295         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
16296         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
16297         memcpy(ret_arr->elems, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form, 33);
16298         return ret_arr;
16299 }
16300
16301 typedef struct LDKRoutingMessageHandler_JCalls {
16302         atomic_size_t refcnt;
16303         uint32_t instance_ptr;
16304         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16305 } LDKRoutingMessageHandler_JCalls;
16306 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16307         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16308         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16309                 FREE(j_calls);
16310         }
16311 }
16312 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16313         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16314         LDKNodeAnnouncement msg_var = *msg;
16315         uint64_t msg_ref = 0;
16316         msg_var = NodeAnnouncement_clone(&msg_var);
16317         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16318         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16319         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 119, msg_ref, 0, 0, 0, 0, 0);
16320         void* ret_ptr = untag_ptr(ret);
16321         CHECK_ACCESS(ret_ptr);
16322         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16323         FREE(untag_ptr(ret));
16324         return ret_conv;
16325 }
16326 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16327         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16328         LDKChannelAnnouncement msg_var = *msg;
16329         uint64_t msg_ref = 0;
16330         msg_var = ChannelAnnouncement_clone(&msg_var);
16331         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16332         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16333         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 120, msg_ref, 0, 0, 0, 0, 0);
16334         void* ret_ptr = untag_ptr(ret);
16335         CHECK_ACCESS(ret_ptr);
16336         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16337         FREE(untag_ptr(ret));
16338         return ret_conv;
16339 }
16340 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16341         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16342         LDKChannelUpdate msg_var = *msg;
16343         uint64_t msg_ref = 0;
16344         msg_var = ChannelUpdate_clone(&msg_var);
16345         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16346         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16347         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, msg_ref, 0, 0, 0, 0, 0);
16348         void* ret_ptr = untag_ptr(ret);
16349         CHECK_ACCESS(ret_ptr);
16350         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16351         FREE(untag_ptr(ret));
16352         return ret_conv;
16353 }
16354 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16355         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16356         int64_t starting_point_conv = starting_point;
16357         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, starting_point_conv, 0, 0, 0, 0, 0);
16358         void* ret_ptr = untag_ptr(ret);
16359         CHECK_ACCESS(ret_ptr);
16360         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16361         FREE(untag_ptr(ret));
16362         return ret_conv;
16363 }
16364 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16365         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16366         LDKNodeId starting_point_var = starting_point;
16367         uint64_t starting_point_ref = 0;
16368         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16369         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16370         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 123, starting_point_ref, 0, 0, 0, 0, 0);
16371         LDKNodeAnnouncement ret_conv;
16372         ret_conv.inner = untag_ptr(ret);
16373         ret_conv.is_owned = ptr_is_owned(ret);
16374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16375         return ret_conv;
16376 }
16377 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16378         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16379         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16380         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16381         LDKInit init_var = *init;
16382         uint64_t init_ref = 0;
16383         init_var = Init_clone(&init_var);
16384         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16385         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16386         jboolean inbound_conv = inbound;
16387         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 124, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
16388         void* ret_ptr = untag_ptr(ret);
16389         CHECK_ACCESS(ret_ptr);
16390         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16391         FREE(untag_ptr(ret));
16392         return ret_conv;
16393 }
16394 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16395         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16396         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16397         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16398         LDKReplyChannelRange msg_var = msg;
16399         uint64_t msg_ref = 0;
16400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16401         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16402         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 125, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16403         void* ret_ptr = untag_ptr(ret);
16404         CHECK_ACCESS(ret_ptr);
16405         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16406         FREE(untag_ptr(ret));
16407         return ret_conv;
16408 }
16409 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16410         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16411         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16412         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16413         LDKReplyShortChannelIdsEnd msg_var = msg;
16414         uint64_t msg_ref = 0;
16415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16416         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16417         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 126, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16418         void* ret_ptr = untag_ptr(ret);
16419         CHECK_ACCESS(ret_ptr);
16420         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16421         FREE(untag_ptr(ret));
16422         return ret_conv;
16423 }
16424 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16425         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16426         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16427         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16428         LDKQueryChannelRange msg_var = msg;
16429         uint64_t msg_ref = 0;
16430         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16431         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16432         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 127, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16433         void* ret_ptr = untag_ptr(ret);
16434         CHECK_ACCESS(ret_ptr);
16435         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16436         FREE(untag_ptr(ret));
16437         return ret_conv;
16438 }
16439 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16440         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16441         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16442         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16443         LDKQueryShortChannelIds msg_var = msg;
16444         uint64_t msg_ref = 0;
16445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16446         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16447         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 128, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
16448         void* ret_ptr = untag_ptr(ret);
16449         CHECK_ACCESS(ret_ptr);
16450         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16451         FREE(untag_ptr(ret));
16452         return ret_conv;
16453 }
16454 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16455         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16456         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
16457 }
16458 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16459         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16460         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 130, 0, 0, 0, 0, 0, 0);
16461         LDKNodeFeatures ret_conv;
16462         ret_conv.inner = untag_ptr(ret);
16463         ret_conv.is_owned = ptr_is_owned(ret);
16464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16465         return ret_conv;
16466 }
16467 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16468         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16469         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16470         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16471         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16472         LDKInitFeatures ret_conv;
16473         ret_conv.inner = untag_ptr(ret);
16474         ret_conv.is_owned = ptr_is_owned(ret);
16475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16476         return ret_conv;
16477 }
16478 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
16479         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
16480         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16481         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16482 }
16483 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
16484         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
16485         atomic_init(&calls->refcnt, 1);
16486         calls->instance_ptr = o;
16487
16488         LDKRoutingMessageHandler ret = {
16489                 .this_arg = (void*) calls,
16490                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
16491                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
16492                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
16493                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
16494                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
16495                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
16496                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
16497                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
16498                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
16499                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
16500                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
16501                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
16502                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
16503                 .free = LDKRoutingMessageHandler_JCalls_free,
16504                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
16505         };
16506         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16507         return ret;
16508 }
16509 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
16510         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16511         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
16512         return tag_ptr(res_ptr, true);
16513 }
16514 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
16515         void* this_arg_ptr = untag_ptr(this_arg);
16516         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16517         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16518         LDKNodeAnnouncement msg_conv;
16519         msg_conv.inner = untag_ptr(msg);
16520         msg_conv.is_owned = ptr_is_owned(msg);
16521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16522         msg_conv.is_owned = false;
16523         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16524         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
16525         return tag_ptr(ret_conv, true);
16526 }
16527
16528 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
16529         void* this_arg_ptr = untag_ptr(this_arg);
16530         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16531         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16532         LDKChannelAnnouncement msg_conv;
16533         msg_conv.inner = untag_ptr(msg);
16534         msg_conv.is_owned = ptr_is_owned(msg);
16535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16536         msg_conv.is_owned = false;
16537         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16538         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
16539         return tag_ptr(ret_conv, true);
16540 }
16541
16542 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
16543         void* this_arg_ptr = untag_ptr(this_arg);
16544         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16545         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16546         LDKChannelUpdate msg_conv;
16547         msg_conv.inner = untag_ptr(msg);
16548         msg_conv.is_owned = ptr_is_owned(msg);
16549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16550         msg_conv.is_owned = false;
16551         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16552         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
16553         return tag_ptr(ret_conv, true);
16554 }
16555
16556 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) {
16557         void* this_arg_ptr = untag_ptr(this_arg);
16558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16559         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16560         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
16561         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
16562         uint64_t ret_ref = tag_ptr(ret_copy, true);
16563         return ret_ref;
16564 }
16565
16566 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) {
16567         void* this_arg_ptr = untag_ptr(this_arg);
16568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16569         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16570         LDKNodeId starting_point_conv;
16571         starting_point_conv.inner = untag_ptr(starting_point);
16572         starting_point_conv.is_owned = ptr_is_owned(starting_point);
16573         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
16574         starting_point_conv = NodeId_clone(&starting_point_conv);
16575         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
16576         uint64_t ret_ref = 0;
16577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16579         return ret_ref;
16580 }
16581
16582 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) {
16583         void* this_arg_ptr = untag_ptr(this_arg);
16584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16585         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16586         LDKPublicKey their_node_id_ref;
16587         CHECK(their_node_id->arr_len == 33);
16588         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16589         LDKInit init_conv;
16590         init_conv.inner = untag_ptr(init);
16591         init_conv.is_owned = ptr_is_owned(init);
16592         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16593         init_conv.is_owned = false;
16594         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16595         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16596         return tag_ptr(ret_conv, true);
16597 }
16598
16599 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) {
16600         void* this_arg_ptr = untag_ptr(this_arg);
16601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16602         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16603         LDKPublicKey their_node_id_ref;
16604         CHECK(their_node_id->arr_len == 33);
16605         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16606         LDKReplyChannelRange msg_conv;
16607         msg_conv.inner = untag_ptr(msg);
16608         msg_conv.is_owned = ptr_is_owned(msg);
16609         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16610         msg_conv = ReplyChannelRange_clone(&msg_conv);
16611         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16612         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16613         return tag_ptr(ret_conv, true);
16614 }
16615
16616 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) {
16617         void* this_arg_ptr = untag_ptr(this_arg);
16618         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16619         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16620         LDKPublicKey their_node_id_ref;
16621         CHECK(their_node_id->arr_len == 33);
16622         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16623         LDKReplyShortChannelIdsEnd msg_conv;
16624         msg_conv.inner = untag_ptr(msg);
16625         msg_conv.is_owned = ptr_is_owned(msg);
16626         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16627         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
16628         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16629         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16630         return tag_ptr(ret_conv, true);
16631 }
16632
16633 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) {
16634         void* this_arg_ptr = untag_ptr(this_arg);
16635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16636         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16637         LDKPublicKey their_node_id_ref;
16638         CHECK(their_node_id->arr_len == 33);
16639         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16640         LDKQueryChannelRange msg_conv;
16641         msg_conv.inner = untag_ptr(msg);
16642         msg_conv.is_owned = ptr_is_owned(msg);
16643         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16644         msg_conv = QueryChannelRange_clone(&msg_conv);
16645         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16646         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16647         return tag_ptr(ret_conv, true);
16648 }
16649
16650 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) {
16651         void* this_arg_ptr = untag_ptr(this_arg);
16652         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16653         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16654         LDKPublicKey their_node_id_ref;
16655         CHECK(their_node_id->arr_len == 33);
16656         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16657         LDKQueryShortChannelIds msg_conv;
16658         msg_conv.inner = untag_ptr(msg);
16659         msg_conv.is_owned = ptr_is_owned(msg);
16660         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16661         msg_conv = QueryShortChannelIds_clone(&msg_conv);
16662         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16663         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16664         return tag_ptr(ret_conv, true);
16665 }
16666
16667 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
16668         void* this_arg_ptr = untag_ptr(this_arg);
16669         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16670         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16671         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
16672         return ret_conv;
16673 }
16674
16675 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
16676         void* this_arg_ptr = untag_ptr(this_arg);
16677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16678         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16679         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16680         uint64_t ret_ref = 0;
16681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16683         return ret_ref;
16684 }
16685
16686 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16687         void* this_arg_ptr = untag_ptr(this_arg);
16688         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16689         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16690         LDKPublicKey their_node_id_ref;
16691         CHECK(their_node_id->arr_len == 33);
16692         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16693         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16694         uint64_t ret_ref = 0;
16695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16697         return ret_ref;
16698 }
16699
16700 typedef struct LDKOnionMessageHandler_JCalls {
16701         atomic_size_t refcnt;
16702         uint32_t instance_ptr;
16703 } LDKOnionMessageHandler_JCalls;
16704 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
16705         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16706         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16707                 FREE(j_calls);
16708         }
16709 }
16710 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
16711         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16712         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 132, 0, 0, 0, 0, 0, 0);
16713         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
16714         ret_constr.datalen = ret->arr_len;
16715         if (ret_constr.datalen > 0)
16716                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
16717         else
16718                 ret_constr.data = NULL;
16719         uint64_t* ret_vals = ret->elems;
16720         for (size_t o = 0; o < ret_constr.datalen; o++) {
16721                 uint64_t ret_conv_40 = ret_vals[o];
16722                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
16723                 CHECK_ACCESS(ret_conv_40_ptr);
16724                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
16725                 FREE(untag_ptr(ret_conv_40));
16726                 ret_constr.data[o] = ret_conv_40_conv;
16727         }
16728         FREE(ret);
16729         return ret_constr;
16730 }
16731 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
16732         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16733         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16734         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16735         LDKOnionMessage msg_var = *msg;
16736         uint64_t msg_ref = 0;
16737         msg_var = OnionMessage_clone(&msg_var);
16738         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16739         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16740         js_invoke_function_ubuuuu(j_calls->instance_ptr, 133, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
16741 }
16742 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
16743         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16744         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16745         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16746         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
16747         LDKOnionMessage ret_conv;
16748         ret_conv.inner = untag_ptr(ret);
16749         ret_conv.is_owned = ptr_is_owned(ret);
16750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16751         return ret_conv;
16752 }
16753 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16754         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16755         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16756         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16757         LDKInit init_var = *init;
16758         uint64_t init_ref = 0;
16759         init_var = Init_clone(&init_var);
16760         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16761         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16762         jboolean inbound_conv = inbound;
16763         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 135, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
16764         void* ret_ptr = untag_ptr(ret);
16765         CHECK_ACCESS(ret_ptr);
16766         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16767         FREE(untag_ptr(ret));
16768         return ret_conv;
16769 }
16770 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16771         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16772         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16773         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16774         js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16775 }
16776 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
16777         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16778         js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, 0, 0, 0, 0, 0, 0);
16779 }
16780 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
16781         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16782         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 138, 0, 0, 0, 0, 0, 0);
16783         LDKNodeFeatures ret_conv;
16784         ret_conv.inner = untag_ptr(ret);
16785         ret_conv.is_owned = ptr_is_owned(ret);
16786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16787         return ret_conv;
16788 }
16789 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16790         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16791         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16792         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16793         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 139, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
16794         LDKInitFeatures ret_conv;
16795         ret_conv.inner = untag_ptr(ret);
16796         ret_conv.is_owned = ptr_is_owned(ret);
16797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16798         return ret_conv;
16799 }
16800 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
16801         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
16802         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16803 }
16804 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o) {
16805         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
16806         atomic_init(&calls->refcnt, 1);
16807         calls->instance_ptr = o;
16808
16809         LDKOnionMessageHandler ret = {
16810                 .this_arg = (void*) calls,
16811                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
16812                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
16813                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
16814                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
16815                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
16816                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
16817                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
16818                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
16819                 .free = LDKOnionMessageHandler_JCalls_free,
16820         };
16821         return ret;
16822 }
16823 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o) {
16824         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
16825         *res_ptr = LDKOnionMessageHandler_init(o);
16826         return tag_ptr(res_ptr, true);
16827 }
16828 uint64_tArray  __attribute__((export_name("TS_OnionMessageHandler_get_and_clear_connections_needed"))) TS_OnionMessageHandler_get_and_clear_connections_needed(uint64_t this_arg) {
16829         void* this_arg_ptr = untag_ptr(this_arg);
16830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16831         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16832         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
16833         uint64_tArray ret_arr = NULL;
16834         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
16835         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
16836         for (size_t o = 0; o < ret_var.datalen; o++) {
16837                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
16838                 *ret_conv_40_conv = ret_var.data[o];
16839                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
16840         }
16841         
16842         FREE(ret_var.data);
16843         return ret_arr;
16844 }
16845
16846 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) {
16847         void* this_arg_ptr = untag_ptr(this_arg);
16848         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16849         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16850         LDKPublicKey peer_node_id_ref;
16851         CHECK(peer_node_id->arr_len == 33);
16852         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16853         LDKOnionMessage msg_conv;
16854         msg_conv.inner = untag_ptr(msg);
16855         msg_conv.is_owned = ptr_is_owned(msg);
16856         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16857         msg_conv.is_owned = false;
16858         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
16859 }
16860
16861 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) {
16862         void* this_arg_ptr = untag_ptr(this_arg);
16863         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16864         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16865         LDKPublicKey peer_node_id_ref;
16866         CHECK(peer_node_id->arr_len == 33);
16867         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16868         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
16869         uint64_t ret_ref = 0;
16870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16872         return ret_ref;
16873 }
16874
16875 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) {
16876         void* this_arg_ptr = untag_ptr(this_arg);
16877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16878         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16879         LDKPublicKey their_node_id_ref;
16880         CHECK(their_node_id->arr_len == 33);
16881         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16882         LDKInit init_conv;
16883         init_conv.inner = untag_ptr(init);
16884         init_conv.is_owned = ptr_is_owned(init);
16885         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16886         init_conv.is_owned = false;
16887         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16888         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16889         return tag_ptr(ret_conv, true);
16890 }
16891
16892 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
16893         void* this_arg_ptr = untag_ptr(this_arg);
16894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16895         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16896         LDKPublicKey their_node_id_ref;
16897         CHECK(their_node_id->arr_len == 33);
16898         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16899         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16900 }
16901
16902 void  __attribute__((export_name("TS_OnionMessageHandler_timer_tick_occurred"))) TS_OnionMessageHandler_timer_tick_occurred(uint64_t this_arg) {
16903         void* this_arg_ptr = untag_ptr(this_arg);
16904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16905         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16906         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
16907 }
16908
16909 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
16910         void* this_arg_ptr = untag_ptr(this_arg);
16911         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16912         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16913         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16914         uint64_t ret_ref = 0;
16915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16917         return ret_ref;
16918 }
16919
16920 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
16921         void* this_arg_ptr = untag_ptr(this_arg);
16922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16923         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16924         LDKPublicKey their_node_id_ref;
16925         CHECK(their_node_id->arr_len == 33);
16926         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16927         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16928         uint64_t ret_ref = 0;
16929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16931         return ret_ref;
16932 }
16933
16934 typedef struct LDKCustomMessageReader_JCalls {
16935         atomic_size_t refcnt;
16936         uint32_t instance_ptr;
16937 } LDKCustomMessageReader_JCalls;
16938 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
16939         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
16940         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16941                 FREE(j_calls);
16942         }
16943 }
16944 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
16945         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
16946         int16_t message_type_conv = message_type;
16947         LDKu8slice buffer_var = buffer;
16948         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
16949         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
16950         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 140, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
16951         void* ret_ptr = untag_ptr(ret);
16952         CHECK_ACCESS(ret_ptr);
16953         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
16954         FREE(untag_ptr(ret));
16955         return ret_conv;
16956 }
16957 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
16958         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
16959         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16960 }
16961 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
16962         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
16963         atomic_init(&calls->refcnt, 1);
16964         calls->instance_ptr = o;
16965
16966         LDKCustomMessageReader ret = {
16967                 .this_arg = (void*) calls,
16968                 .read = read_LDKCustomMessageReader_jcall,
16969                 .free = LDKCustomMessageReader_JCalls_free,
16970         };
16971         return ret;
16972 }
16973 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
16974         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
16975         *res_ptr = LDKCustomMessageReader_init(o);
16976         return tag_ptr(res_ptr, true);
16977 }
16978 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
16979         void* this_arg_ptr = untag_ptr(this_arg);
16980         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16981         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
16982         LDKu8slice buffer_ref;
16983         buffer_ref.datalen = buffer->arr_len;
16984         buffer_ref.data = buffer->elems;
16985         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16986         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
16987         FREE(buffer);
16988         return tag_ptr(ret_conv, true);
16989 }
16990
16991 typedef struct LDKCustomMessageHandler_JCalls {
16992         atomic_size_t refcnt;
16993         uint32_t instance_ptr;
16994         LDKCustomMessageReader_JCalls* CustomMessageReader;
16995 } LDKCustomMessageHandler_JCalls;
16996 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
16997         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
16998         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16999                 FREE(j_calls);
17000         }
17001 }
17002 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
17003         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17004         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
17005         *msg_ret = msg;
17006         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
17007         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
17008         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 141, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
17009         void* ret_ptr = untag_ptr(ret);
17010         CHECK_ACCESS(ret_ptr);
17011         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17012         FREE(untag_ptr(ret));
17013         return ret_conv;
17014 }
17015 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
17016         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17017         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 142, 0, 0, 0, 0, 0, 0);
17018         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
17019         ret_constr.datalen = ret->arr_len;
17020         if (ret_constr.datalen > 0)
17021                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17022         else
17023                 ret_constr.data = NULL;
17024         uint64_t* ret_vals = ret->elems;
17025         for (size_t z = 0; z < ret_constr.datalen; z++) {
17026                 uint64_t ret_conv_25 = ret_vals[z];
17027                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
17028                 CHECK_ACCESS(ret_conv_25_ptr);
17029                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
17030                 FREE(untag_ptr(ret_conv_25));
17031                 ret_constr.data[z] = ret_conv_25_conv;
17032         }
17033         FREE(ret);
17034         return ret_constr;
17035 }
17036 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
17037         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17038         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 143, 0, 0, 0, 0, 0, 0);
17039         LDKNodeFeatures ret_conv;
17040         ret_conv.inner = untag_ptr(ret);
17041         ret_conv.is_owned = ptr_is_owned(ret);
17042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17043         return ret_conv;
17044 }
17045 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17046         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17047         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
17048         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
17049         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 144, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
17050         LDKInitFeatures ret_conv;
17051         ret_conv.inner = untag_ptr(ret);
17052         ret_conv.is_owned = ptr_is_owned(ret);
17053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17054         return ret_conv;
17055 }
17056 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
17057         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
17058         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17059         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
17060 }
17061 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
17062         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
17063         atomic_init(&calls->refcnt, 1);
17064         calls->instance_ptr = o;
17065
17066         LDKCustomMessageHandler ret = {
17067                 .this_arg = (void*) calls,
17068                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
17069                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
17070                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
17071                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
17072                 .free = LDKCustomMessageHandler_JCalls_free,
17073                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
17074         };
17075         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
17076         return ret;
17077 }
17078 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
17079         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
17080         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
17081         return tag_ptr(res_ptr, true);
17082 }
17083 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) {
17084         void* this_arg_ptr = untag_ptr(this_arg);
17085         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17086         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17087         void* msg_ptr = untag_ptr(msg);
17088         CHECK_ACCESS(msg_ptr);
17089         LDKType msg_conv = *(LDKType*)(msg_ptr);
17090         if (msg_conv.free == LDKType_JCalls_free) {
17091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17092                 LDKType_JCalls_cloned(&msg_conv);
17093         }
17094         LDKPublicKey sender_node_id_ref;
17095         CHECK(sender_node_id->arr_len == 33);
17096         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
17097         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17098         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
17099         return tag_ptr(ret_conv, true);
17100 }
17101
17102 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
17103         void* this_arg_ptr = untag_ptr(this_arg);
17104         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17105         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17106         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
17107         uint64_tArray ret_arr = NULL;
17108         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
17109         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
17110         for (size_t z = 0; z < ret_var.datalen; z++) {
17111                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17112                 *ret_conv_25_conv = ret_var.data[z];
17113                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
17114         }
17115         
17116         FREE(ret_var.data);
17117         return ret_arr;
17118 }
17119
17120 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
17121         void* this_arg_ptr = untag_ptr(this_arg);
17122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17123         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17124         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17125         uint64_t ret_ref = 0;
17126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17128         return ret_ref;
17129 }
17130
17131 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
17132         void* this_arg_ptr = untag_ptr(this_arg);
17133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17134         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17135         LDKPublicKey their_node_id_ref;
17136         CHECK(their_node_id->arr_len == 33);
17137         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
17138         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17139         uint64_t ret_ref = 0;
17140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17142         return ret_ref;
17143 }
17144
17145 typedef struct LDKCustomOnionMessageHandler_JCalls {
17146         atomic_size_t refcnt;
17147         uint32_t instance_ptr;
17148 } LDKCustomOnionMessageHandler_JCalls;
17149 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
17150         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17151         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17152                 FREE(j_calls);
17153         }
17154 }
17155 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
17156         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17157         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
17158         *msg_ret = msg;
17159         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 145, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
17160         void* ret_ptr = untag_ptr(ret);
17161         CHECK_ACCESS(ret_ptr);
17162         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
17163         FREE(untag_ptr(ret));
17164         return ret_conv;
17165 }
17166 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
17167         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17168         int64_t message_type_conv = message_type;
17169         LDKu8slice buffer_var = buffer;
17170         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
17171         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
17172         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 146, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
17173         void* ret_ptr = untag_ptr(ret);
17174         CHECK_ACCESS(ret_ptr);
17175         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
17176         FREE(untag_ptr(ret));
17177         return ret_conv;
17178 }
17179 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
17180         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17181         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 147, 0, 0, 0, 0, 0, 0);
17182         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
17183         ret_constr.datalen = ret->arr_len;
17184         if (ret_constr.datalen > 0)
17185                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
17186         else
17187                 ret_constr.data = NULL;
17188         uint64_t* ret_vals = ret->elems;
17189         for (size_t e = 0; e < ret_constr.datalen; e++) {
17190                 uint64_t ret_conv_56 = ret_vals[e];
17191                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
17192                 CHECK_ACCESS(ret_conv_56_ptr);
17193                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
17194                 FREE(untag_ptr(ret_conv_56));
17195                 ret_constr.data[e] = ret_conv_56_conv;
17196         }
17197         FREE(ret);
17198         return ret_constr;
17199 }
17200 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
17201         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
17202         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17203 }
17204 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
17205         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
17206         atomic_init(&calls->refcnt, 1);
17207         calls->instance_ptr = o;
17208
17209         LDKCustomOnionMessageHandler ret = {
17210                 .this_arg = (void*) calls,
17211                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
17212                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
17213                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
17214                 .free = LDKCustomOnionMessageHandler_JCalls_free,
17215         };
17216         return ret;
17217 }
17218 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
17219         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
17220         *res_ptr = LDKCustomOnionMessageHandler_init(o);
17221         return tag_ptr(res_ptr, true);
17222 }
17223 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
17224         void* this_arg_ptr = untag_ptr(this_arg);
17225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17226         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17227         void* msg_ptr = untag_ptr(msg);
17228         CHECK_ACCESS(msg_ptr);
17229         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
17230         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
17231                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17232                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
17233         }
17234         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
17235         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
17236         uint64_t ret_ref = tag_ptr(ret_copy, true);
17237         return ret_ref;
17238 }
17239
17240 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) {
17241         void* this_arg_ptr = untag_ptr(this_arg);
17242         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17243         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17244         LDKu8slice buffer_ref;
17245         buffer_ref.datalen = buffer->arr_len;
17246         buffer_ref.data = buffer->elems;
17247         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
17248         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
17249         FREE(buffer);
17250         return tag_ptr(ret_conv, true);
17251 }
17252
17253 uint64_tArray  __attribute__((export_name("TS_CustomOnionMessageHandler_release_pending_custom_messages"))) TS_CustomOnionMessageHandler_release_pending_custom_messages(uint64_t this_arg) {
17254         void* this_arg_ptr = untag_ptr(this_arg);
17255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17256         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17257         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
17258         uint64_tArray ret_arr = NULL;
17259         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
17260         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
17261         for (size_t e = 0; e < ret_var.datalen; e++) {
17262                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
17263                 *ret_conv_56_conv = ret_var.data[e];
17264                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
17265         }
17266         
17267         FREE(ret_var.data);
17268         return ret_arr;
17269 }
17270
17271 typedef struct LDKSocketDescriptor_JCalls {
17272         atomic_size_t refcnt;
17273         uint32_t instance_ptr;
17274 } LDKSocketDescriptor_JCalls;
17275 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
17276         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17277         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17278                 FREE(j_calls);
17279         }
17280 }
17281 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
17282         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17283         LDKu8slice data_var = data;
17284         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
17285         memcpy(data_arr->elems, data_var.data, data_var.datalen);
17286         jboolean resume_read_conv = resume_read;
17287         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 148, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
17288 }
17289 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
17290         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17291         js_invoke_function_uuuuuu(j_calls->instance_ptr, 149, 0, 0, 0, 0, 0, 0);
17292 }
17293 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
17294         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17295         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17296         *other_arg_clone = SocketDescriptor_clone(other_arg);
17297         return js_invoke_function_buuuuu(j_calls->instance_ptr, 150, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
17298 }
17299 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
17300         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17301         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 151, 0, 0, 0, 0, 0, 0);
17302 }
17303 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
17304         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
17305         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17306 }
17307 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
17308         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
17309         atomic_init(&calls->refcnt, 1);
17310         calls->instance_ptr = o;
17311
17312         LDKSocketDescriptor ret = {
17313                 .this_arg = (void*) calls,
17314                 .send_data = send_data_LDKSocketDescriptor_jcall,
17315                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
17316                 .eq = eq_LDKSocketDescriptor_jcall,
17317                 .hash = hash_LDKSocketDescriptor_jcall,
17318                 .cloned = LDKSocketDescriptor_JCalls_cloned,
17319                 .free = LDKSocketDescriptor_JCalls_free,
17320         };
17321         return ret;
17322 }
17323 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
17324         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17325         *res_ptr = LDKSocketDescriptor_init(o);
17326         return tag_ptr(res_ptr, true);
17327 }
17328 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
17329         void* this_arg_ptr = untag_ptr(this_arg);
17330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17331         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17332         LDKu8slice data_ref;
17333         data_ref.datalen = data->arr_len;
17334         data_ref.data = data->elems;
17335         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
17336         FREE(data);
17337         return ret_conv;
17338 }
17339
17340 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
17341         void* this_arg_ptr = untag_ptr(this_arg);
17342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17343         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17344         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
17345 }
17346
17347 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
17348         void* this_arg_ptr = untag_ptr(this_arg);
17349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17350         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17351         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
17352         return ret_conv;
17353 }
17354
17355 typedef struct LDKSignBolt12InvoiceFn_JCalls {
17356         atomic_size_t refcnt;
17357         uint32_t instance_ptr;
17358 } LDKSignBolt12InvoiceFn_JCalls;
17359 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
17360         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17361         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17362                 FREE(j_calls);
17363         }
17364 }
17365 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
17366         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17367         LDKUnsignedBolt12Invoice message_var = *message;
17368         uint64_t message_ref = 0;
17369         message_var = UnsignedBolt12Invoice_clone(&message_var);
17370         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17371         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17372         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 152, message_ref, 0, 0, 0, 0, 0);
17373         void* ret_ptr = untag_ptr(ret);
17374         CHECK_ACCESS(ret_ptr);
17375         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17376         FREE(untag_ptr(ret));
17377         return ret_conv;
17378 }
17379 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
17380         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
17381         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17382 }
17383 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (JSValue o) {
17384         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
17385         atomic_init(&calls->refcnt, 1);
17386         calls->instance_ptr = o;
17387
17388         LDKSignBolt12InvoiceFn ret = {
17389                 .this_arg = (void*) calls,
17390                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
17391                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
17392         };
17393         return ret;
17394 }
17395 uint64_t  __attribute__((export_name("TS_LDKSignBolt12InvoiceFn_new"))) TS_LDKSignBolt12InvoiceFn_new(JSValue o) {
17396         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
17397         *res_ptr = LDKSignBolt12InvoiceFn_init(o);
17398         return tag_ptr(res_ptr, true);
17399 }
17400 uint64_t  __attribute__((export_name("TS_SignBolt12InvoiceFn_sign_invoice"))) TS_SignBolt12InvoiceFn_sign_invoice(uint64_t this_arg, uint64_t message) {
17401         void* this_arg_ptr = untag_ptr(this_arg);
17402         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17403         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
17404         LDKUnsignedBolt12Invoice message_conv;
17405         message_conv.inner = untag_ptr(message);
17406         message_conv.is_owned = ptr_is_owned(message);
17407         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17408         message_conv.is_owned = false;
17409         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17410         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
17411         return tag_ptr(ret_conv, true);
17412 }
17413
17414 typedef struct LDKSignInvoiceRequestFn_JCalls {
17415         atomic_size_t refcnt;
17416         uint32_t instance_ptr;
17417 } LDKSignInvoiceRequestFn_JCalls;
17418 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
17419         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17420         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17421                 FREE(j_calls);
17422         }
17423 }
17424 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
17425         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17426         LDKUnsignedInvoiceRequest message_var = *message;
17427         uint64_t message_ref = 0;
17428         message_var = UnsignedInvoiceRequest_clone(&message_var);
17429         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17430         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17431         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 153, message_ref, 0, 0, 0, 0, 0);
17432         void* ret_ptr = untag_ptr(ret);
17433         CHECK_ACCESS(ret_ptr);
17434         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17435         FREE(untag_ptr(ret));
17436         return ret_conv;
17437 }
17438 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
17439         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
17440         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17441 }
17442 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (JSValue o) {
17443         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
17444         atomic_init(&calls->refcnt, 1);
17445         calls->instance_ptr = o;
17446
17447         LDKSignInvoiceRequestFn ret = {
17448                 .this_arg = (void*) calls,
17449                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
17450                 .free = LDKSignInvoiceRequestFn_JCalls_free,
17451         };
17452         return ret;
17453 }
17454 uint64_t  __attribute__((export_name("TS_LDKSignInvoiceRequestFn_new"))) TS_LDKSignInvoiceRequestFn_new(JSValue o) {
17455         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
17456         *res_ptr = LDKSignInvoiceRequestFn_init(o);
17457         return tag_ptr(res_ptr, true);
17458 }
17459 uint64_t  __attribute__((export_name("TS_SignInvoiceRequestFn_sign_invoice_request"))) TS_SignInvoiceRequestFn_sign_invoice_request(uint64_t this_arg, uint64_t message) {
17460         void* this_arg_ptr = untag_ptr(this_arg);
17461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17462         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
17463         LDKUnsignedInvoiceRequest message_conv;
17464         message_conv.inner = untag_ptr(message);
17465         message_conv.is_owned = ptr_is_owned(message);
17466         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17467         message_conv.is_owned = false;
17468         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17469         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
17470         return tag_ptr(ret_conv, true);
17471 }
17472
17473 uint32_t __attribute__((export_name("TS_LDKSignError_ty_from_ptr"))) TS_LDKSignError_ty_from_ptr(uint64_t ptr) {
17474         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17475         switch(obj->tag) {
17476                 case LDKSignError_Signing: return 0;
17477                 case LDKSignError_Verification: return 1;
17478                 default: abort();
17479         }
17480 }
17481 uint32_t __attribute__((export_name("TS_LDKSignError_Verification_get_verification"))) TS_LDKSignError_Verification_get_verification(uint64_t ptr) {
17482         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17483         assert(obj->tag == LDKSignError_Verification);
17484         uint32_t verification_conv = LDKSecp256k1Error_to_js(obj->verification);
17485         return verification_conv;
17486 }
17487 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
17488         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17489         switch(obj->tag) {
17490                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
17491                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
17492                 case LDKEffectiveCapacity_Total: return 2;
17493                 case LDKEffectiveCapacity_Infinite: return 3;
17494                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
17495                 case LDKEffectiveCapacity_Unknown: return 5;
17496                 default: abort();
17497         }
17498 }
17499 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
17500         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17501         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
17502         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
17503         return liquidity_msat_conv;
17504 }
17505 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
17506         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17507         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
17508         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
17509         return amount_msat_conv;
17510 }
17511 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
17512         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17513         assert(obj->tag == LDKEffectiveCapacity_Total);
17514         int64_t capacity_msat_conv = obj->total.capacity_msat;
17515         return capacity_msat_conv;
17516 }
17517 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
17518         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17519         assert(obj->tag == LDKEffectiveCapacity_Total);
17520         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
17521         return htlc_maximum_msat_conv;
17522 }
17523 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
17524         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17525         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
17526         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
17527         return amount_msat_conv;
17528 }
17529 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
17530         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17531         switch(obj->tag) {
17532                 case LDKPayee_Blinded: return 0;
17533                 case LDKPayee_Clear: return 1;
17534                 default: abort();
17535         }
17536 }
17537 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
17538         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17539         assert(obj->tag == LDKPayee_Blinded);
17540         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
17541                         uint64_tArray route_hints_arr = NULL;
17542                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
17543                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
17544                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17545                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17546                                 *route_hints_conv_37_conv = route_hints_var.data[l];
17547                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
17548                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
17549                         }
17550                         
17551         return route_hints_arr;
17552 }
17553 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
17554         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17555         assert(obj->tag == LDKPayee_Blinded);
17556         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
17557                         uint64_t features_ref = 0;
17558                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17559                         features_ref = tag_ptr(features_var.inner, false);
17560         return features_ref;
17561 }
17562 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
17563         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17564         assert(obj->tag == LDKPayee_Clear);
17565         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17566         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
17567         return node_id_arr;
17568 }
17569 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
17570         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17571         assert(obj->tag == LDKPayee_Clear);
17572         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
17573                         uint64_tArray route_hints_arr = NULL;
17574                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
17575                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
17576                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17577                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
17578                                 uint64_t route_hints_conv_11_ref = 0;
17579                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
17580                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
17581                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
17582                         }
17583                         
17584         return route_hints_arr;
17585 }
17586 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
17587         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17588         assert(obj->tag == LDKPayee_Clear);
17589         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
17590                         uint64_t features_ref = 0;
17591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17592                         features_ref = tag_ptr(features_var.inner, false);
17593         return features_ref;
17594 }
17595 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
17596         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17597         assert(obj->tag == LDKPayee_Clear);
17598         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
17599         return final_cltv_expiry_delta_conv;
17600 }
17601 typedef struct LDKScore_JCalls {
17602         atomic_size_t refcnt;
17603         uint32_t instance_ptr;
17604         LDKScoreLookUp_JCalls* ScoreLookUp;
17605         LDKScoreUpdate_JCalls* ScoreUpdate;
17606 } LDKScore_JCalls;
17607 static void LDKScore_JCalls_free(void* this_arg) {
17608         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17609         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17610                 FREE(j_calls);
17611         }
17612 }
17613 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
17614         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17615         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 154, 0, 0, 0, 0, 0, 0);
17616         LDKCVec_u8Z ret_ref;
17617         ret_ref.datalen = ret->arr_len;
17618         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
17619         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
17620         return ret_ref;
17621 }
17622 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
17623         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
17624         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17625         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
17626         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
17627 }
17628 static inline LDKScore LDKScore_init (JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
17629         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
17630         atomic_init(&calls->refcnt, 1);
17631         calls->instance_ptr = o;
17632
17633         LDKScore ret = {
17634                 .this_arg = (void*) calls,
17635                 .write = write_LDKScore_jcall,
17636                 .free = LDKScore_JCalls_free,
17637                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
17638                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
17639         };
17640         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
17641         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
17642         return ret;
17643 }
17644 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o, JSValue ScoreLookUp, JSValue ScoreUpdate) {
17645         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
17646         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
17647         return tag_ptr(res_ptr, true);
17648 }
17649 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
17650         void* this_arg_ptr = untag_ptr(this_arg);
17651         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17652         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
17653         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
17654         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17655         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17656         CVec_u8Z_free(ret_var);
17657         return ret_arr;
17658 }
17659
17660 uint32_t __attribute__((export_name("TS_LDKIntroductionNode_ty_from_ptr"))) TS_LDKIntroductionNode_ty_from_ptr(uint64_t ptr) {
17661         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17662         switch(obj->tag) {
17663                 case LDKIntroductionNode_NodeId: return 0;
17664                 case LDKIntroductionNode_DirectedShortChannelId: return 1;
17665                 default: abort();
17666         }
17667 }
17668 int8_tArray __attribute__((export_name("TS_LDKIntroductionNode_NodeId_get_node_id"))) TS_LDKIntroductionNode_NodeId_get_node_id(uint64_t ptr) {
17669         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17670         assert(obj->tag == LDKIntroductionNode_NodeId);
17671         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17672         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
17673         return node_id_arr;
17674 }
17675 uint32_t __attribute__((export_name("TS_LDKIntroductionNode_DirectedShortChannelId_get__0"))) TS_LDKIntroductionNode_DirectedShortChannelId_get__0(uint64_t ptr) {
17676         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17677         assert(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17678         uint32_t _0_conv = LDKDirection_to_js(obj->directed_short_channel_id._0);
17679         return _0_conv;
17680 }
17681 int64_t __attribute__((export_name("TS_LDKIntroductionNode_DirectedShortChannelId_get__1"))) TS_LDKIntroductionNode_DirectedShortChannelId_get__1(uint64_t ptr) {
17682         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17683         assert(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17684         int64_t _1_conv = obj->directed_short_channel_id._1;
17685         return _1_conv;
17686 }
17687 typedef struct LDKCoinSelectionSource_JCalls {
17688         atomic_size_t refcnt;
17689         uint32_t instance_ptr;
17690 } LDKCoinSelectionSource_JCalls;
17691 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
17692         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17693         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17694                 FREE(j_calls);
17695         }
17696 }
17697 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) {
17698         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17699         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
17700         memcpy(claim_id_arr->elems, claim_id.data, 32);
17701         LDKCVec_InputZ must_spend_var = must_spend;
17702         uint64_tArray must_spend_arr = NULL;
17703         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
17704         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
17705         for (size_t h = 0; h < must_spend_var.datalen; h++) {
17706                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
17707                 uint64_t must_spend_conv_7_ref = 0;
17708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
17709                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
17710                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
17711         }
17712         
17713         FREE(must_spend_var.data);
17714         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
17715         uint64_tArray must_pay_to_arr = NULL;
17716         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
17717         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
17718         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
17719                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17720                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
17721                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
17722         }
17723         
17724         FREE(must_pay_to_var.data);
17725         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
17726         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 155, (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);
17727         void* ret_ptr = untag_ptr(ret);
17728         CHECK_ACCESS(ret_ptr);
17729         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
17730         FREE(untag_ptr(ret));
17731         return ret_conv;
17732 }
17733 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17734         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17735         LDKCVec_u8Z psbt_var = psbt;
17736         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17737         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17738         CVec_u8Z_free(psbt_var);
17739         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 156, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
17740         void* ret_ptr = untag_ptr(ret);
17741         CHECK_ACCESS(ret_ptr);
17742         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17743         FREE(untag_ptr(ret));
17744         return ret_conv;
17745 }
17746 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
17747         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
17748         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17749 }
17750 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
17751         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
17752         atomic_init(&calls->refcnt, 1);
17753         calls->instance_ptr = o;
17754
17755         LDKCoinSelectionSource ret = {
17756                 .this_arg = (void*) calls,
17757                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
17758                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
17759                 .free = LDKCoinSelectionSource_JCalls_free,
17760         };
17761         return ret;
17762 }
17763 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
17764         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
17765         *res_ptr = LDKCoinSelectionSource_init(o);
17766         return tag_ptr(res_ptr, true);
17767 }
17768 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) {
17769         void* this_arg_ptr = untag_ptr(this_arg);
17770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17771         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17772         LDKThirtyTwoBytes claim_id_ref;
17773         CHECK(claim_id->arr_len == 32);
17774         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
17775         LDKCVec_InputZ must_spend_constr;
17776         must_spend_constr.datalen = must_spend->arr_len;
17777         if (must_spend_constr.datalen > 0)
17778                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
17779         else
17780                 must_spend_constr.data = NULL;
17781         uint64_t* must_spend_vals = must_spend->elems;
17782         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
17783                 uint64_t must_spend_conv_7 = must_spend_vals[h];
17784                 LDKInput must_spend_conv_7_conv;
17785                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
17786                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
17787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
17788                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
17789                 must_spend_constr.data[h] = must_spend_conv_7_conv;
17790         }
17791         FREE(must_spend);
17792         LDKCVec_TxOutZ must_pay_to_constr;
17793         must_pay_to_constr.datalen = must_pay_to->arr_len;
17794         if (must_pay_to_constr.datalen > 0)
17795                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17796         else
17797                 must_pay_to_constr.data = NULL;
17798         uint64_t* must_pay_to_vals = must_pay_to->elems;
17799         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
17800                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
17801                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
17802                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
17803                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
17804                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
17805                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
17806         }
17807         FREE(must_pay_to);
17808         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
17809         *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);
17810         return tag_ptr(ret_conv, true);
17811 }
17812
17813 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_psbt"))) TS_CoinSelectionSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
17814         void* this_arg_ptr = untag_ptr(this_arg);
17815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17816         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17817         LDKCVec_u8Z psbt_ref;
17818         psbt_ref.datalen = psbt->arr_len;
17819         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17820         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17821         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17822         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17823         return tag_ptr(ret_conv, true);
17824 }
17825
17826 typedef struct LDKWalletSource_JCalls {
17827         atomic_size_t refcnt;
17828         uint32_t instance_ptr;
17829 } LDKWalletSource_JCalls;
17830 static void LDKWalletSource_JCalls_free(void* this_arg) {
17831         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17832         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17833                 FREE(j_calls);
17834         }
17835 }
17836 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
17837         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17838         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 157, 0, 0, 0, 0, 0, 0);
17839         void* ret_ptr = untag_ptr(ret);
17840         CHECK_ACCESS(ret_ptr);
17841         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
17842         FREE(untag_ptr(ret));
17843         return ret_conv;
17844 }
17845 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
17846         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17847         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 158, 0, 0, 0, 0, 0, 0);
17848         void* ret_ptr = untag_ptr(ret);
17849         CHECK_ACCESS(ret_ptr);
17850         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
17851         FREE(untag_ptr(ret));
17852         return ret_conv;
17853 }
17854 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17855         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17856         LDKCVec_u8Z psbt_var = psbt;
17857         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17858         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17859         CVec_u8Z_free(psbt_var);
17860         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 159, (uint32_t)psbt_arr, 0, 0, 0, 0, 0);
17861         void* ret_ptr = untag_ptr(ret);
17862         CHECK_ACCESS(ret_ptr);
17863         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17864         FREE(untag_ptr(ret));
17865         return ret_conv;
17866 }
17867 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
17868         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
17869         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17870 }
17871 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
17872         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
17873         atomic_init(&calls->refcnt, 1);
17874         calls->instance_ptr = o;
17875
17876         LDKWalletSource ret = {
17877                 .this_arg = (void*) calls,
17878                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
17879                 .get_change_script = get_change_script_LDKWalletSource_jcall,
17880                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
17881                 .free = LDKWalletSource_JCalls_free,
17882         };
17883         return ret;
17884 }
17885 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
17886         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
17887         *res_ptr = LDKWalletSource_init(o);
17888         return tag_ptr(res_ptr, true);
17889 }
17890 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
17891         void* this_arg_ptr = untag_ptr(this_arg);
17892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17893         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17894         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
17895         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
17896         return tag_ptr(ret_conv, true);
17897 }
17898
17899 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
17900         void* this_arg_ptr = untag_ptr(this_arg);
17901         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17902         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17903         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17904         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
17905         return tag_ptr(ret_conv, true);
17906 }
17907
17908 uint64_t  __attribute__((export_name("TS_WalletSource_sign_psbt"))) TS_WalletSource_sign_psbt(uint64_t this_arg, int8_tArray psbt) {
17909         void* this_arg_ptr = untag_ptr(this_arg);
17910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17911         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17912         LDKCVec_u8Z psbt_ref;
17913         psbt_ref.datalen = psbt->arr_len;
17914         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17915         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17916         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17917         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17918         return tag_ptr(ret_conv, true);
17919 }
17920
17921 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
17922         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17923         switch(obj->tag) {
17924                 case LDKGossipSync_P2P: return 0;
17925                 case LDKGossipSync_Rapid: return 1;
17926                 case LDKGossipSync_None: return 2;
17927                 default: abort();
17928         }
17929 }
17930 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
17931         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17932         assert(obj->tag == LDKGossipSync_P2P);
17933         LDKP2PGossipSync p2p_var = obj->p2p;
17934                         uint64_t p2p_ref = 0;
17935                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
17936                         p2p_ref = tag_ptr(p2p_var.inner, false);
17937         return p2p_ref;
17938 }
17939 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
17940         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17941         assert(obj->tag == LDKGossipSync_Rapid);
17942         LDKRapidGossipSync rapid_var = obj->rapid;
17943                         uint64_t rapid_ref = 0;
17944                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
17945                         rapid_ref = tag_ptr(rapid_var.inner, false);
17946         return rapid_ref;
17947 }
17948 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
17949         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17950         switch(obj->tag) {
17951                 case LDKFallback_SegWitProgram: return 0;
17952                 case LDKFallback_PubKeyHash: return 1;
17953                 case LDKFallback_ScriptHash: return 2;
17954                 default: abort();
17955         }
17956 }
17957 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
17958         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17959         assert(obj->tag == LDKFallback_SegWitProgram);
17960         uint8_t version_val = obj->seg_wit_program.version._0;
17961         return version_val;
17962 }
17963 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
17964         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17965         assert(obj->tag == LDKFallback_SegWitProgram);
17966         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
17967                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
17968                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
17969         return program_arr;
17970 }
17971 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
17972         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17973         assert(obj->tag == LDKFallback_PubKeyHash);
17974         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
17975         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
17976         return pub_key_hash_arr;
17977 }
17978 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
17979         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
17980         assert(obj->tag == LDKFallback_ScriptHash);
17981         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
17982         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
17983         return script_hash_arr;
17984 }
17985 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
17986         LDKStr ret_str = _ldk_get_compiled_version();
17987         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17988         Str_free(ret_str);
17989         return ret_conv;
17990 }
17991
17992 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
17993         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
17994         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17995         Str_free(ret_str);
17996         return ret_conv;
17997 }
17998
17999 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
18000         LDKU128 val_ref;
18001         CHECK(val->arr_len == 16);
18002         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
18003         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
18004         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
18005         return ret_arr;
18006 }
18007
18008 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
18009         LDKSixteenBytes le_bytes_ref;
18010         CHECK(le_bytes->arr_len == 16);
18011         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
18012         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
18013         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
18014         return ret_arr;
18015 }
18016
18017 uint64_t  __attribute__((export_name("TS_WitnessProgram_new"))) TS_WitnessProgram_new(int8_t version, int8_tArray program) {
18018         
18019         LDKCVec_u8Z program_ref;
18020         program_ref.datalen = program->arr_len;
18021         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
18022         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
18023         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18024         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
18025         return tag_ptr(ret_ref, true);
18026 }
18027
18028 int8_t  __attribute__((export_name("TS_WitnessProgram_get_version"))) TS_WitnessProgram_get_version(uint64_t prog) {
18029         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
18030         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
18031         return ret_val;
18032 }
18033
18034 int8_tArray  __attribute__((export_name("TS_WitnessProgram_get_program"))) TS_WitnessProgram_get_program(uint64_t prog) {
18035         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
18036         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
18037         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18038         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18039         return ret_arr;
18040 }
18041
18042 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
18043         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18044         *ret_ref = WitnessProgram_clone(arg);
18045         return tag_ptr(ret_ref, true);
18046 }
18047 int64_t  __attribute__((export_name("TS_WitnessProgram_clone_ptr"))) TS_WitnessProgram_clone_ptr(uint64_t arg) {
18048         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
18049         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
18050         return ret_conv;
18051 }
18052
18053 uint64_t  __attribute__((export_name("TS_WitnessProgram_clone"))) TS_WitnessProgram_clone(uint64_t orig) {
18054         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
18055         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18056         *ret_ref = WitnessProgram_clone(orig_conv);
18057         return tag_ptr(ret_ref, true);
18058 }
18059
18060 void  __attribute__((export_name("TS_WitnessProgram_free"))) TS_WitnessProgram_free(uint64_t o) {
18061         if (!ptr_is_owned(o)) return;
18062         void* o_ptr = untag_ptr(o);
18063         CHECK_ACCESS(o_ptr);
18064         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
18065         FREE(untag_ptr(o));
18066         WitnessProgram_free(o_conv);
18067 }
18068
18069 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
18070         LDKThirtyTwoBytes big_endian_bytes_ref;
18071         CHECK(big_endian_bytes->arr_len == 32);
18072         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
18073         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18074         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
18075         return tag_ptr(ret_ref, true);
18076 }
18077
18078 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
18079         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18080         *ret_ref = BigEndianScalar_clone(arg);
18081         return tag_ptr(ret_ref, true);
18082 }
18083 int64_t  __attribute__((export_name("TS_BigEndianScalar_clone_ptr"))) TS_BigEndianScalar_clone_ptr(uint64_t arg) {
18084         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
18085         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
18086         return ret_conv;
18087 }
18088
18089 uint64_t  __attribute__((export_name("TS_BigEndianScalar_clone"))) TS_BigEndianScalar_clone(uint64_t orig) {
18090         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
18091         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18092         *ret_ref = BigEndianScalar_clone(orig_conv);
18093         return tag_ptr(ret_ref, true);
18094 }
18095
18096 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
18097         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
18098         *ret_copy = Bech32Error_clone(arg);
18099         uint64_t ret_ref = tag_ptr(ret_copy, true);
18100         return ret_ref;
18101 }
18102 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
18103         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
18104         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
18105         return ret_conv;
18106 }
18107
18108 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
18109         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
18110         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
18111         *ret_copy = Bech32Error_clone(orig_conv);
18112         uint64_t ret_ref = tag_ptr(ret_copy, true);
18113         return ret_ref;
18114 }
18115
18116 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
18117         if (!ptr_is_owned(o)) return;
18118         void* o_ptr = untag_ptr(o);
18119         CHECK_ACCESS(o_ptr);
18120         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
18121         FREE(untag_ptr(o));
18122         Bech32Error_free(o_conv);
18123 }
18124
18125 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
18126         LDKTransaction _res_ref;
18127         _res_ref.datalen = _res->arr_len;
18128         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
18129         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18130         _res_ref.data_is_owned = true;
18131         Transaction_free(_res_ref);
18132 }
18133
18134 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
18135         LDKWitness _res_ref;
18136         _res_ref.datalen = _res->arr_len;
18137         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
18138         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18139         _res_ref.data_is_owned = true;
18140         Witness_free(_res_ref);
18141 }
18142
18143 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) {
18144         LDKWitness witness_ref;
18145         witness_ref.datalen = witness->arr_len;
18146         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
18147         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
18148         witness_ref.data_is_owned = true;
18149         LDKCVec_u8Z script_sig_ref;
18150         script_sig_ref.datalen = script_sig->arr_len;
18151         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
18152         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
18153         LDKThirtyTwoBytes previous_txid_ref;
18154         CHECK(previous_txid->arr_len == 32);
18155         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
18156         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
18157         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
18158         return tag_ptr(ret_ref, true);
18159 }
18160
18161 int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t txin) {
18162         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18163         LDKWitness ret_var = TxIn_get_witness(txin_conv);
18164         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18165         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18166         Witness_free(ret_var);
18167         return ret_arr;
18168 }
18169
18170 int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t txin) {
18171         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18172         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
18173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18175         return ret_arr;
18176 }
18177
18178 int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t txin) {
18179         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18180         int32_t ret_conv = TxIn_get_sequence(txin_conv);
18181         return ret_conv;
18182 }
18183
18184 int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t txin) {
18185         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18186         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
18187         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
18188         return ret_arr;
18189 }
18190
18191 int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t txin) {
18192         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18193         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
18194         return ret_conv;
18195 }
18196
18197 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
18198         if (!ptr_is_owned(_res)) return;
18199         void* _res_ptr = untag_ptr(_res);
18200         CHECK_ACCESS(_res_ptr);
18201         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
18202         FREE(untag_ptr(_res));
18203         TxIn_free(_res_conv);
18204 }
18205
18206 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
18207         LDKCVec_u8Z script_pubkey_ref;
18208         script_pubkey_ref.datalen = script_pubkey->arr_len;
18209         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
18210         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
18211         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18212         *ret_ref = TxOut_new(script_pubkey_ref, value);
18213         return tag_ptr(ret_ref, true);
18214 }
18215
18216 int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t txout) {
18217         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18218         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
18219         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18220         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18221         return ret_arr;
18222 }
18223
18224 int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t txout) {
18225         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18226         int64_t ret_conv = TxOut_get_value(txout_conv);
18227         return ret_conv;
18228 }
18229
18230 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
18231         if (!ptr_is_owned(_res)) return;
18232         void* _res_ptr = untag_ptr(_res);
18233         CHECK_ACCESS(_res_ptr);
18234         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
18235         FREE(untag_ptr(_res));
18236         TxOut_free(_res_conv);
18237 }
18238
18239 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
18240         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18241         *ret_ref = TxOut_clone(arg);
18242         return tag_ptr(ret_ref, true);
18243 }
18244 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
18245         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
18246         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
18247         return ret_conv;
18248 }
18249
18250 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
18251         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
18252         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18253         *ret_ref = TxOut_clone(orig_conv);
18254         return tag_ptr(ret_ref, true);
18255 }
18256
18257 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
18258         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
18259         Str_free(dummy);
18260 }
18261
18262 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
18263         LDKCVec_u8Z _res_ref;
18264         _res_ref.datalen = _res->arr_len;
18265         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18266         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18267         CVec_u8Z_free(_res_ref);
18268 }
18269
18270 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
18271         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
18272         o_conv.inner = untag_ptr(o);
18273         o_conv.is_owned = ptr_is_owned(o);
18274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18275         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
18276         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18277         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
18278         return tag_ptr(ret_conv, true);
18279 }
18280
18281 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(uint32_t e) {
18282         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18283         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18284         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
18285         return tag_ptr(ret_conv, true);
18286 }
18287
18288 jboolean  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
18289         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
18290         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
18291         return ret_conv;
18292 }
18293
18294 void  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
18295         if (!ptr_is_owned(_res)) return;
18296         void* _res_ptr = untag_ptr(_res);
18297         CHECK_ACCESS(_res_ptr);
18298         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
18299         FREE(untag_ptr(_res));
18300         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
18301 }
18302
18303 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
18304         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18305         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
18306         return tag_ptr(ret_conv, true);
18307 }
18308 int64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18309         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
18310         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
18311         return ret_conv;
18312 }
18313
18314 uint64_t  __attribute__((export_name("TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone"))) TS_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(uint64_t orig) {
18315         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
18316         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18317         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
18318         return tag_ptr(ret_conv, true);
18319 }
18320
18321 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_ok(uint64_t o) {
18322         LDKRefund o_conv;
18323         o_conv.inner = untag_ptr(o);
18324         o_conv.is_owned = ptr_is_owned(o);
18325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18326         o_conv = Refund_clone(&o_conv);
18327         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18328         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
18329         return tag_ptr(ret_conv, true);
18330 }
18331
18332 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_err"))) TS_CResult_RefundBolt12SemanticErrorZ_err(uint32_t e) {
18333         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18334         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18335         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
18336         return tag_ptr(ret_conv, true);
18337 }
18338
18339 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_is_ok"))) TS_CResult_RefundBolt12SemanticErrorZ_is_ok(uint64_t o) {
18340         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
18341         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
18342         return ret_conv;
18343 }
18344
18345 void  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_free"))) TS_CResult_RefundBolt12SemanticErrorZ_free(uint64_t _res) {
18346         if (!ptr_is_owned(_res)) return;
18347         void* _res_ptr = untag_ptr(_res);
18348         CHECK_ACCESS(_res_ptr);
18349         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
18350         FREE(untag_ptr(_res));
18351         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
18352 }
18353
18354 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
18355         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18356         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
18357         return tag_ptr(ret_conv, true);
18358 }
18359 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_RefundBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18360         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
18361         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
18362         return ret_conv;
18363 }
18364
18365 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12SemanticErrorZ_clone"))) TS_CResult_RefundBolt12SemanticErrorZ_clone(uint64_t orig) {
18366         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
18367         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18368         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
18369         return tag_ptr(ret_conv, true);
18370 }
18371
18372 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
18373         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18374         *ret_copy = COption_u64Z_some(o);
18375         uint64_t ret_ref = tag_ptr(ret_copy, true);
18376         return ret_ref;
18377 }
18378
18379 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
18380         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18381         *ret_copy = COption_u64Z_none();
18382         uint64_t ret_ref = tag_ptr(ret_copy, true);
18383         return ret_ref;
18384 }
18385
18386 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
18387         if (!ptr_is_owned(_res)) return;
18388         void* _res_ptr = untag_ptr(_res);
18389         CHECK_ACCESS(_res_ptr);
18390         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
18391         FREE(untag_ptr(_res));
18392         COption_u64Z_free(_res_conv);
18393 }
18394
18395 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
18396         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18397         *ret_copy = COption_u64Z_clone(arg);
18398         uint64_t ret_ref = tag_ptr(ret_copy, true);
18399         return ret_ref;
18400 }
18401 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
18402         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
18403         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
18404         return ret_conv;
18405 }
18406
18407 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
18408         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
18409         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18410         *ret_copy = COption_u64Z_clone(orig_conv);
18411         uint64_t ret_ref = tag_ptr(ret_copy, true);
18412         return ret_ref;
18413 }
18414
18415 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
18416         LDKCVec_BlindedPathZ _res_constr;
18417         _res_constr.datalen = _res->arr_len;
18418         if (_res_constr.datalen > 0)
18419                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18420         else
18421                 _res_constr.data = NULL;
18422         uint64_t* _res_vals = _res->elems;
18423         for (size_t n = 0; n < _res_constr.datalen; n++) {
18424                 uint64_t _res_conv_13 = _res_vals[n];
18425                 LDKBlindedPath _res_conv_13_conv;
18426                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
18427                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
18428                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
18429                 _res_constr.data[n] = _res_conv_13_conv;
18430         }
18431         FREE(_res);
18432         CVec_BlindedPathZ_free(_res_constr);
18433 }
18434
18435 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
18436         LDKRefund o_conv;
18437         o_conv.inner = untag_ptr(o);
18438         o_conv.is_owned = ptr_is_owned(o);
18439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18440         o_conv = Refund_clone(&o_conv);
18441         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18442         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
18443         return tag_ptr(ret_conv, true);
18444 }
18445
18446 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
18447         LDKBolt12ParseError e_conv;
18448         e_conv.inner = untag_ptr(e);
18449         e_conv.is_owned = ptr_is_owned(e);
18450         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18451         e_conv = Bolt12ParseError_clone(&e_conv);
18452         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18453         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
18454         return tag_ptr(ret_conv, true);
18455 }
18456
18457 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
18458         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
18459         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
18460         return ret_conv;
18461 }
18462
18463 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
18464         if (!ptr_is_owned(_res)) return;
18465         void* _res_ptr = untag_ptr(_res);
18466         CHECK_ACCESS(_res_ptr);
18467         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
18468         FREE(untag_ptr(_res));
18469         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
18470 }
18471
18472 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
18473         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18474         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
18475         return tag_ptr(ret_conv, true);
18476 }
18477 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
18478         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
18479         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
18480         return ret_conv;
18481 }
18482
18483 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
18484         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
18485         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18486         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
18487         return tag_ptr(ret_conv, true);
18488 }
18489
18490 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_ok"))) TS_CResult_RetryDecodeErrorZ_ok(uint64_t o) {
18491         void* o_ptr = untag_ptr(o);
18492         CHECK_ACCESS(o_ptr);
18493         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
18494         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
18495         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18496         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
18497         return tag_ptr(ret_conv, true);
18498 }
18499
18500 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_err"))) TS_CResult_RetryDecodeErrorZ_err(uint64_t e) {
18501         void* e_ptr = untag_ptr(e);
18502         CHECK_ACCESS(e_ptr);
18503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18505         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18506         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
18507         return tag_ptr(ret_conv, true);
18508 }
18509
18510 jboolean  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_is_ok"))) TS_CResult_RetryDecodeErrorZ_is_ok(uint64_t o) {
18511         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
18512         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
18513         return ret_conv;
18514 }
18515
18516 void  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_free"))) TS_CResult_RetryDecodeErrorZ_free(uint64_t _res) {
18517         if (!ptr_is_owned(_res)) return;
18518         void* _res_ptr = untag_ptr(_res);
18519         CHECK_ACCESS(_res_ptr);
18520         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
18521         FREE(untag_ptr(_res));
18522         CResult_RetryDecodeErrorZ_free(_res_conv);
18523 }
18524
18525 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
18526         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18527         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
18528         return tag_ptr(ret_conv, true);
18529 }
18530 int64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone_ptr"))) TS_CResult_RetryDecodeErrorZ_clone_ptr(uint64_t arg) {
18531         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
18532         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
18533         return ret_conv;
18534 }
18535
18536 uint64_t  __attribute__((export_name("TS_CResult_RetryDecodeErrorZ_clone"))) TS_CResult_RetryDecodeErrorZ_clone(uint64_t orig) {
18537         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
18538         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18539         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
18540         return tag_ptr(ret_conv, true);
18541 }
18542
18543 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
18544         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18545         *ret_conv = CResult_NoneAPIErrorZ_ok();
18546         return tag_ptr(ret_conv, true);
18547 }
18548
18549 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
18550         void* e_ptr = untag_ptr(e);
18551         CHECK_ACCESS(e_ptr);
18552         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18553         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18554         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18555         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18556         return tag_ptr(ret_conv, true);
18557 }
18558
18559 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
18560         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18561         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18562         return ret_conv;
18563 }
18564
18565 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
18566         if (!ptr_is_owned(_res)) return;
18567         void* _res_ptr = untag_ptr(_res);
18568         CHECK_ACCESS(_res_ptr);
18569         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18570         FREE(untag_ptr(_res));
18571         CResult_NoneAPIErrorZ_free(_res_conv);
18572 }
18573
18574 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18575         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18576         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18577         return tag_ptr(ret_conv, true);
18578 }
18579 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
18580         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18581         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18582         return ret_conv;
18583 }
18584
18585 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
18586         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18587         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18588         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18589         return tag_ptr(ret_conv, true);
18590 }
18591
18592 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
18593         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18594         _res_constr.datalen = _res->arr_len;
18595         if (_res_constr.datalen > 0)
18596                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18597         else
18598                 _res_constr.data = NULL;
18599         uint64_t* _res_vals = _res->elems;
18600         for (size_t w = 0; w < _res_constr.datalen; w++) {
18601                 uint64_t _res_conv_22 = _res_vals[w];
18602                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18603                 CHECK_ACCESS(_res_conv_22_ptr);
18604                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18605                 FREE(untag_ptr(_res_conv_22));
18606                 _res_constr.data[w] = _res_conv_22_conv;
18607         }
18608         FREE(_res);
18609         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18610 }
18611
18612 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
18613         LDKCVec_APIErrorZ _res_constr;
18614         _res_constr.datalen = _res->arr_len;
18615         if (_res_constr.datalen > 0)
18616                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18617         else
18618                 _res_constr.data = NULL;
18619         uint64_t* _res_vals = _res->elems;
18620         for (size_t k = 0; k < _res_constr.datalen; k++) {
18621                 uint64_t _res_conv_10 = _res_vals[k];
18622                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18623                 CHECK_ACCESS(_res_conv_10_ptr);
18624                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18625                 FREE(untag_ptr(_res_conv_10));
18626                 _res_constr.data[k] = _res_conv_10_conv;
18627         }
18628         FREE(_res);
18629         CVec_APIErrorZ_free(_res_constr);
18630 }
18631
18632 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_some"))) TS_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
18633         LDKThirtyTwoBytes o_ref;
18634         CHECK(o->arr_len == 32);
18635         memcpy(o_ref.data, o->elems, 32); FREE(o);
18636         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18637         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
18638         uint64_t ret_ref = tag_ptr(ret_copy, true);
18639         return ret_ref;
18640 }
18641
18642 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_none"))) TS_COption_ThirtyTwoBytesZ_none() {
18643         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18644         *ret_copy = COption_ThirtyTwoBytesZ_none();
18645         uint64_t ret_ref = tag_ptr(ret_copy, true);
18646         return ret_ref;
18647 }
18648
18649 void  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_free"))) TS_COption_ThirtyTwoBytesZ_free(uint64_t _res) {
18650         if (!ptr_is_owned(_res)) return;
18651         void* _res_ptr = untag_ptr(_res);
18652         CHECK_ACCESS(_res_ptr);
18653         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
18654         FREE(untag_ptr(_res));
18655         COption_ThirtyTwoBytesZ_free(_res_conv);
18656 }
18657
18658 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
18659         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18660         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
18661         uint64_t ret_ref = tag_ptr(ret_copy, true);
18662         return ret_ref;
18663 }
18664 int64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone_ptr"))) TS_COption_ThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
18665         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
18666         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
18667         return ret_conv;
18668 }
18669
18670 uint64_t  __attribute__((export_name("TS_COption_ThirtyTwoBytesZ_clone"))) TS_COption_ThirtyTwoBytesZ_clone(uint64_t orig) {
18671         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
18672         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18673         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
18674         uint64_t ret_ref = tag_ptr(ret_copy, true);
18675         return ret_ref;
18676 }
18677
18678 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
18679         LDKCVec_u8Z o_ref;
18680         o_ref.datalen = o->arr_len;
18681         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18682         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18683         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18684         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
18685         uint64_t ret_ref = tag_ptr(ret_copy, true);
18686         return ret_ref;
18687 }
18688
18689 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
18690         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18691         *ret_copy = COption_CVec_u8ZZ_none();
18692         uint64_t ret_ref = tag_ptr(ret_copy, true);
18693         return ret_ref;
18694 }
18695
18696 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
18697         if (!ptr_is_owned(_res)) return;
18698         void* _res_ptr = untag_ptr(_res);
18699         CHECK_ACCESS(_res_ptr);
18700         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
18701         FREE(untag_ptr(_res));
18702         COption_CVec_u8ZZ_free(_res_conv);
18703 }
18704
18705 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
18706         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18707         *ret_copy = COption_CVec_u8ZZ_clone(arg);
18708         uint64_t ret_ref = tag_ptr(ret_copy, true);
18709         return ret_ref;
18710 }
18711 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
18712         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
18713         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
18714         return ret_conv;
18715 }
18716
18717 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
18718         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
18719         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18720         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
18721         uint64_t ret_ref = tag_ptr(ret_copy, true);
18722         return ret_ref;
18723 }
18724
18725 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
18726         LDKRecipientOnionFields o_conv;
18727         o_conv.inner = untag_ptr(o);
18728         o_conv.is_owned = ptr_is_owned(o);
18729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18730         o_conv = RecipientOnionFields_clone(&o_conv);
18731         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18732         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
18733         return tag_ptr(ret_conv, true);
18734 }
18735
18736 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
18737         void* e_ptr = untag_ptr(e);
18738         CHECK_ACCESS(e_ptr);
18739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18741         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18742         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
18743         return tag_ptr(ret_conv, true);
18744 }
18745
18746 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
18747         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
18748         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
18749         return ret_conv;
18750 }
18751
18752 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
18753         if (!ptr_is_owned(_res)) return;
18754         void* _res_ptr = untag_ptr(_res);
18755         CHECK_ACCESS(_res_ptr);
18756         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
18757         FREE(untag_ptr(_res));
18758         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
18759 }
18760
18761 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
18762         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18763         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
18764         return tag_ptr(ret_conv, true);
18765 }
18766 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
18767         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
18768         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
18769         return ret_conv;
18770 }
18771
18772 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
18773         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
18774         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18775         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
18776         return tag_ptr(ret_conv, true);
18777 }
18778
18779 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
18780         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18781         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
18782         return tag_ptr(ret_conv, true);
18783 }
18784 int64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u64CVec_u8ZZ_clone_ptr(uint64_t arg) {
18785         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
18786         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
18787         return ret_conv;
18788 }
18789
18790 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_clone"))) TS_C2Tuple_u64CVec_u8ZZ_clone(uint64_t orig) {
18791         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
18792         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18793         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
18794         return tag_ptr(ret_conv, true);
18795 }
18796
18797 uint64_t  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_new"))) TS_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
18798         LDKCVec_u8Z b_ref;
18799         b_ref.datalen = b->arr_len;
18800         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18801         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18802         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18803         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
18804         return tag_ptr(ret_conv, true);
18805 }
18806
18807 void  __attribute__((export_name("TS_C2Tuple_u64CVec_u8ZZ_free"))) TS_C2Tuple_u64CVec_u8ZZ_free(uint64_t _res) {
18808         if (!ptr_is_owned(_res)) return;
18809         void* _res_ptr = untag_ptr(_res);
18810         CHECK_ACCESS(_res_ptr);
18811         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
18812         FREE(untag_ptr(_res));
18813         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
18814 }
18815
18816 void  __attribute__((export_name("TS_CVec_C2Tuple_u64CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u64CVec_u8ZZZ_free(uint64_tArray _res) {
18817         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
18818         _res_constr.datalen = _res->arr_len;
18819         if (_res_constr.datalen > 0)
18820                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
18821         else
18822                 _res_constr.data = NULL;
18823         uint64_t* _res_vals = _res->elems;
18824         for (size_t x = 0; x < _res_constr.datalen; x++) {
18825                 uint64_t _res_conv_23 = _res_vals[x];
18826                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
18827                 CHECK_ACCESS(_res_conv_23_ptr);
18828                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
18829                 FREE(untag_ptr(_res_conv_23));
18830                 _res_constr.data[x] = _res_conv_23_conv;
18831         }
18832         FREE(_res);
18833         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
18834 }
18835
18836 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_ok(uint64_t o) {
18837         LDKRecipientOnionFields o_conv;
18838         o_conv.inner = untag_ptr(o);
18839         o_conv.is_owned = ptr_is_owned(o);
18840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18841         o_conv = RecipientOnionFields_clone(&o_conv);
18842         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18843         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
18844         return tag_ptr(ret_conv, true);
18845 }
18846
18847 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_err"))) TS_CResult_RecipientOnionFieldsNoneZ_err() {
18848         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18849         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
18850         return tag_ptr(ret_conv, true);
18851 }
18852
18853 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_is_ok"))) TS_CResult_RecipientOnionFieldsNoneZ_is_ok(uint64_t o) {
18854         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
18855         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
18856         return ret_conv;
18857 }
18858
18859 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_free"))) TS_CResult_RecipientOnionFieldsNoneZ_free(uint64_t _res) {
18860         if (!ptr_is_owned(_res)) return;
18861         void* _res_ptr = untag_ptr(_res);
18862         CHECK_ACCESS(_res_ptr);
18863         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
18864         FREE(untag_ptr(_res));
18865         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
18866 }
18867
18868 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
18869         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18870         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
18871         return tag_ptr(ret_conv, true);
18872 }
18873 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsNoneZ_clone_ptr(uint64_t arg) {
18874         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
18875         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
18876         return ret_conv;
18877 }
18878
18879 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsNoneZ_clone"))) TS_CResult_RecipientOnionFieldsNoneZ_clone(uint64_t orig) {
18880         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
18881         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18882         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
18883         return tag_ptr(ret_conv, true);
18884 }
18885
18886 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(uint64_t o) {
18887         LDKUnsignedBolt12Invoice o_conv;
18888         o_conv.inner = untag_ptr(o);
18889         o_conv.is_owned = ptr_is_owned(o);
18890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18891         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
18892         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18893         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18894         return tag_ptr(ret_conv, true);
18895 }
18896
18897 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(uint32_t e) {
18898         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18899         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18900         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18901         return tag_ptr(ret_conv, true);
18902 }
18903
18904 jboolean  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(uint64_t o) {
18905         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18906         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18907         return ret_conv;
18908 }
18909
18910 void  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(uint64_t _res) {
18911         if (!ptr_is_owned(_res)) return;
18912         void* _res_ptr = untag_ptr(_res);
18913         CHECK_ACCESS(_res_ptr);
18914         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18915         FREE(untag_ptr(_res));
18916         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18917 }
18918
18919 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18920         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18921         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18922         return tag_ptr(ret_conv, true);
18923 }
18924 int64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18925         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18926         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18927         return ret_conv;
18928 }
18929
18930 uint64_t  __attribute__((export_name("TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone"))) TS_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(uint64_t orig) {
18931         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18932         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18933         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18934         return tag_ptr(ret_conv, true);
18935 }
18936
18937 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(uint64_t o) {
18938         LDKBolt12Invoice o_conv;
18939         o_conv.inner = untag_ptr(o);
18940         o_conv.is_owned = ptr_is_owned(o);
18941         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18942         o_conv = Bolt12Invoice_clone(&o_conv);
18943         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18944         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18945         return tag_ptr(ret_conv, true);
18946 }
18947
18948 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(uint32_t e) {
18949         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
18950         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18951         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18952         return tag_ptr(ret_conv, true);
18953 }
18954
18955 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(uint64_t o) {
18956         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18957         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18958         return ret_conv;
18959 }
18960
18961 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(uint64_t _res) {
18962         if (!ptr_is_owned(_res)) return;
18963         void* _res_ptr = untag_ptr(_res);
18964         CHECK_ACCESS(_res_ptr);
18965         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18966         FREE(untag_ptr(_res));
18967         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18968 }
18969
18970 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18971         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18972         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18973         return tag_ptr(ret_conv, true);
18974 }
18975 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
18976         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18977         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18978         return ret_conv;
18979 }
18980
18981 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone"))) TS_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(uint64_t orig) {
18982         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18983         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
18984         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18985         return tag_ptr(ret_conv, true);
18986 }
18987
18988 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_ok"))) TS_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
18989         LDKSchnorrSignature o_ref;
18990         CHECK(o->arr_len == 64);
18991         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18992         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18993         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
18994         return tag_ptr(ret_conv, true);
18995 }
18996
18997 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_err"))) TS_CResult_SchnorrSignatureNoneZ_err() {
18998         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18999         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
19000         return tag_ptr(ret_conv, true);
19001 }
19002
19003 jboolean  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_is_ok"))) TS_CResult_SchnorrSignatureNoneZ_is_ok(uint64_t o) {
19004         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
19005         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
19006         return ret_conv;
19007 }
19008
19009 void  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_free"))) TS_CResult_SchnorrSignatureNoneZ_free(uint64_t _res) {
19010         if (!ptr_is_owned(_res)) return;
19011         void* _res_ptr = untag_ptr(_res);
19012         CHECK_ACCESS(_res_ptr);
19013         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
19014         FREE(untag_ptr(_res));
19015         CResult_SchnorrSignatureNoneZ_free(_res_conv);
19016 }
19017
19018 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
19019         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19020         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
19021         return tag_ptr(ret_conv, true);
19022 }
19023 int64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone_ptr"))) TS_CResult_SchnorrSignatureNoneZ_clone_ptr(uint64_t arg) {
19024         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
19025         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
19026         return ret_conv;
19027 }
19028
19029 uint64_t  __attribute__((export_name("TS_CResult_SchnorrSignatureNoneZ_clone"))) TS_CResult_SchnorrSignatureNoneZ_clone(uint64_t orig) {
19030         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
19031         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19032         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
19033         return tag_ptr(ret_conv, true);
19034 }
19035
19036 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
19037         LDKCVec_ThirtyTwoBytesZ _res_constr;
19038         _res_constr.datalen = _res->arr_len;
19039         if (_res_constr.datalen > 0)
19040                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19041         else
19042                 _res_constr.data = NULL;
19043         int8_tArray* _res_vals = (void*) _res->elems;
19044         for (size_t m = 0; m < _res_constr.datalen; m++) {
19045                 int8_tArray _res_conv_12 = _res_vals[m];
19046                 LDKThirtyTwoBytes _res_conv_12_ref;
19047                 CHECK(_res_conv_12->arr_len == 32);
19048                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
19049                 _res_constr.data[m] = _res_conv_12_ref;
19050         }
19051         FREE(_res);
19052         CVec_ThirtyTwoBytesZ_free(_res_constr);
19053 }
19054
19055 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_some"))) TS_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
19056         LDKCVec_ThirtyTwoBytesZ o_constr;
19057         o_constr.datalen = o->arr_len;
19058         if (o_constr.datalen > 0)
19059                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19060         else
19061                 o_constr.data = NULL;
19062         int8_tArray* o_vals = (void*) o->elems;
19063         for (size_t m = 0; m < o_constr.datalen; m++) {
19064                 int8_tArray o_conv_12 = o_vals[m];
19065                 LDKThirtyTwoBytes o_conv_12_ref;
19066                 CHECK(o_conv_12->arr_len == 32);
19067                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
19068                 o_constr.data[m] = o_conv_12_ref;
19069         }
19070         FREE(o);
19071         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19072         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
19073         uint64_t ret_ref = tag_ptr(ret_copy, true);
19074         return ret_ref;
19075 }
19076
19077 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_none"))) TS_COption_CVec_ThirtyTwoBytesZZ_none() {
19078         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19079         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
19080         uint64_t ret_ref = tag_ptr(ret_copy, true);
19081         return ret_ref;
19082 }
19083
19084 void  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_free"))) TS_COption_CVec_ThirtyTwoBytesZZ_free(uint64_t _res) {
19085         if (!ptr_is_owned(_res)) return;
19086         void* _res_ptr = untag_ptr(_res);
19087         CHECK_ACCESS(_res_ptr);
19088         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
19089         FREE(untag_ptr(_res));
19090         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
19091 }
19092
19093 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
19094         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19095         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
19096         uint64_t ret_ref = tag_ptr(ret_copy, true);
19097         return ret_ref;
19098 }
19099 int64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
19100         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
19101         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
19102         return ret_conv;
19103 }
19104
19105 uint64_t  __attribute__((export_name("TS_COption_CVec_ThirtyTwoBytesZZ_clone"))) TS_COption_CVec_ThirtyTwoBytesZZ_clone(uint64_t orig) {
19106         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
19107         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19108         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
19109         uint64_t ret_ref = tag_ptr(ret_copy, true);
19110         return ret_ref;
19111 }
19112
19113 uint64_t  __attribute__((export_name("TS_COption_AmountZ_some"))) TS_COption_AmountZ_some(uint64_t o) {
19114         void* o_ptr = untag_ptr(o);
19115         CHECK_ACCESS(o_ptr);
19116         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
19117         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
19118         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19119         *ret_copy = COption_AmountZ_some(o_conv);
19120         uint64_t ret_ref = tag_ptr(ret_copy, true);
19121         return ret_ref;
19122 }
19123
19124 uint64_t  __attribute__((export_name("TS_COption_AmountZ_none"))) TS_COption_AmountZ_none() {
19125         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19126         *ret_copy = COption_AmountZ_none();
19127         uint64_t ret_ref = tag_ptr(ret_copy, true);
19128         return ret_ref;
19129 }
19130
19131 void  __attribute__((export_name("TS_COption_AmountZ_free"))) TS_COption_AmountZ_free(uint64_t _res) {
19132         if (!ptr_is_owned(_res)) return;
19133         void* _res_ptr = untag_ptr(_res);
19134         CHECK_ACCESS(_res_ptr);
19135         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
19136         FREE(untag_ptr(_res));
19137         COption_AmountZ_free(_res_conv);
19138 }
19139
19140 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
19141         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19142         *ret_copy = COption_AmountZ_clone(arg);
19143         uint64_t ret_ref = tag_ptr(ret_copy, true);
19144         return ret_ref;
19145 }
19146 int64_t  __attribute__((export_name("TS_COption_AmountZ_clone_ptr"))) TS_COption_AmountZ_clone_ptr(uint64_t arg) {
19147         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
19148         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
19149         return ret_conv;
19150 }
19151
19152 uint64_t  __attribute__((export_name("TS_COption_AmountZ_clone"))) TS_COption_AmountZ_clone(uint64_t orig) {
19153         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
19154         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19155         *ret_copy = COption_AmountZ_clone(orig_conv);
19156         uint64_t ret_ref = tag_ptr(ret_copy, true);
19157         return ret_ref;
19158 }
19159
19160 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_some"))) TS_COption_QuantityZ_some(uint64_t o) {
19161         void* o_ptr = untag_ptr(o);
19162         CHECK_ACCESS(o_ptr);
19163         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
19164         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
19165         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19166         *ret_copy = COption_QuantityZ_some(o_conv);
19167         uint64_t ret_ref = tag_ptr(ret_copy, true);
19168         return ret_ref;
19169 }
19170
19171 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_none"))) TS_COption_QuantityZ_none() {
19172         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19173         *ret_copy = COption_QuantityZ_none();
19174         uint64_t ret_ref = tag_ptr(ret_copy, true);
19175         return ret_ref;
19176 }
19177
19178 void  __attribute__((export_name("TS_COption_QuantityZ_free"))) TS_COption_QuantityZ_free(uint64_t _res) {
19179         if (!ptr_is_owned(_res)) return;
19180         void* _res_ptr = untag_ptr(_res);
19181         CHECK_ACCESS(_res_ptr);
19182         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
19183         FREE(untag_ptr(_res));
19184         COption_QuantityZ_free(_res_conv);
19185 }
19186
19187 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
19188         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19189         *ret_copy = COption_QuantityZ_clone(arg);
19190         uint64_t ret_ref = tag_ptr(ret_copy, true);
19191         return ret_ref;
19192 }
19193 int64_t  __attribute__((export_name("TS_COption_QuantityZ_clone_ptr"))) TS_COption_QuantityZ_clone_ptr(uint64_t arg) {
19194         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
19195         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
19196         return ret_conv;
19197 }
19198
19199 uint64_t  __attribute__((export_name("TS_COption_QuantityZ_clone"))) TS_COption_QuantityZ_clone(uint64_t orig) {
19200         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
19201         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19202         *ret_copy = COption_QuantityZ_clone(orig_conv);
19203         uint64_t ret_ref = tag_ptr(ret_copy, true);
19204         return ret_ref;
19205 }
19206
19207 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
19208         LDKThirtyTwoBytes o_ref;
19209         CHECK(o->arr_len == 32);
19210         memcpy(o_ref.data, o->elems, 32); FREE(o);
19211         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19212         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
19213         return tag_ptr(ret_conv, true);
19214 }
19215
19216 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_err"))) TS_CResult_ThirtyTwoBytesNoneZ_err() {
19217         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19218         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
19219         return tag_ptr(ret_conv, true);
19220 }
19221
19222 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_is_ok"))) TS_CResult_ThirtyTwoBytesNoneZ_is_ok(uint64_t o) {
19223         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
19224         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
19225         return ret_conv;
19226 }
19227
19228 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_free"))) TS_CResult_ThirtyTwoBytesNoneZ_free(uint64_t _res) {
19229         if (!ptr_is_owned(_res)) return;
19230         void* _res_ptr = untag_ptr(_res);
19231         CHECK_ACCESS(_res_ptr);
19232         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
19233         FREE(untag_ptr(_res));
19234         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
19235 }
19236
19237 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
19238         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19239         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
19240         return tag_ptr(ret_conv, true);
19241 }
19242 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesNoneZ_clone_ptr(uint64_t arg) {
19243         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
19244         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
19245         return ret_conv;
19246 }
19247
19248 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesNoneZ_clone"))) TS_CResult_ThirtyTwoBytesNoneZ_clone(uint64_t orig) {
19249         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
19250         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19251         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
19252         return tag_ptr(ret_conv, true);
19253 }
19254
19255 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
19256         LDKBlindedPayInfo o_conv;
19257         o_conv.inner = untag_ptr(o);
19258         o_conv.is_owned = ptr_is_owned(o);
19259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19260         o_conv = BlindedPayInfo_clone(&o_conv);
19261         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19262         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19263         return tag_ptr(ret_conv, true);
19264 }
19265
19266 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
19267         void* e_ptr = untag_ptr(e);
19268         CHECK_ACCESS(e_ptr);
19269         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19270         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19271         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19272         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19273         return tag_ptr(ret_conv, true);
19274 }
19275
19276 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
19277         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19278         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19279         return ret_conv;
19280 }
19281
19282 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
19283         if (!ptr_is_owned(_res)) return;
19284         void* _res_ptr = untag_ptr(_res);
19285         CHECK_ACCESS(_res_ptr);
19286         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19287         FREE(untag_ptr(_res));
19288         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19289 }
19290
19291 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19292         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19293         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19294         return tag_ptr(ret_conv, true);
19295 }
19296 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19297         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19298         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19299         return ret_conv;
19300 }
19301
19302 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
19303         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19304         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19305         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19306         return tag_ptr(ret_conv, true);
19307 }
19308
19309 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19310         LDKDelayedPaymentOutputDescriptor o_conv;
19311         o_conv.inner = untag_ptr(o);
19312         o_conv.is_owned = ptr_is_owned(o);
19313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19314         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19315         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19316         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19317         return tag_ptr(ret_conv, true);
19318 }
19319
19320 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19321         void* e_ptr = untag_ptr(e);
19322         CHECK_ACCESS(e_ptr);
19323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19325         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19326         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19327         return tag_ptr(ret_conv, true);
19328 }
19329
19330 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19331         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19332         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19333         return ret_conv;
19334 }
19335
19336 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19337         if (!ptr_is_owned(_res)) return;
19338         void* _res_ptr = untag_ptr(_res);
19339         CHECK_ACCESS(_res_ptr);
19340         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19341         FREE(untag_ptr(_res));
19342         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19343 }
19344
19345 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19346         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19347         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19348         return tag_ptr(ret_conv, true);
19349 }
19350 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19351         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19352         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19353         return ret_conv;
19354 }
19355
19356 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19357         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19358         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19359         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19360         return tag_ptr(ret_conv, true);
19361 }
19362
19363 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19364         LDKStaticPaymentOutputDescriptor o_conv;
19365         o_conv.inner = untag_ptr(o);
19366         o_conv.is_owned = ptr_is_owned(o);
19367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19368         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19369         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19370         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19371         return tag_ptr(ret_conv, true);
19372 }
19373
19374 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
19375         void* e_ptr = untag_ptr(e);
19376         CHECK_ACCESS(e_ptr);
19377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19379         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19380         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19381         return tag_ptr(ret_conv, true);
19382 }
19383
19384 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19385         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19386         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19387         return ret_conv;
19388 }
19389
19390 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
19391         if (!ptr_is_owned(_res)) return;
19392         void* _res_ptr = untag_ptr(_res);
19393         CHECK_ACCESS(_res_ptr);
19394         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19395         FREE(untag_ptr(_res));
19396         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19397 }
19398
19399 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19400         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19401         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19402         return tag_ptr(ret_conv, true);
19403 }
19404 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19405         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19406         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19407         return ret_conv;
19408 }
19409
19410 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19411         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19412         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19413         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19414         return tag_ptr(ret_conv, true);
19415 }
19416
19417 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
19418         void* o_ptr = untag_ptr(o);
19419         CHECK_ACCESS(o_ptr);
19420         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19421         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19422         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19423         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19424         return tag_ptr(ret_conv, true);
19425 }
19426
19427 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_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_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19433         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19434         return tag_ptr(ret_conv, true);
19435 }
19436
19437 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19438         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19439         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19440         return ret_conv;
19441 }
19442
19443 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_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_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19448         FREE(untag_ptr(_res));
19449         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19450 }
19451
19452 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19453         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19454         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19455         return tag_ptr(ret_conv, true);
19456 }
19457 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19458         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19459         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19460         return ret_conv;
19461 }
19462
19463 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
19464         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19465         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19466         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19467         return tag_ptr(ret_conv, true);
19468 }
19469
19470 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
19471         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19472         _res_constr.datalen = _res->arr_len;
19473         if (_res_constr.datalen > 0)
19474                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19475         else
19476                 _res_constr.data = NULL;
19477         uint64_t* _res_vals = _res->elems;
19478         for (size_t b = 0; b < _res_constr.datalen; b++) {
19479                 uint64_t _res_conv_27 = _res_vals[b];
19480                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19481                 CHECK_ACCESS(_res_conv_27_ptr);
19482                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19483                 FREE(untag_ptr(_res_conv_27));
19484                 _res_constr.data[b] = _res_conv_27_conv;
19485         }
19486         FREE(_res);
19487         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19488 }
19489
19490 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
19491         LDKCVec_TxOutZ _res_constr;
19492         _res_constr.datalen = _res->arr_len;
19493         if (_res_constr.datalen > 0)
19494                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19495         else
19496                 _res_constr.data = NULL;
19497         uint64_t* _res_vals = _res->elems;
19498         for (size_t h = 0; h < _res_constr.datalen; h++) {
19499                 uint64_t _res_conv_7 = _res_vals[h];
19500                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
19501                 CHECK_ACCESS(_res_conv_7_ptr);
19502                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19503                 FREE(untag_ptr(_res_conv_7));
19504                 _res_constr.data[h] = _res_conv_7_conv;
19505         }
19506         FREE(_res);
19507         CVec_TxOutZ_free(_res_constr);
19508 }
19509
19510 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
19511         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19512         *ret_copy = COption_u32Z_some(o);
19513         uint64_t ret_ref = tag_ptr(ret_copy, true);
19514         return ret_ref;
19515 }
19516
19517 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
19518         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19519         *ret_copy = COption_u32Z_none();
19520         uint64_t ret_ref = tag_ptr(ret_copy, true);
19521         return ret_ref;
19522 }
19523
19524 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
19525         if (!ptr_is_owned(_res)) return;
19526         void* _res_ptr = untag_ptr(_res);
19527         CHECK_ACCESS(_res_ptr);
19528         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
19529         FREE(untag_ptr(_res));
19530         COption_u32Z_free(_res_conv);
19531 }
19532
19533 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
19534         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19535         *ret_copy = COption_u32Z_clone(arg);
19536         uint64_t ret_ref = tag_ptr(ret_copy, true);
19537         return ret_ref;
19538 }
19539 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
19540         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
19541         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
19542         return ret_conv;
19543 }
19544
19545 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
19546         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
19547         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19548         *ret_copy = COption_u32Z_clone(orig_conv);
19549         uint64_t ret_ref = tag_ptr(ret_copy, true);
19550         return ret_ref;
19551 }
19552
19553 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
19554         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19555         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
19556         return tag_ptr(ret_conv, true);
19557 }
19558 int64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone_ptr"))) TS_C2Tuple_CVec_u8Zu64Z_clone_ptr(uint64_t arg) {
19559         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
19560         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
19561         return ret_conv;
19562 }
19563
19564 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_clone"))) TS_C2Tuple_CVec_u8Zu64Z_clone(uint64_t orig) {
19565         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
19566         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19567         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
19568         return tag_ptr(ret_conv, true);
19569 }
19570
19571 uint64_t  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_new"))) TS_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
19572         LDKCVec_u8Z a_ref;
19573         a_ref.datalen = a->arr_len;
19574         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
19575         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
19576         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19577         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
19578         return tag_ptr(ret_conv, true);
19579 }
19580
19581 void  __attribute__((export_name("TS_C2Tuple_CVec_u8Zu64Z_free"))) TS_C2Tuple_CVec_u8Zu64Z_free(uint64_t _res) {
19582         if (!ptr_is_owned(_res)) return;
19583         void* _res_ptr = untag_ptr(_res);
19584         CHECK_ACCESS(_res_ptr);
19585         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
19586         FREE(untag_ptr(_res));
19587         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
19588 }
19589
19590 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(uint64_t o) {
19591         void* o_ptr = untag_ptr(o);
19592         CHECK_ACCESS(o_ptr);
19593         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
19594         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
19595         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19596         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
19597         return tag_ptr(ret_conv, true);
19598 }
19599
19600 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
19601         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19602         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
19603         return tag_ptr(ret_conv, true);
19604 }
19605
19606 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(uint64_t o) {
19607         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
19608         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
19609         return ret_conv;
19610 }
19611
19612 void  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(uint64_t _res) {
19613         if (!ptr_is_owned(_res)) return;
19614         void* _res_ptr = untag_ptr(_res);
19615         CHECK_ACCESS(_res_ptr);
19616         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
19617         FREE(untag_ptr(_res));
19618         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
19619 }
19620
19621 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
19622         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19623         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
19624         return tag_ptr(ret_conv, true);
19625 }
19626 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(uint64_t arg) {
19627         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
19628         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
19629         return ret_conv;
19630 }
19631
19632 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone"))) TS_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(uint64_t orig) {
19633         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
19634         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19635         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
19636         return tag_ptr(ret_conv, true);
19637 }
19638
19639 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_ok(uint64_t o) {
19640         LDKChannelDerivationParameters o_conv;
19641         o_conv.inner = untag_ptr(o);
19642         o_conv.is_owned = ptr_is_owned(o);
19643         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19644         o_conv = ChannelDerivationParameters_clone(&o_conv);
19645         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19646         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19647         return tag_ptr(ret_conv, true);
19648 }
19649
19650 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_err"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_err(uint64_t e) {
19651         void* e_ptr = untag_ptr(e);
19652         CHECK_ACCESS(e_ptr);
19653         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19654         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19655         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19656         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19657         return tag_ptr(ret_conv, true);
19658 }
19659
19660 jboolean  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(uint64_t o) {
19661         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19662         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19663         return ret_conv;
19664 }
19665
19666 void  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_free"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_free(uint64_t _res) {
19667         if (!ptr_is_owned(_res)) return;
19668         void* _res_ptr = untag_ptr(_res);
19669         CHECK_ACCESS(_res_ptr);
19670         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19671         FREE(untag_ptr(_res));
19672         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19673 }
19674
19675 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19676         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19677         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19678         return tag_ptr(ret_conv, true);
19679 }
19680 int64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
19681         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19682         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19683         return ret_conv;
19684 }
19685
19686 uint64_t  __attribute__((export_name("TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone"))) TS_CResult_ChannelDerivationParametersDecodeErrorZ_clone(uint64_t orig) {
19687         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19688         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19689         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19690         return tag_ptr(ret_conv, true);
19691 }
19692
19693 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_ok(uint64_t o) {
19694         LDKHTLCDescriptor o_conv;
19695         o_conv.inner = untag_ptr(o);
19696         o_conv.is_owned = ptr_is_owned(o);
19697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19698         o_conv = HTLCDescriptor_clone(&o_conv);
19699         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19700         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19701         return tag_ptr(ret_conv, true);
19702 }
19703
19704 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_err"))) TS_CResult_HTLCDescriptorDecodeErrorZ_err(uint64_t e) {
19705         void* e_ptr = untag_ptr(e);
19706         CHECK_ACCESS(e_ptr);
19707         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19708         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19709         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19710         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19711         return tag_ptr(ret_conv, true);
19712 }
19713
19714 jboolean  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok"))) TS_CResult_HTLCDescriptorDecodeErrorZ_is_ok(uint64_t o) {
19715         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19716         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19717         return ret_conv;
19718 }
19719
19720 void  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_free"))) TS_CResult_HTLCDescriptorDecodeErrorZ_free(uint64_t _res) {
19721         if (!ptr_is_owned(_res)) return;
19722         void* _res_ptr = untag_ptr(_res);
19723         CHECK_ACCESS(_res_ptr);
19724         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19725         FREE(untag_ptr(_res));
19726         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19727 }
19728
19729 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19730         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19731         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19732         return tag_ptr(ret_conv, true);
19733 }
19734 int64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
19735         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19736         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19737         return ret_conv;
19738 }
19739
19740 uint64_t  __attribute__((export_name("TS_CResult_HTLCDescriptorDecodeErrorZ_clone"))) TS_CResult_HTLCDescriptorDecodeErrorZ_clone(uint64_t orig) {
19741         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19742         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19743         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19744         return tag_ptr(ret_conv, true);
19745 }
19746
19747 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
19748         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19749         *ret_conv = CResult_NoneNoneZ_ok();
19750         return tag_ptr(ret_conv, true);
19751 }
19752
19753 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
19754         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19755         *ret_conv = CResult_NoneNoneZ_err();
19756         return tag_ptr(ret_conv, true);
19757 }
19758
19759 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
19760         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
19761         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
19762         return ret_conv;
19763 }
19764
19765 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
19766         if (!ptr_is_owned(_res)) return;
19767         void* _res_ptr = untag_ptr(_res);
19768         CHECK_ACCESS(_res_ptr);
19769         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
19770         FREE(untag_ptr(_res));
19771         CResult_NoneNoneZ_free(_res_conv);
19772 }
19773
19774 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
19775         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19776         *ret_conv = CResult_NoneNoneZ_clone(arg);
19777         return tag_ptr(ret_conv, true);
19778 }
19779 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
19780         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
19781         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
19782         return ret_conv;
19783 }
19784
19785 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
19786         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
19787         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19788         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
19789         return tag_ptr(ret_conv, true);
19790 }
19791
19792 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
19793         LDKPublicKey o_ref;
19794         CHECK(o->arr_len == 33);
19795         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19796         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19797         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
19798         return tag_ptr(ret_conv, true);
19799 }
19800
19801 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
19802         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19803         *ret_conv = CResult_PublicKeyNoneZ_err();
19804         return tag_ptr(ret_conv, true);
19805 }
19806
19807 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
19808         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
19809         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
19810         return ret_conv;
19811 }
19812
19813 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
19814         if (!ptr_is_owned(_res)) return;
19815         void* _res_ptr = untag_ptr(_res);
19816         CHECK_ACCESS(_res_ptr);
19817         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
19818         FREE(untag_ptr(_res));
19819         CResult_PublicKeyNoneZ_free(_res_conv);
19820 }
19821
19822 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
19823         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19824         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
19825         return tag_ptr(ret_conv, true);
19826 }
19827 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
19828         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
19829         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
19830         return ret_conv;
19831 }
19832
19833 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
19834         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
19835         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19836         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
19837         return tag_ptr(ret_conv, true);
19838 }
19839
19840 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_some"))) TS_COption_BigEndianScalarZ_some(uint64_t o) {
19841         void* o_ptr = untag_ptr(o);
19842         CHECK_ACCESS(o_ptr);
19843         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
19844         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
19845         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19846         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
19847         uint64_t ret_ref = tag_ptr(ret_copy, true);
19848         return ret_ref;
19849 }
19850
19851 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_none"))) TS_COption_BigEndianScalarZ_none() {
19852         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19853         *ret_copy = COption_BigEndianScalarZ_none();
19854         uint64_t ret_ref = tag_ptr(ret_copy, true);
19855         return ret_ref;
19856 }
19857
19858 void  __attribute__((export_name("TS_COption_BigEndianScalarZ_free"))) TS_COption_BigEndianScalarZ_free(uint64_t _res) {
19859         if (!ptr_is_owned(_res)) return;
19860         void* _res_ptr = untag_ptr(_res);
19861         CHECK_ACCESS(_res_ptr);
19862         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
19863         FREE(untag_ptr(_res));
19864         COption_BigEndianScalarZ_free(_res_conv);
19865 }
19866
19867 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
19868         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19869         *ret_copy = COption_BigEndianScalarZ_clone(arg);
19870         uint64_t ret_ref = tag_ptr(ret_copy, true);
19871         return ret_ref;
19872 }
19873 int64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone_ptr"))) TS_COption_BigEndianScalarZ_clone_ptr(uint64_t arg) {
19874         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
19875         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
19876         return ret_conv;
19877 }
19878
19879 uint64_t  __attribute__((export_name("TS_COption_BigEndianScalarZ_clone"))) TS_COption_BigEndianScalarZ_clone(uint64_t orig) {
19880         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
19881         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19882         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
19883         uint64_t ret_ref = tag_ptr(ret_copy, true);
19884         return ret_ref;
19885 }
19886
19887 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
19888         LDKCVec_U5Z _res_constr;
19889         _res_constr.datalen = _res->arr_len;
19890         if (_res_constr.datalen > 0)
19891                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
19892         else
19893                 _res_constr.data = NULL;
19894         int8_t* _res_vals = (void*) _res->elems;
19895         for (size_t h = 0; h < _res_constr.datalen; h++) {
19896                 int8_t _res_conv_7 = _res_vals[h];
19897                 
19898                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
19899         }
19900         FREE(_res);
19901         CVec_U5Z_free(_res_constr);
19902 }
19903
19904 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
19905         LDKRecoverableSignature o_ref;
19906         CHECK(o->arr_len == 68);
19907         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
19908         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19909         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19910         return tag_ptr(ret_conv, true);
19911 }
19912
19913 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
19914         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19915         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19916         return tag_ptr(ret_conv, true);
19917 }
19918
19919 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
19920         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
19921         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19922         return ret_conv;
19923 }
19924
19925 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
19926         if (!ptr_is_owned(_res)) return;
19927         void* _res_ptr = untag_ptr(_res);
19928         CHECK_ACCESS(_res_ptr);
19929         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19930         FREE(untag_ptr(_res));
19931         CResult_RecoverableSignatureNoneZ_free(_res_conv);
19932 }
19933
19934 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19935         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19936         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19937         return tag_ptr(ret_conv, true);
19938 }
19939 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
19940         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
19941         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
19942         return ret_conv;
19943 }
19944
19945 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
19946         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
19947         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19948         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
19949         return tag_ptr(ret_conv, true);
19950 }
19951
19952 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_ok"))) TS_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
19953         LDKECDSASignature o_ref;
19954         CHECK(o->arr_len == 64);
19955         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
19956         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19957         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
19958         return tag_ptr(ret_conv, true);
19959 }
19960
19961 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_err"))) TS_CResult_ECDSASignatureNoneZ_err() {
19962         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19963         *ret_conv = CResult_ECDSASignatureNoneZ_err();
19964         return tag_ptr(ret_conv, true);
19965 }
19966
19967 jboolean  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_is_ok"))) TS_CResult_ECDSASignatureNoneZ_is_ok(uint64_t o) {
19968         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
19969         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
19970         return ret_conv;
19971 }
19972
19973 void  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_free"))) TS_CResult_ECDSASignatureNoneZ_free(uint64_t _res) {
19974         if (!ptr_is_owned(_res)) return;
19975         void* _res_ptr = untag_ptr(_res);
19976         CHECK_ACCESS(_res_ptr);
19977         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
19978         FREE(untag_ptr(_res));
19979         CResult_ECDSASignatureNoneZ_free(_res_conv);
19980 }
19981
19982 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
19983         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19984         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
19985         return tag_ptr(ret_conv, true);
19986 }
19987 int64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone_ptr"))) TS_CResult_ECDSASignatureNoneZ_clone_ptr(uint64_t arg) {
19988         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
19989         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
19990         return ret_conv;
19991 }
19992
19993 uint64_t  __attribute__((export_name("TS_CResult_ECDSASignatureNoneZ_clone"))) TS_CResult_ECDSASignatureNoneZ_clone(uint64_t orig) {
19994         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
19995         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
19996         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
19997         return tag_ptr(ret_conv, true);
19998 }
19999
20000 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
20001         LDKTransaction o_ref;
20002         o_ref.datalen = o->arr_len;
20003         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
20004         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20005         o_ref.data_is_owned = true;
20006         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20007         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
20008         return tag_ptr(ret_conv, true);
20009 }
20010
20011 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
20012         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20013         *ret_conv = CResult_TransactionNoneZ_err();
20014         return tag_ptr(ret_conv, true);
20015 }
20016
20017 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
20018         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
20019         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
20020         return ret_conv;
20021 }
20022
20023 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
20024         if (!ptr_is_owned(_res)) return;
20025         void* _res_ptr = untag_ptr(_res);
20026         CHECK_ACCESS(_res_ptr);
20027         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
20028         FREE(untag_ptr(_res));
20029         CResult_TransactionNoneZ_free(_res_conv);
20030 }
20031
20032 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
20033         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20034         *ret_conv = CResult_TransactionNoneZ_clone(arg);
20035         return tag_ptr(ret_conv, true);
20036 }
20037 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
20038         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
20039         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
20040         return ret_conv;
20041 }
20042
20043 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
20044         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
20045         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20046         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
20047         return tag_ptr(ret_conv, true);
20048 }
20049
20050 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
20051         void* o_ptr = untag_ptr(o);
20052         CHECK_ACCESS(o_ptr);
20053         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
20054         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
20055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20056                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
20057         }
20058         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20059         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
20060         return tag_ptr(ret_conv, true);
20061 }
20062
20063 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
20064         void* e_ptr = untag_ptr(e);
20065         CHECK_ACCESS(e_ptr);
20066         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20067         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20068         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20069         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
20070         return tag_ptr(ret_conv, true);
20071 }
20072
20073 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
20074         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
20075         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
20076         return ret_conv;
20077 }
20078
20079 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
20080         if (!ptr_is_owned(_res)) return;
20081         void* _res_ptr = untag_ptr(_res);
20082         CHECK_ACCESS(_res_ptr);
20083         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
20084         FREE(untag_ptr(_res));
20085         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
20086 }
20087
20088 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
20089         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20090         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
20091         return tag_ptr(ret_conv, true);
20092 }
20093 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
20094         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
20095         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
20096         return ret_conv;
20097 }
20098
20099 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
20100         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
20101         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20102         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
20103         return tag_ptr(ret_conv, true);
20104 }
20105
20106 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_ok"))) TS_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
20107         LDKCVec_u8Z o_ref;
20108         o_ref.datalen = o->arr_len;
20109         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20110         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20111         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20112         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
20113         return tag_ptr(ret_conv, true);
20114 }
20115
20116 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_err"))) TS_CResult_CVec_u8ZNoneZ_err() {
20117         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20118         *ret_conv = CResult_CVec_u8ZNoneZ_err();
20119         return tag_ptr(ret_conv, true);
20120 }
20121
20122 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_is_ok"))) TS_CResult_CVec_u8ZNoneZ_is_ok(uint64_t o) {
20123         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
20124         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
20125         return ret_conv;
20126 }
20127
20128 void  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_free"))) TS_CResult_CVec_u8ZNoneZ_free(uint64_t _res) {
20129         if (!ptr_is_owned(_res)) return;
20130         void* _res_ptr = untag_ptr(_res);
20131         CHECK_ACCESS(_res_ptr);
20132         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
20133         FREE(untag_ptr(_res));
20134         CResult_CVec_u8ZNoneZ_free(_res_conv);
20135 }
20136
20137 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
20138         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20139         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
20140         return tag_ptr(ret_conv, true);
20141 }
20142 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone_ptr"))) TS_CResult_CVec_u8ZNoneZ_clone_ptr(uint64_t arg) {
20143         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
20144         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
20145         return ret_conv;
20146 }
20147
20148 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZNoneZ_clone"))) TS_CResult_CVec_u8ZNoneZ_clone(uint64_t orig) {
20149         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
20150         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20151         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
20152         return tag_ptr(ret_conv, true);
20153 }
20154
20155 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
20156         LDKShutdownScript o_conv;
20157         o_conv.inner = untag_ptr(o);
20158         o_conv.is_owned = ptr_is_owned(o);
20159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20160         o_conv = ShutdownScript_clone(&o_conv);
20161         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20162         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
20163         return tag_ptr(ret_conv, true);
20164 }
20165
20166 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
20167         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20168         *ret_conv = CResult_ShutdownScriptNoneZ_err();
20169         return tag_ptr(ret_conv, true);
20170 }
20171
20172 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
20173         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
20174         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
20175         return ret_conv;
20176 }
20177
20178 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
20179         if (!ptr_is_owned(_res)) return;
20180         void* _res_ptr = untag_ptr(_res);
20181         CHECK_ACCESS(_res_ptr);
20182         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20183         FREE(untag_ptr(_res));
20184         CResult_ShutdownScriptNoneZ_free(_res_conv);
20185 }
20186
20187 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20188         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20189         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20190         return tag_ptr(ret_conv, true);
20191 }
20192 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
20193         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20194         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20195         return ret_conv;
20196 }
20197
20198 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
20199         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20200         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20201         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20202         return tag_ptr(ret_conv, true);
20203 }
20204
20205 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
20206         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20207         *ret_copy = COption_u16Z_some(o);
20208         uint64_t ret_ref = tag_ptr(ret_copy, true);
20209         return ret_ref;
20210 }
20211
20212 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
20213         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20214         *ret_copy = COption_u16Z_none();
20215         uint64_t ret_ref = tag_ptr(ret_copy, true);
20216         return ret_ref;
20217 }
20218
20219 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
20220         if (!ptr_is_owned(_res)) return;
20221         void* _res_ptr = untag_ptr(_res);
20222         CHECK_ACCESS(_res_ptr);
20223         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20224         FREE(untag_ptr(_res));
20225         COption_u16Z_free(_res_conv);
20226 }
20227
20228 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20229         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20230         *ret_copy = COption_u16Z_clone(arg);
20231         uint64_t ret_ref = tag_ptr(ret_copy, true);
20232         return ret_ref;
20233 }
20234 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
20235         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20236         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20237         return ret_conv;
20238 }
20239
20240 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
20241         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20242         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20243         *ret_copy = COption_u16Z_clone(orig_conv);
20244         uint64_t ret_ref = tag_ptr(ret_copy, true);
20245         return ret_ref;
20246 }
20247
20248 uint64_t  __attribute__((export_name("TS_COption_boolZ_some"))) TS_COption_boolZ_some(jboolean o) {
20249         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20250         *ret_copy = COption_boolZ_some(o);
20251         uint64_t ret_ref = tag_ptr(ret_copy, true);
20252         return ret_ref;
20253 }
20254
20255 uint64_t  __attribute__((export_name("TS_COption_boolZ_none"))) TS_COption_boolZ_none() {
20256         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20257         *ret_copy = COption_boolZ_none();
20258         uint64_t ret_ref = tag_ptr(ret_copy, true);
20259         return ret_ref;
20260 }
20261
20262 void  __attribute__((export_name("TS_COption_boolZ_free"))) TS_COption_boolZ_free(uint64_t _res) {
20263         if (!ptr_is_owned(_res)) return;
20264         void* _res_ptr = untag_ptr(_res);
20265         CHECK_ACCESS(_res_ptr);
20266         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
20267         FREE(untag_ptr(_res));
20268         COption_boolZ_free(_res_conv);
20269 }
20270
20271 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
20272         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20273         *ret_copy = COption_boolZ_clone(arg);
20274         uint64_t ret_ref = tag_ptr(ret_copy, true);
20275         return ret_ref;
20276 }
20277 int64_t  __attribute__((export_name("TS_COption_boolZ_clone_ptr"))) TS_COption_boolZ_clone_ptr(uint64_t arg) {
20278         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
20279         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
20280         return ret_conv;
20281 }
20282
20283 uint64_t  __attribute__((export_name("TS_COption_boolZ_clone"))) TS_COption_boolZ_clone(uint64_t orig) {
20284         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
20285         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20286         *ret_copy = COption_boolZ_clone(orig_conv);
20287         uint64_t ret_ref = tag_ptr(ret_copy, true);
20288         return ret_ref;
20289 }
20290
20291 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_ok"))) TS_CResult_WitnessNoneZ_ok(int8_tArray o) {
20292         LDKWitness o_ref;
20293         o_ref.datalen = o->arr_len;
20294         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
20295         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20296         o_ref.data_is_owned = true;
20297         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20298         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
20299         return tag_ptr(ret_conv, true);
20300 }
20301
20302 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_err"))) TS_CResult_WitnessNoneZ_err() {
20303         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20304         *ret_conv = CResult_WitnessNoneZ_err();
20305         return tag_ptr(ret_conv, true);
20306 }
20307
20308 jboolean  __attribute__((export_name("TS_CResult_WitnessNoneZ_is_ok"))) TS_CResult_WitnessNoneZ_is_ok(uint64_t o) {
20309         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
20310         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
20311         return ret_conv;
20312 }
20313
20314 void  __attribute__((export_name("TS_CResult_WitnessNoneZ_free"))) TS_CResult_WitnessNoneZ_free(uint64_t _res) {
20315         if (!ptr_is_owned(_res)) return;
20316         void* _res_ptr = untag_ptr(_res);
20317         CHECK_ACCESS(_res_ptr);
20318         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
20319         FREE(untag_ptr(_res));
20320         CResult_WitnessNoneZ_free(_res_conv);
20321 }
20322
20323 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
20324         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20325         *ret_conv = CResult_WitnessNoneZ_clone(arg);
20326         return tag_ptr(ret_conv, true);
20327 }
20328 int64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone_ptr"))) TS_CResult_WitnessNoneZ_clone_ptr(uint64_t arg) {
20329         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
20330         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
20331         return ret_conv;
20332 }
20333
20334 uint64_t  __attribute__((export_name("TS_CResult_WitnessNoneZ_clone"))) TS_CResult_WitnessNoneZ_clone(uint64_t orig) {
20335         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
20336         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20337         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
20338         return tag_ptr(ret_conv, true);
20339 }
20340
20341 void  __attribute__((export_name("TS_CVec_ECDSASignatureZ_free"))) TS_CVec_ECDSASignatureZ_free(ptrArray _res) {
20342         LDKCVec_ECDSASignatureZ _res_constr;
20343         _res_constr.datalen = _res->arr_len;
20344         if (_res_constr.datalen > 0)
20345                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20346         else
20347                 _res_constr.data = NULL;
20348         int8_tArray* _res_vals = (void*) _res->elems;
20349         for (size_t m = 0; m < _res_constr.datalen; m++) {
20350                 int8_tArray _res_conv_12 = _res_vals[m];
20351                 LDKECDSASignature _res_conv_12_ref;
20352                 CHECK(_res_conv_12->arr_len == 64);
20353                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
20354                 _res_constr.data[m] = _res_conv_12_ref;
20355         }
20356         FREE(_res);
20357         CVec_ECDSASignatureZ_free(_res_constr);
20358 }
20359
20360 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
20361         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20362         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
20363         return tag_ptr(ret_conv, true);
20364 }
20365 int64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(uint64_t arg) {
20366         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
20367         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
20368         return ret_conv;
20369 }
20370
20371 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(uint64_t orig) {
20372         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
20373         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20374         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
20375         return tag_ptr(ret_conv, true);
20376 }
20377
20378 uint64_t  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
20379         LDKECDSASignature a_ref;
20380         CHECK(a->arr_len == 64);
20381         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
20382         LDKCVec_ECDSASignatureZ b_constr;
20383         b_constr.datalen = b->arr_len;
20384         if (b_constr.datalen > 0)
20385                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20386         else
20387                 b_constr.data = NULL;
20388         int8_tArray* b_vals = (void*) b->elems;
20389         for (size_t m = 0; m < b_constr.datalen; m++) {
20390                 int8_tArray b_conv_12 = b_vals[m];
20391                 LDKECDSASignature b_conv_12_ref;
20392                 CHECK(b_conv_12->arr_len == 64);
20393                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
20394                 b_constr.data[m] = b_conv_12_ref;
20395         }
20396         FREE(b);
20397         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20398         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
20399         return tag_ptr(ret_conv, true);
20400 }
20401
20402 void  __attribute__((export_name("TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free"))) TS_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(uint64_t _res) {
20403         if (!ptr_is_owned(_res)) return;
20404         void* _res_ptr = untag_ptr(_res);
20405         CHECK_ACCESS(_res_ptr);
20406         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
20407         FREE(untag_ptr(_res));
20408         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
20409 }
20410
20411 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(uint64_t o) {
20412         void* o_ptr = untag_ptr(o);
20413         CHECK_ACCESS(o_ptr);
20414         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
20415         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
20416         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20417         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
20418         return tag_ptr(ret_conv, true);
20419 }
20420
20421 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
20422         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20423         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
20424         return tag_ptr(ret_conv, true);
20425 }
20426
20427 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(uint64_t o) {
20428         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
20429         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
20430         return ret_conv;
20431 }
20432
20433 void  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(uint64_t _res) {
20434         if (!ptr_is_owned(_res)) return;
20435         void* _res_ptr = untag_ptr(_res);
20436         CHECK_ACCESS(_res_ptr);
20437         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
20438         FREE(untag_ptr(_res));
20439         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
20440 }
20441
20442 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
20443         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20444         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
20445         return tag_ptr(ret_conv, true);
20446 }
20447 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(uint64_t arg) {
20448         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
20449         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
20450         return ret_conv;
20451 }
20452
20453 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(uint64_t orig) {
20454         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
20455         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20456         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
20457         return tag_ptr(ret_conv, true);
20458 }
20459
20460 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
20461         LDKInMemorySigner o_conv;
20462         o_conv.inner = untag_ptr(o);
20463         o_conv.is_owned = ptr_is_owned(o);
20464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20465         o_conv = InMemorySigner_clone(&o_conv);
20466         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20467         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20468         return tag_ptr(ret_conv, true);
20469 }
20470
20471 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
20472         void* e_ptr = untag_ptr(e);
20473         CHECK_ACCESS(e_ptr);
20474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20476         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20477         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20478         return tag_ptr(ret_conv, true);
20479 }
20480
20481 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
20482         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20483         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20484         return ret_conv;
20485 }
20486
20487 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
20488         if (!ptr_is_owned(_res)) return;
20489         void* _res_ptr = untag_ptr(_res);
20490         CHECK_ACCESS(_res_ptr);
20491         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20492         FREE(untag_ptr(_res));
20493         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20494 }
20495
20496 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20497         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20498         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20499         return tag_ptr(ret_conv, true);
20500 }
20501 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
20502         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20503         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20504         return ret_conv;
20505 }
20506
20507 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
20508         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20509         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20510         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20511         return tag_ptr(ret_conv, true);
20512 }
20513
20514 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
20515         LDKCVec_ChannelDetailsZ _res_constr;
20516         _res_constr.datalen = _res->arr_len;
20517         if (_res_constr.datalen > 0)
20518                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
20519         else
20520                 _res_constr.data = NULL;
20521         uint64_t* _res_vals = _res->elems;
20522         for (size_t q = 0; q < _res_constr.datalen; q++) {
20523                 uint64_t _res_conv_16 = _res_vals[q];
20524                 LDKChannelDetails _res_conv_16_conv;
20525                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20526                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20527                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20528                 _res_constr.data[q] = _res_conv_16_conv;
20529         }
20530         FREE(_res);
20531         CVec_ChannelDetailsZ_free(_res_constr);
20532 }
20533
20534 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
20535         LDKRoute o_conv;
20536         o_conv.inner = untag_ptr(o);
20537         o_conv.is_owned = ptr_is_owned(o);
20538         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20539         o_conv = Route_clone(&o_conv);
20540         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20541         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
20542         return tag_ptr(ret_conv, true);
20543 }
20544
20545 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
20546         LDKLightningError e_conv;
20547         e_conv.inner = untag_ptr(e);
20548         e_conv.is_owned = ptr_is_owned(e);
20549         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20550         e_conv = LightningError_clone(&e_conv);
20551         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20552         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
20553         return tag_ptr(ret_conv, true);
20554 }
20555
20556 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
20557         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
20558         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
20559         return ret_conv;
20560 }
20561
20562 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
20563         if (!ptr_is_owned(_res)) return;
20564         void* _res_ptr = untag_ptr(_res);
20565         CHECK_ACCESS(_res_ptr);
20566         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
20567         FREE(untag_ptr(_res));
20568         CResult_RouteLightningErrorZ_free(_res_conv);
20569 }
20570
20571 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
20572         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20573         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
20574         return tag_ptr(ret_conv, true);
20575 }
20576 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
20577         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
20578         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
20579         return ret_conv;
20580 }
20581
20582 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
20583         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
20584         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20585         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
20586         return tag_ptr(ret_conv, true);
20587 }
20588
20589 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
20590         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20591         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
20592         return tag_ptr(ret_conv, true);
20593 }
20594 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
20595         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
20596         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
20597         return ret_conv;
20598 }
20599
20600 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
20601         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
20602         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20603         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
20604         return tag_ptr(ret_conv, true);
20605 }
20606
20607 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
20608         LDKBlindedPayInfo a_conv;
20609         a_conv.inner = untag_ptr(a);
20610         a_conv.is_owned = ptr_is_owned(a);
20611         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20612         a_conv = BlindedPayInfo_clone(&a_conv);
20613         LDKBlindedPath b_conv;
20614         b_conv.inner = untag_ptr(b);
20615         b_conv.is_owned = ptr_is_owned(b);
20616         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20617         b_conv = BlindedPath_clone(&b_conv);
20618         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20619         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
20620         return tag_ptr(ret_conv, true);
20621 }
20622
20623 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
20624         if (!ptr_is_owned(_res)) return;
20625         void* _res_ptr = untag_ptr(_res);
20626         CHECK_ACCESS(_res_ptr);
20627         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
20628         FREE(untag_ptr(_res));
20629         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
20630 }
20631
20632 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
20633         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
20634         _res_constr.datalen = _res->arr_len;
20635         if (_res_constr.datalen > 0)
20636                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20637         else
20638                 _res_constr.data = NULL;
20639         uint64_t* _res_vals = _res->elems;
20640         for (size_t l = 0; l < _res_constr.datalen; l++) {
20641                 uint64_t _res_conv_37 = _res_vals[l];
20642                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
20643                 CHECK_ACCESS(_res_conv_37_ptr);
20644                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
20645                 FREE(untag_ptr(_res_conv_37));
20646                 _res_constr.data[l] = _res_conv_37_conv;
20647         }
20648         FREE(_res);
20649         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
20650 }
20651
20652 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(uint64_tArray o) {
20653         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
20654         o_constr.datalen = o->arr_len;
20655         if (o_constr.datalen > 0)
20656                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20657         else
20658                 o_constr.data = NULL;
20659         uint64_t* o_vals = o->elems;
20660         for (size_t l = 0; l < o_constr.datalen; l++) {
20661                 uint64_t o_conv_37 = o_vals[l];
20662                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
20663                 CHECK_ACCESS(o_conv_37_ptr);
20664                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
20665                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
20666                 o_constr.data[l] = o_conv_37_conv;
20667         }
20668         FREE(o);
20669         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20670         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
20671         return tag_ptr(ret_conv, true);
20672 }
20673
20674 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
20675         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20676         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
20677         return tag_ptr(ret_conv, true);
20678 }
20679
20680 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(uint64_t o) {
20681         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
20682         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
20683         return ret_conv;
20684 }
20685
20686 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(uint64_t _res) {
20687         if (!ptr_is_owned(_res)) return;
20688         void* _res_ptr = untag_ptr(_res);
20689         CHECK_ACCESS(_res_ptr);
20690         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
20691         FREE(untag_ptr(_res));
20692         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
20693 }
20694
20695 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
20696         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20697         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
20698         return tag_ptr(ret_conv, true);
20699 }
20700 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(uint64_t arg) {
20701         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
20702         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
20703         return ret_conv;
20704 }
20705
20706 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone"))) TS_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(uint64_t orig) {
20707         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
20708         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20709         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
20710         return tag_ptr(ret_conv, true);
20711 }
20712
20713 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
20714         LDKCVec_PublicKeyZ _res_constr;
20715         _res_constr.datalen = _res->arr_len;
20716         if (_res_constr.datalen > 0)
20717                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20718         else
20719                 _res_constr.data = NULL;
20720         int8_tArray* _res_vals = (void*) _res->elems;
20721         for (size_t m = 0; m < _res_constr.datalen; m++) {
20722                 int8_tArray _res_conv_12 = _res_vals[m];
20723                 LDKPublicKey _res_conv_12_ref;
20724                 CHECK(_res_conv_12->arr_len == 33);
20725                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
20726                 _res_constr.data[m] = _res_conv_12_ref;
20727         }
20728         FREE(_res);
20729         CVec_PublicKeyZ_free(_res_constr);
20730 }
20731
20732 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
20733         LDKOnionMessagePath o_conv;
20734         o_conv.inner = untag_ptr(o);
20735         o_conv.is_owned = ptr_is_owned(o);
20736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20737         o_conv = OnionMessagePath_clone(&o_conv);
20738         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20739         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
20740         return tag_ptr(ret_conv, true);
20741 }
20742
20743 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
20744         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20745         *ret_conv = CResult_OnionMessagePathNoneZ_err();
20746         return tag_ptr(ret_conv, true);
20747 }
20748
20749 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
20750         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
20751         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
20752         return ret_conv;
20753 }
20754
20755 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
20756         if (!ptr_is_owned(_res)) return;
20757         void* _res_ptr = untag_ptr(_res);
20758         CHECK_ACCESS(_res_ptr);
20759         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
20760         FREE(untag_ptr(_res));
20761         CResult_OnionMessagePathNoneZ_free(_res_conv);
20762 }
20763
20764 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
20765         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20766         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
20767         return tag_ptr(ret_conv, true);
20768 }
20769 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
20770         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
20771         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
20772         return ret_conv;
20773 }
20774
20775 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
20776         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
20777         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20778         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
20779         return tag_ptr(ret_conv, true);
20780 }
20781
20782 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_ok(uint64_tArray o) {
20783         LDKCVec_BlindedPathZ o_constr;
20784         o_constr.datalen = o->arr_len;
20785         if (o_constr.datalen > 0)
20786                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20787         else
20788                 o_constr.data = NULL;
20789         uint64_t* o_vals = o->elems;
20790         for (size_t n = 0; n < o_constr.datalen; n++) {
20791                 uint64_t o_conv_13 = o_vals[n];
20792                 LDKBlindedPath o_conv_13_conv;
20793                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
20794                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
20795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
20796                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
20797                 o_constr.data[n] = o_conv_13_conv;
20798         }
20799         FREE(o);
20800         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20801         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
20802         return tag_ptr(ret_conv, true);
20803 }
20804
20805 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_err"))) TS_CResult_CVec_BlindedPathZNoneZ_err() {
20806         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20807         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
20808         return tag_ptr(ret_conv, true);
20809 }
20810
20811 jboolean  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_is_ok"))) TS_CResult_CVec_BlindedPathZNoneZ_is_ok(uint64_t o) {
20812         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
20813         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
20814         return ret_conv;
20815 }
20816
20817 void  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_free"))) TS_CResult_CVec_BlindedPathZNoneZ_free(uint64_t _res) {
20818         if (!ptr_is_owned(_res)) return;
20819         void* _res_ptr = untag_ptr(_res);
20820         CHECK_ACCESS(_res_ptr);
20821         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
20822         FREE(untag_ptr(_res));
20823         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
20824 }
20825
20826 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
20827         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20828         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
20829         return tag_ptr(ret_conv, true);
20830 }
20831 int64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr"))) TS_CResult_CVec_BlindedPathZNoneZ_clone_ptr(uint64_t arg) {
20832         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
20833         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
20834         return ret_conv;
20835 }
20836
20837 uint64_t  __attribute__((export_name("TS_CResult_CVec_BlindedPathZNoneZ_clone"))) TS_CResult_CVec_BlindedPathZNoneZ_clone(uint64_t orig) {
20838         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
20839         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20840         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
20841         return tag_ptr(ret_conv, true);
20842 }
20843
20844 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
20845         LDKInFlightHtlcs o_conv;
20846         o_conv.inner = untag_ptr(o);
20847         o_conv.is_owned = ptr_is_owned(o);
20848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20849         o_conv = InFlightHtlcs_clone(&o_conv);
20850         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20851         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
20852         return tag_ptr(ret_conv, true);
20853 }
20854
20855 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
20856         void* e_ptr = untag_ptr(e);
20857         CHECK_ACCESS(e_ptr);
20858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20860         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20861         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
20862         return tag_ptr(ret_conv, true);
20863 }
20864
20865 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
20866         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
20867         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
20868         return ret_conv;
20869 }
20870
20871 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
20872         if (!ptr_is_owned(_res)) return;
20873         void* _res_ptr = untag_ptr(_res);
20874         CHECK_ACCESS(_res_ptr);
20875         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
20876         FREE(untag_ptr(_res));
20877         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
20878 }
20879
20880 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
20881         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20882         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
20883         return tag_ptr(ret_conv, true);
20884 }
20885 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
20886         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
20887         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
20888         return ret_conv;
20889 }
20890
20891 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
20892         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
20893         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20894         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
20895         return tag_ptr(ret_conv, true);
20896 }
20897
20898 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
20899         LDKRouteHop o_conv;
20900         o_conv.inner = untag_ptr(o);
20901         o_conv.is_owned = ptr_is_owned(o);
20902         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20903         o_conv = RouteHop_clone(&o_conv);
20904         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20905         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
20906         return tag_ptr(ret_conv, true);
20907 }
20908
20909 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
20910         void* e_ptr = untag_ptr(e);
20911         CHECK_ACCESS(e_ptr);
20912         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20913         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20914         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20915         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
20916         return tag_ptr(ret_conv, true);
20917 }
20918
20919 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
20920         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
20921         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
20922         return ret_conv;
20923 }
20924
20925 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
20926         if (!ptr_is_owned(_res)) return;
20927         void* _res_ptr = untag_ptr(_res);
20928         CHECK_ACCESS(_res_ptr);
20929         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
20930         FREE(untag_ptr(_res));
20931         CResult_RouteHopDecodeErrorZ_free(_res_conv);
20932 }
20933
20934 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
20935         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20936         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
20937         return tag_ptr(ret_conv, true);
20938 }
20939 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
20940         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
20941         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
20942         return ret_conv;
20943 }
20944
20945 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
20946         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
20947         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
20948         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
20949         return tag_ptr(ret_conv, true);
20950 }
20951
20952 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
20953         LDKCVec_BlindedHopZ _res_constr;
20954         _res_constr.datalen = _res->arr_len;
20955         if (_res_constr.datalen > 0)
20956                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
20957         else
20958                 _res_constr.data = NULL;
20959         uint64_t* _res_vals = _res->elems;
20960         for (size_t m = 0; m < _res_constr.datalen; m++) {
20961                 uint64_t _res_conv_12 = _res_vals[m];
20962                 LDKBlindedHop _res_conv_12_conv;
20963                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
20964                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
20965                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
20966                 _res_constr.data[m] = _res_conv_12_conv;
20967         }
20968         FREE(_res);
20969         CVec_BlindedHopZ_free(_res_constr);
20970 }
20971
20972 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
20973         LDKBlindedTail o_conv;
20974         o_conv.inner = untag_ptr(o);
20975         o_conv.is_owned = ptr_is_owned(o);
20976         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20977         o_conv = BlindedTail_clone(&o_conv);
20978         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20979         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
20980         return tag_ptr(ret_conv, true);
20981 }
20982
20983 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
20984         void* e_ptr = untag_ptr(e);
20985         CHECK_ACCESS(e_ptr);
20986         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20987         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20988         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
20989         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
20990         return tag_ptr(ret_conv, true);
20991 }
20992
20993 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
20994         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
20995         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
20996         return ret_conv;
20997 }
20998
20999 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
21000         if (!ptr_is_owned(_res)) return;
21001         void* _res_ptr = untag_ptr(_res);
21002         CHECK_ACCESS(_res_ptr);
21003         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
21004         FREE(untag_ptr(_res));
21005         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
21006 }
21007
21008 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
21009         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21010         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
21011         return tag_ptr(ret_conv, true);
21012 }
21013 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
21014         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
21015         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
21016         return ret_conv;
21017 }
21018
21019 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
21020         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
21021         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21022         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
21023         return tag_ptr(ret_conv, true);
21024 }
21025
21026 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
21027         LDKCVec_RouteHopZ _res_constr;
21028         _res_constr.datalen = _res->arr_len;
21029         if (_res_constr.datalen > 0)
21030                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21031         else
21032                 _res_constr.data = NULL;
21033         uint64_t* _res_vals = _res->elems;
21034         for (size_t k = 0; k < _res_constr.datalen; k++) {
21035                 uint64_t _res_conv_10 = _res_vals[k];
21036                 LDKRouteHop _res_conv_10_conv;
21037                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21038                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21039                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21040                 _res_constr.data[k] = _res_conv_10_conv;
21041         }
21042         FREE(_res);
21043         CVec_RouteHopZ_free(_res_constr);
21044 }
21045
21046 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
21047         LDKCVec_PathZ _res_constr;
21048         _res_constr.datalen = _res->arr_len;
21049         if (_res_constr.datalen > 0)
21050                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
21051         else
21052                 _res_constr.data = NULL;
21053         uint64_t* _res_vals = _res->elems;
21054         for (size_t g = 0; g < _res_constr.datalen; g++) {
21055                 uint64_t _res_conv_6 = _res_vals[g];
21056                 LDKPath _res_conv_6_conv;
21057                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21058                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21059                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21060                 _res_constr.data[g] = _res_conv_6_conv;
21061         }
21062         FREE(_res);
21063         CVec_PathZ_free(_res_constr);
21064 }
21065
21066 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
21067         LDKRoute o_conv;
21068         o_conv.inner = untag_ptr(o);
21069         o_conv.is_owned = ptr_is_owned(o);
21070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21071         o_conv = Route_clone(&o_conv);
21072         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21073         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
21074         return tag_ptr(ret_conv, true);
21075 }
21076
21077 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
21078         void* e_ptr = untag_ptr(e);
21079         CHECK_ACCESS(e_ptr);
21080         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21081         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21082         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21083         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
21084         return tag_ptr(ret_conv, true);
21085 }
21086
21087 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
21088         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
21089         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
21090         return ret_conv;
21091 }
21092
21093 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
21094         if (!ptr_is_owned(_res)) return;
21095         void* _res_ptr = untag_ptr(_res);
21096         CHECK_ACCESS(_res_ptr);
21097         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
21098         FREE(untag_ptr(_res));
21099         CResult_RouteDecodeErrorZ_free(_res_conv);
21100 }
21101
21102 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
21103         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21104         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
21105         return tag_ptr(ret_conv, true);
21106 }
21107 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
21108         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
21109         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
21110         return ret_conv;
21111 }
21112
21113 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
21114         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
21115         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21116         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
21117         return tag_ptr(ret_conv, true);
21118 }
21119
21120 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
21121         LDKRouteParameters o_conv;
21122         o_conv.inner = untag_ptr(o);
21123         o_conv.is_owned = ptr_is_owned(o);
21124         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21125         o_conv = RouteParameters_clone(&o_conv);
21126         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21127         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
21128         return tag_ptr(ret_conv, true);
21129 }
21130
21131 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
21132         void* e_ptr = untag_ptr(e);
21133         CHECK_ACCESS(e_ptr);
21134         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21135         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21136         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21137         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
21138         return tag_ptr(ret_conv, true);
21139 }
21140
21141 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
21142         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
21143         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
21144         return ret_conv;
21145 }
21146
21147 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
21148         if (!ptr_is_owned(_res)) return;
21149         void* _res_ptr = untag_ptr(_res);
21150         CHECK_ACCESS(_res_ptr);
21151         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
21152         FREE(untag_ptr(_res));
21153         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
21154 }
21155
21156 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
21157         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21158         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
21159         return tag_ptr(ret_conv, true);
21160 }
21161 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
21162         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
21163         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
21164         return ret_conv;
21165 }
21166
21167 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
21168         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
21169         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21170         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
21171         return tag_ptr(ret_conv, true);
21172 }
21173
21174 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
21175         LDKCVec_u64Z _res_constr;
21176         _res_constr.datalen = _res->arr_len;
21177         if (_res_constr.datalen > 0)
21178                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21179         else
21180                 _res_constr.data = NULL;
21181         int64_t* _res_vals = _res->elems;
21182         for (size_t i = 0; i < _res_constr.datalen; i++) {
21183                 int64_t _res_conv_8 = _res_vals[i];
21184                 _res_constr.data[i] = _res_conv_8;
21185         }
21186         FREE(_res);
21187         CVec_u64Z_free(_res_constr);
21188 }
21189
21190 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
21191         LDKPaymentParameters o_conv;
21192         o_conv.inner = untag_ptr(o);
21193         o_conv.is_owned = ptr_is_owned(o);
21194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21195         o_conv = PaymentParameters_clone(&o_conv);
21196         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21197         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21198         return tag_ptr(ret_conv, true);
21199 }
21200
21201 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
21202         void* e_ptr = untag_ptr(e);
21203         CHECK_ACCESS(e_ptr);
21204         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21205         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21206         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21207         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21208         return tag_ptr(ret_conv, true);
21209 }
21210
21211 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
21212         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21213         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21214         return ret_conv;
21215 }
21216
21217 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
21218         if (!ptr_is_owned(_res)) return;
21219         void* _res_ptr = untag_ptr(_res);
21220         CHECK_ACCESS(_res_ptr);
21221         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21222         FREE(untag_ptr(_res));
21223         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21224 }
21225
21226 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21227         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21228         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21229         return tag_ptr(ret_conv, true);
21230 }
21231 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
21232         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21233         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21234         return ret_conv;
21235 }
21236
21237 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
21238         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21239         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21240         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21241         return tag_ptr(ret_conv, true);
21242 }
21243
21244 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
21245         LDKCVec_RouteHintZ _res_constr;
21246         _res_constr.datalen = _res->arr_len;
21247         if (_res_constr.datalen > 0)
21248                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21249         else
21250                 _res_constr.data = NULL;
21251         uint64_t* _res_vals = _res->elems;
21252         for (size_t l = 0; l < _res_constr.datalen; l++) {
21253                 uint64_t _res_conv_11 = _res_vals[l];
21254                 LDKRouteHint _res_conv_11_conv;
21255                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21256                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21257                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21258                 _res_constr.data[l] = _res_conv_11_conv;
21259         }
21260         FREE(_res);
21261         CVec_RouteHintZ_free(_res_constr);
21262 }
21263
21264 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
21265         LDKCVec_RouteHintHopZ _res_constr;
21266         _res_constr.datalen = _res->arr_len;
21267         if (_res_constr.datalen > 0)
21268                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21269         else
21270                 _res_constr.data = NULL;
21271         uint64_t* _res_vals = _res->elems;
21272         for (size_t o = 0; o < _res_constr.datalen; o++) {
21273                 uint64_t _res_conv_14 = _res_vals[o];
21274                 LDKRouteHintHop _res_conv_14_conv;
21275                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21276                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21277                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21278                 _res_constr.data[o] = _res_conv_14_conv;
21279         }
21280         FREE(_res);
21281         CVec_RouteHintHopZ_free(_res_constr);
21282 }
21283
21284 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
21285         LDKRouteHint o_conv;
21286         o_conv.inner = untag_ptr(o);
21287         o_conv.is_owned = ptr_is_owned(o);
21288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21289         o_conv = RouteHint_clone(&o_conv);
21290         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21291         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21292         return tag_ptr(ret_conv, true);
21293 }
21294
21295 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
21296         void* e_ptr = untag_ptr(e);
21297         CHECK_ACCESS(e_ptr);
21298         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21299         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21300         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21301         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21302         return tag_ptr(ret_conv, true);
21303 }
21304
21305 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
21306         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21307         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21308         return ret_conv;
21309 }
21310
21311 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
21312         if (!ptr_is_owned(_res)) return;
21313         void* _res_ptr = untag_ptr(_res);
21314         CHECK_ACCESS(_res_ptr);
21315         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21316         FREE(untag_ptr(_res));
21317         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21318 }
21319
21320 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21321         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21322         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21323         return tag_ptr(ret_conv, true);
21324 }
21325 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
21326         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21327         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21328         return ret_conv;
21329 }
21330
21331 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
21332         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21333         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21334         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21335         return tag_ptr(ret_conv, true);
21336 }
21337
21338 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
21339         LDKRouteHintHop o_conv;
21340         o_conv.inner = untag_ptr(o);
21341         o_conv.is_owned = ptr_is_owned(o);
21342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21343         o_conv = RouteHintHop_clone(&o_conv);
21344         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21345         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21346         return tag_ptr(ret_conv, true);
21347 }
21348
21349 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
21350         void* e_ptr = untag_ptr(e);
21351         CHECK_ACCESS(e_ptr);
21352         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21353         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21354         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21355         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21356         return tag_ptr(ret_conv, true);
21357 }
21358
21359 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
21360         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21361         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21362         return ret_conv;
21363 }
21364
21365 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
21366         if (!ptr_is_owned(_res)) return;
21367         void* _res_ptr = untag_ptr(_res);
21368         CHECK_ACCESS(_res_ptr);
21369         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21370         FREE(untag_ptr(_res));
21371         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21372 }
21373
21374 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21375         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21376         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21377         return tag_ptr(ret_conv, true);
21378 }
21379 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
21380         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21381         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21382         return ret_conv;
21383 }
21384
21385 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
21386         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21387         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21388         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21389         return tag_ptr(ret_conv, true);
21390 }
21391
21392 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
21393         LDKFixedPenaltyScorer o_conv;
21394         o_conv.inner = untag_ptr(o);
21395         o_conv.is_owned = ptr_is_owned(o);
21396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21397         o_conv = FixedPenaltyScorer_clone(&o_conv);
21398         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21399         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21400         return tag_ptr(ret_conv, true);
21401 }
21402
21403 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
21404         void* e_ptr = untag_ptr(e);
21405         CHECK_ACCESS(e_ptr);
21406         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21407         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21408         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21409         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21410         return tag_ptr(ret_conv, true);
21411 }
21412
21413 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
21414         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21415         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21416         return ret_conv;
21417 }
21418
21419 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
21420         if (!ptr_is_owned(_res)) return;
21421         void* _res_ptr = untag_ptr(_res);
21422         CHECK_ACCESS(_res_ptr);
21423         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21424         FREE(untag_ptr(_res));
21425         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21426 }
21427
21428 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21429         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21430         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21431         return tag_ptr(ret_conv, true);
21432 }
21433 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
21434         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21435         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21436         return ret_conv;
21437 }
21438
21439 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
21440         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21441         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21442         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21443         return tag_ptr(ret_conv, true);
21444 }
21445
21446 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
21447         LDKCVec_NodeIdZ _res_constr;
21448         _res_constr.datalen = _res->arr_len;
21449         if (_res_constr.datalen > 0)
21450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21451         else
21452                 _res_constr.data = NULL;
21453         uint64_t* _res_vals = _res->elems;
21454         for (size_t i = 0; i < _res_constr.datalen; i++) {
21455                 uint64_t _res_conv_8 = _res_vals[i];
21456                 LDKNodeId _res_conv_8_conv;
21457                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21458                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21459                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21460                 _res_constr.data[i] = _res_conv_8_conv;
21461         }
21462         FREE(_res);
21463         CVec_NodeIdZ_free(_res_constr);
21464 }
21465
21466 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21467         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21468         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21469         return tag_ptr(ret_conv, true);
21470 }
21471 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
21472         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21473         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21474         return ret_conv;
21475 }
21476
21477 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
21478         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21479         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21480         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21481         return tag_ptr(ret_conv, true);
21482 }
21483
21484 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
21485         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21486         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21487         return tag_ptr(ret_conv, true);
21488 }
21489
21490 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
21491         if (!ptr_is_owned(_res)) return;
21492         void* _res_ptr = untag_ptr(_res);
21493         CHECK_ACCESS(_res_ptr);
21494         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21495         FREE(untag_ptr(_res));
21496         C2Tuple_u64u64Z_free(_res_conv);
21497 }
21498
21499 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
21500         void* o_ptr = untag_ptr(o);
21501         CHECK_ACCESS(o_ptr);
21502         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21503         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21504         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21505         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21506         uint64_t ret_ref = tag_ptr(ret_copy, true);
21507         return ret_ref;
21508 }
21509
21510 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
21511         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21512         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21513         uint64_t ret_ref = tag_ptr(ret_copy, true);
21514         return ret_ref;
21515 }
21516
21517 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
21518         if (!ptr_is_owned(_res)) return;
21519         void* _res_ptr = untag_ptr(_res);
21520         CHECK_ACCESS(_res_ptr);
21521         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21522         FREE(untag_ptr(_res));
21523         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21524 }
21525
21526 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21527         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21528         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21529         uint64_t ret_ref = tag_ptr(ret_copy, true);
21530         return ret_ref;
21531 }
21532 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
21533         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21534         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21535         return ret_conv;
21536 }
21537
21538 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
21539         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21540         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21541         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21542         uint64_t ret_ref = tag_ptr(ret_copy, true);
21543         return ret_ref;
21544 }
21545
21546 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
21547         LDKThirtyTwoU16s a_ref;
21548         CHECK(a->arr_len == 32);
21549         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21550         LDKThirtyTwoU16s b_ref;
21551         CHECK(b->arr_len == 32);
21552         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21553         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21554         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21555         return tag_ptr(ret_conv, true);
21556 }
21557
21558 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
21559         if (!ptr_is_owned(_res)) return;
21560         void* _res_ptr = untag_ptr(_res);
21561         CHECK_ACCESS(_res_ptr);
21562         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21563         FREE(untag_ptr(_res));
21564         C2Tuple_Z_free(_res_conv);
21565 }
21566
21567 uint64_t  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_new"))) TS_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
21568         LDKThirtyTwoU16s a_ref;
21569         CHECK(a->arr_len == 32);
21570         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21571         LDKThirtyTwoU16s b_ref;
21572         CHECK(b->arr_len == 32);
21573         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21574         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
21575         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
21576         return tag_ptr(ret_conv, true);
21577 }
21578
21579 void  __attribute__((export_name("TS_C2Tuple__u1632_u1632Z_free"))) TS_C2Tuple__u1632_u1632Z_free(uint64_t _res) {
21580         if (!ptr_is_owned(_res)) return;
21581         void* _res_ptr = untag_ptr(_res);
21582         CHECK_ACCESS(_res_ptr);
21583         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
21584         FREE(untag_ptr(_res));
21585         C2Tuple__u1632_u1632Z_free(_res_conv);
21586 }
21587
21588 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(uint64_t o) {
21589         void* o_ptr = untag_ptr(o);
21590         CHECK_ACCESS(o_ptr);
21591         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
21592         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
21593         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21594         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
21595         uint64_t ret_ref = tag_ptr(ret_copy, true);
21596         return ret_ref;
21597 }
21598
21599 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
21600         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21601         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
21602         uint64_t ret_ref = tag_ptr(ret_copy, true);
21603         return ret_ref;
21604 }
21605
21606 void  __attribute__((export_name("TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free"))) TS_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(uint64_t _res) {
21607         if (!ptr_is_owned(_res)) return;
21608         void* _res_ptr = untag_ptr(_res);
21609         CHECK_ACCESS(_res_ptr);
21610         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
21611         FREE(untag_ptr(_res));
21612         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
21613 }
21614
21615 uint64_t  __attribute__((export_name("TS_COption_f64Z_some"))) TS_COption_f64Z_some(double o) {
21616         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21617         *ret_copy = COption_f64Z_some(o);
21618         uint64_t ret_ref = tag_ptr(ret_copy, true);
21619         return ret_ref;
21620 }
21621
21622 uint64_t  __attribute__((export_name("TS_COption_f64Z_none"))) TS_COption_f64Z_none() {
21623         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21624         *ret_copy = COption_f64Z_none();
21625         uint64_t ret_ref = tag_ptr(ret_copy, true);
21626         return ret_ref;
21627 }
21628
21629 void  __attribute__((export_name("TS_COption_f64Z_free"))) TS_COption_f64Z_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_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
21634         FREE(untag_ptr(_res));
21635         COption_f64Z_free(_res_conv);
21636 }
21637
21638 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
21639         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21640         *ret_copy = COption_f64Z_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_f64Z_clone_ptr"))) TS_COption_f64Z_clone_ptr(uint64_t arg) {
21645         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
21646         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
21647         return ret_conv;
21648 }
21649
21650 uint64_t  __attribute__((export_name("TS_COption_f64Z_clone"))) TS_COption_f64Z_clone(uint64_t orig) {
21651         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
21652         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21653         *ret_copy = COption_f64Z_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_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
21659         LDKProbabilisticScorer o_conv;
21660         o_conv.inner = untag_ptr(o);
21661         o_conv.is_owned = ptr_is_owned(o);
21662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21663         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
21664         
21665         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21666         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
21667         return tag_ptr(ret_conv, true);
21668 }
21669
21670 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
21671         void* e_ptr = untag_ptr(e);
21672         CHECK_ACCESS(e_ptr);
21673         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21674         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21675         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21676         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
21677         return tag_ptr(ret_conv, true);
21678 }
21679
21680 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
21681         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
21682         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
21683         return ret_conv;
21684 }
21685
21686 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
21687         if (!ptr_is_owned(_res)) return;
21688         void* _res_ptr = untag_ptr(_res);
21689         CHECK_ACCESS(_res_ptr);
21690         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
21691         FREE(untag_ptr(_res));
21692         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
21693 }
21694
21695 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_ok"))) TS_CResult_BestBlockDecodeErrorZ_ok(uint64_t o) {
21696         LDKBestBlock o_conv;
21697         o_conv.inner = untag_ptr(o);
21698         o_conv.is_owned = ptr_is_owned(o);
21699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21700         o_conv = BestBlock_clone(&o_conv);
21701         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21702         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
21703         return tag_ptr(ret_conv, true);
21704 }
21705
21706 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_err"))) TS_CResult_BestBlockDecodeErrorZ_err(uint64_t e) {
21707         void* e_ptr = untag_ptr(e);
21708         CHECK_ACCESS(e_ptr);
21709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21711         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21712         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
21713         return tag_ptr(ret_conv, true);
21714 }
21715
21716 jboolean  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_is_ok"))) TS_CResult_BestBlockDecodeErrorZ_is_ok(uint64_t o) {
21717         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
21718         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
21719         return ret_conv;
21720 }
21721
21722 void  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_free"))) TS_CResult_BestBlockDecodeErrorZ_free(uint64_t _res) {
21723         if (!ptr_is_owned(_res)) return;
21724         void* _res_ptr = untag_ptr(_res);
21725         CHECK_ACCESS(_res_ptr);
21726         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
21727         FREE(untag_ptr(_res));
21728         CResult_BestBlockDecodeErrorZ_free(_res_conv);
21729 }
21730
21731 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
21732         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21733         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
21734         return tag_ptr(ret_conv, true);
21735 }
21736 int64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_clone_ptr"))) TS_CResult_BestBlockDecodeErrorZ_clone_ptr(uint64_t arg) {
21737         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
21738         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
21739         return ret_conv;
21740 }
21741
21742 uint64_t  __attribute__((export_name("TS_CResult_BestBlockDecodeErrorZ_clone"))) TS_CResult_BestBlockDecodeErrorZ_clone(uint64_t orig) {
21743         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
21744         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21745         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
21746         return tag_ptr(ret_conv, true);
21747 }
21748
21749 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
21750         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21751         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
21752         return tag_ptr(ret_conv, true);
21753 }
21754 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
21755         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
21756         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
21757         return ret_conv;
21758 }
21759
21760 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
21761         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
21762         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21763         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
21764         return tag_ptr(ret_conv, true);
21765 }
21766
21767 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
21768         LDKTransaction b_ref;
21769         b_ref.datalen = b->arr_len;
21770         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
21771         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21772         b_ref.data_is_owned = true;
21773         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21774         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
21775         return tag_ptr(ret_conv, true);
21776 }
21777
21778 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
21779         if (!ptr_is_owned(_res)) return;
21780         void* _res_ptr = untag_ptr(_res);
21781         CHECK_ACCESS(_res_ptr);
21782         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
21783         FREE(untag_ptr(_res));
21784         C2Tuple_usizeTransactionZ_free(_res_conv);
21785 }
21786
21787 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
21788         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
21789         _res_constr.datalen = _res->arr_len;
21790         if (_res_constr.datalen > 0)
21791                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
21792         else
21793                 _res_constr.data = NULL;
21794         uint64_t* _res_vals = _res->elems;
21795         for (size_t c = 0; c < _res_constr.datalen; c++) {
21796                 uint64_t _res_conv_28 = _res_vals[c];
21797                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
21798                 CHECK_ACCESS(_res_conv_28_ptr);
21799                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
21800                 FREE(untag_ptr(_res_conv_28));
21801                 _res_constr.data[c] = _res_conv_28_conv;
21802         }
21803         FREE(_res);
21804         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
21805 }
21806
21807 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21808         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21809         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
21810         return tag_ptr(ret_conv, true);
21811 }
21812 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(uint64_t arg) {
21813         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
21814         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21815         return ret_conv;
21816 }
21817
21818 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(uint64_t orig) {
21819         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
21820         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21821         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
21822         return tag_ptr(ret_conv, true);
21823 }
21824
21825 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, uint64_t c) {
21826         LDKThirtyTwoBytes a_ref;
21827         CHECK(a->arr_len == 32);
21828         memcpy(a_ref.data, a->elems, 32); FREE(a);
21829         void* c_ptr = untag_ptr(c);
21830         CHECK_ACCESS(c_ptr);
21831         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
21832         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
21833         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21834         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
21835         return tag_ptr(ret_conv, true);
21836 }
21837
21838 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free"))) TS_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(uint64_t _res) {
21839         if (!ptr_is_owned(_res)) return;
21840         void* _res_ptr = untag_ptr(_res);
21841         CHECK_ACCESS(_res_ptr);
21842         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
21843         FREE(untag_ptr(_res));
21844         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
21845 }
21846
21847 void  __attribute__((export_name("TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free"))) TS_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(uint64_tArray _res) {
21848         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
21849         _res_constr.datalen = _res->arr_len;
21850         if (_res_constr.datalen > 0)
21851                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
21852         else
21853                 _res_constr.data = NULL;
21854         uint64_t* _res_vals = _res->elems;
21855         for (size_t c = 0; c < _res_constr.datalen; c++) {
21856                 uint64_t _res_conv_54 = _res_vals[c];
21857                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
21858                 CHECK_ACCESS(_res_conv_54_ptr);
21859                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
21860                 FREE(untag_ptr(_res_conv_54));
21861                 _res_constr.data[c] = _res_conv_54_conv;
21862         }
21863         FREE(_res);
21864         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
21865 }
21866
21867 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_ok(uint32_t o) {
21868         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_js(o);
21869         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21870         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
21871         return tag_ptr(ret_conv, true);
21872 }
21873
21874 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_err"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
21875         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21876         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
21877         return tag_ptr(ret_conv, true);
21878 }
21879
21880 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(uint64_t o) {
21881         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
21882         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
21883         return ret_conv;
21884 }
21885
21886 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_free"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_free(uint64_t _res) {
21887         if (!ptr_is_owned(_res)) return;
21888         void* _res_ptr = untag_ptr(_res);
21889         CHECK_ACCESS(_res_ptr);
21890         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
21891         FREE(untag_ptr(_res));
21892         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
21893 }
21894
21895 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
21896         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21897         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
21898         return tag_ptr(ret_conv, true);
21899 }
21900 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(uint64_t arg) {
21901         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
21902         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
21903         return ret_conv;
21904 }
21905
21906 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone"))) TS_CResult_ChannelMonitorUpdateStatusNoneZ_clone(uint64_t orig) {
21907         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
21908         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
21909         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
21910         return tag_ptr(ret_conv, true);
21911 }
21912
21913 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
21914         LDKCVec_MonitorEventZ _res_constr;
21915         _res_constr.datalen = _res->arr_len;
21916         if (_res_constr.datalen > 0)
21917                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
21918         else
21919                 _res_constr.data = NULL;
21920         uint64_t* _res_vals = _res->elems;
21921         for (size_t o = 0; o < _res_constr.datalen; o++) {
21922                 uint64_t _res_conv_14 = _res_vals[o];
21923                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
21924                 CHECK_ACCESS(_res_conv_14_ptr);
21925                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
21926                 FREE(untag_ptr(_res_conv_14));
21927                 _res_constr.data[o] = _res_conv_14_conv;
21928         }
21929         FREE(_res);
21930         CVec_MonitorEventZ_free(_res_constr);
21931 }
21932
21933 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
21934         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21935         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
21936         return tag_ptr(ret_conv, true);
21937 }
21938 int64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
21939         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
21940         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
21941         return ret_conv;
21942 }
21943
21944 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
21945         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
21946         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21947         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
21948         return tag_ptr(ret_conv, true);
21949 }
21950
21951 uint64_t  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_t b, uint64_tArray c, int8_tArray d) {
21952         LDKOutPoint a_conv;
21953         a_conv.inner = untag_ptr(a);
21954         a_conv.is_owned = ptr_is_owned(a);
21955         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21956         a_conv = OutPoint_clone(&a_conv);
21957         LDKChannelId b_conv;
21958         b_conv.inner = untag_ptr(b);
21959         b_conv.is_owned = ptr_is_owned(b);
21960         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21961         b_conv = ChannelId_clone(&b_conv);
21962         LDKCVec_MonitorEventZ c_constr;
21963         c_constr.datalen = c->arr_len;
21964         if (c_constr.datalen > 0)
21965                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
21966         else
21967                 c_constr.data = NULL;
21968         uint64_t* c_vals = c->elems;
21969         for (size_t o = 0; o < c_constr.datalen; o++) {
21970                 uint64_t c_conv_14 = c_vals[o];
21971                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
21972                 CHECK_ACCESS(c_conv_14_ptr);
21973                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
21974                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
21975                 c_constr.data[o] = c_conv_14_conv;
21976         }
21977         FREE(c);
21978         LDKPublicKey d_ref;
21979         CHECK(d->arr_len == 33);
21980         memcpy(d_ref.compressed_form, d->elems, 33); FREE(d);
21981         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
21982         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
21983         return tag_ptr(ret_conv, true);
21984 }
21985
21986 void  __attribute__((export_name("TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free"))) TS_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
21987         if (!ptr_is_owned(_res)) return;
21988         void* _res_ptr = untag_ptr(_res);
21989         CHECK_ACCESS(_res_ptr);
21990         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
21991         FREE(untag_ptr(_res));
21992         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
21993 }
21994
21995 void  __attribute__((export_name("TS_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
21996         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
21997         _res_constr.datalen = _res->arr_len;
21998         if (_res_constr.datalen > 0)
21999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
22000         else
22001                 _res_constr.data = NULL;
22002         uint64_t* _res_vals = _res->elems;
22003         for (size_t f = 0; f < _res_constr.datalen; f++) {
22004                 uint64_t _res_conv_57 = _res_vals[f];
22005                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
22006                 CHECK_ACCESS(_res_conv_57_ptr);
22007                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
22008                 FREE(untag_ptr(_res_conv_57));
22009                 _res_constr.data[f] = _res_conv_57_conv;
22010         }
22011         FREE(_res);
22012         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
22013 }
22014
22015 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
22016         LDKInitFeatures o_conv;
22017         o_conv.inner = untag_ptr(o);
22018         o_conv.is_owned = ptr_is_owned(o);
22019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22020         o_conv = InitFeatures_clone(&o_conv);
22021         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22022         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
22023         return tag_ptr(ret_conv, true);
22024 }
22025
22026 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
22027         void* e_ptr = untag_ptr(e);
22028         CHECK_ACCESS(e_ptr);
22029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22031         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22032         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
22033         return tag_ptr(ret_conv, true);
22034 }
22035
22036 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22037         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
22038         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
22039         return ret_conv;
22040 }
22041
22042 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
22043         if (!ptr_is_owned(_res)) return;
22044         void* _res_ptr = untag_ptr(_res);
22045         CHECK_ACCESS(_res_ptr);
22046         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
22047         FREE(untag_ptr(_res));
22048         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
22049 }
22050
22051 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22052         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22053         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
22054         return tag_ptr(ret_conv, true);
22055 }
22056 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22057         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
22058         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22059         return ret_conv;
22060 }
22061
22062 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
22063         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
22064         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22065         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
22066         return tag_ptr(ret_conv, true);
22067 }
22068
22069 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
22070         LDKChannelFeatures o_conv;
22071         o_conv.inner = untag_ptr(o);
22072         o_conv.is_owned = ptr_is_owned(o);
22073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22074         o_conv = ChannelFeatures_clone(&o_conv);
22075         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22076         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
22077         return tag_ptr(ret_conv, true);
22078 }
22079
22080 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
22081         void* e_ptr = untag_ptr(e);
22082         CHECK_ACCESS(e_ptr);
22083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22085         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22086         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
22087         return tag_ptr(ret_conv, true);
22088 }
22089
22090 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22091         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
22092         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
22093         return ret_conv;
22094 }
22095
22096 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
22097         if (!ptr_is_owned(_res)) return;
22098         void* _res_ptr = untag_ptr(_res);
22099         CHECK_ACCESS(_res_ptr);
22100         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
22101         FREE(untag_ptr(_res));
22102         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
22103 }
22104
22105 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22106         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22107         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
22108         return tag_ptr(ret_conv, true);
22109 }
22110 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22111         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
22112         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22113         return ret_conv;
22114 }
22115
22116 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
22117         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
22118         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22119         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
22120         return tag_ptr(ret_conv, true);
22121 }
22122
22123 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
22124         LDKNodeFeatures o_conv;
22125         o_conv.inner = untag_ptr(o);
22126         o_conv.is_owned = ptr_is_owned(o);
22127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22128         o_conv = NodeFeatures_clone(&o_conv);
22129         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22130         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
22131         return tag_ptr(ret_conv, true);
22132 }
22133
22134 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
22135         void* e_ptr = untag_ptr(e);
22136         CHECK_ACCESS(e_ptr);
22137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22139         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22140         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
22141         return tag_ptr(ret_conv, true);
22142 }
22143
22144 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22145         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
22146         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
22147         return ret_conv;
22148 }
22149
22150 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
22151         if (!ptr_is_owned(_res)) return;
22152         void* _res_ptr = untag_ptr(_res);
22153         CHECK_ACCESS(_res_ptr);
22154         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
22155         FREE(untag_ptr(_res));
22156         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
22157 }
22158
22159 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22160         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22161         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
22162         return tag_ptr(ret_conv, true);
22163 }
22164 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22165         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
22166         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22167         return ret_conv;
22168 }
22169
22170 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
22171         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
22172         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22173         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
22174         return tag_ptr(ret_conv, true);
22175 }
22176
22177 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
22178         LDKBolt11InvoiceFeatures o_conv;
22179         o_conv.inner = untag_ptr(o);
22180         o_conv.is_owned = ptr_is_owned(o);
22181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22182         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22183         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22184         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22185         return tag_ptr(ret_conv, true);
22186 }
22187
22188 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
22189         void* e_ptr = untag_ptr(e);
22190         CHECK_ACCESS(e_ptr);
22191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22193         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22194         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22195         return tag_ptr(ret_conv, true);
22196 }
22197
22198 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22199         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22200         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22201         return ret_conv;
22202 }
22203
22204 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
22205         if (!ptr_is_owned(_res)) return;
22206         void* _res_ptr = untag_ptr(_res);
22207         CHECK_ACCESS(_res_ptr);
22208         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22209         FREE(untag_ptr(_res));
22210         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22211 }
22212
22213 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22214         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22215         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22216         return tag_ptr(ret_conv, true);
22217 }
22218 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22219         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22220         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22221         return ret_conv;
22222 }
22223
22224 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
22225         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22226         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22227         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22228         return tag_ptr(ret_conv, true);
22229 }
22230
22231 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
22232         LDKBolt12InvoiceFeatures o_conv;
22233         o_conv.inner = untag_ptr(o);
22234         o_conv.is_owned = ptr_is_owned(o);
22235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22236         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22237         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22238         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22239         return tag_ptr(ret_conv, true);
22240 }
22241
22242 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
22243         void* e_ptr = untag_ptr(e);
22244         CHECK_ACCESS(e_ptr);
22245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22247         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22248         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22249         return tag_ptr(ret_conv, true);
22250 }
22251
22252 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22253         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22254         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22255         return ret_conv;
22256 }
22257
22258 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
22259         if (!ptr_is_owned(_res)) return;
22260         void* _res_ptr = untag_ptr(_res);
22261         CHECK_ACCESS(_res_ptr);
22262         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22263         FREE(untag_ptr(_res));
22264         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22265 }
22266
22267 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22268         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22269         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22270         return tag_ptr(ret_conv, true);
22271 }
22272 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22273         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22274         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22275         return ret_conv;
22276 }
22277
22278 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
22279         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22280         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22281         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22282         return tag_ptr(ret_conv, true);
22283 }
22284
22285 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
22286         LDKBlindedHopFeatures o_conv;
22287         o_conv.inner = untag_ptr(o);
22288         o_conv.is_owned = ptr_is_owned(o);
22289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22290         o_conv = BlindedHopFeatures_clone(&o_conv);
22291         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22292         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22293         return tag_ptr(ret_conv, true);
22294 }
22295
22296 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
22297         void* e_ptr = untag_ptr(e);
22298         CHECK_ACCESS(e_ptr);
22299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22301         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22302         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22303         return tag_ptr(ret_conv, true);
22304 }
22305
22306 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22307         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22308         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22309         return ret_conv;
22310 }
22311
22312 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
22313         if (!ptr_is_owned(_res)) return;
22314         void* _res_ptr = untag_ptr(_res);
22315         CHECK_ACCESS(_res_ptr);
22316         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22317         FREE(untag_ptr(_res));
22318         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22319 }
22320
22321 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22322         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22323         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22324         return tag_ptr(ret_conv, true);
22325 }
22326 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22327         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22328         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22329         return ret_conv;
22330 }
22331
22332 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
22333         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22334         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22335         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22336         return tag_ptr(ret_conv, true);
22337 }
22338
22339 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
22340         LDKChannelTypeFeatures o_conv;
22341         o_conv.inner = untag_ptr(o);
22342         o_conv.is_owned = ptr_is_owned(o);
22343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22344         o_conv = ChannelTypeFeatures_clone(&o_conv);
22345         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22346         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22347         return tag_ptr(ret_conv, true);
22348 }
22349
22350 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
22351         void* e_ptr = untag_ptr(e);
22352         CHECK_ACCESS(e_ptr);
22353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22355         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22356         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22357         return tag_ptr(ret_conv, true);
22358 }
22359
22360 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
22361         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22362         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22363         return ret_conv;
22364 }
22365
22366 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
22367         if (!ptr_is_owned(_res)) return;
22368         void* _res_ptr = untag_ptr(_res);
22369         CHECK_ACCESS(_res_ptr);
22370         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22371         FREE(untag_ptr(_res));
22372         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22373 }
22374
22375 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22376         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22377         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22378         return tag_ptr(ret_conv, true);
22379 }
22380 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
22381         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22382         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22383         return ret_conv;
22384 }
22385
22386 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
22387         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22388         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22389         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22390         return tag_ptr(ret_conv, true);
22391 }
22392
22393 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_ok"))) TS_CResult_OfferIdDecodeErrorZ_ok(uint64_t o) {
22394         LDKOfferId o_conv;
22395         o_conv.inner = untag_ptr(o);
22396         o_conv.is_owned = ptr_is_owned(o);
22397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22398         o_conv = OfferId_clone(&o_conv);
22399         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22400         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
22401         return tag_ptr(ret_conv, true);
22402 }
22403
22404 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_err"))) TS_CResult_OfferIdDecodeErrorZ_err(uint64_t e) {
22405         void* e_ptr = untag_ptr(e);
22406         CHECK_ACCESS(e_ptr);
22407         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22408         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22409         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22410         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
22411         return tag_ptr(ret_conv, true);
22412 }
22413
22414 jboolean  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_is_ok"))) TS_CResult_OfferIdDecodeErrorZ_is_ok(uint64_t o) {
22415         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
22416         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
22417         return ret_conv;
22418 }
22419
22420 void  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_free"))) TS_CResult_OfferIdDecodeErrorZ_free(uint64_t _res) {
22421         if (!ptr_is_owned(_res)) return;
22422         void* _res_ptr = untag_ptr(_res);
22423         CHECK_ACCESS(_res_ptr);
22424         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
22425         FREE(untag_ptr(_res));
22426         CResult_OfferIdDecodeErrorZ_free(_res_conv);
22427 }
22428
22429 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
22430         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22431         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
22432         return tag_ptr(ret_conv, true);
22433 }
22434 int64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_clone_ptr"))) TS_CResult_OfferIdDecodeErrorZ_clone_ptr(uint64_t arg) {
22435         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
22436         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
22437         return ret_conv;
22438 }
22439
22440 uint64_t  __attribute__((export_name("TS_CResult_OfferIdDecodeErrorZ_clone"))) TS_CResult_OfferIdDecodeErrorZ_clone(uint64_t orig) {
22441         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
22442         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22443         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
22444         return tag_ptr(ret_conv, true);
22445 }
22446
22447 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_ok() {
22448         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22449         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22450         return tag_ptr(ret_conv, true);
22451 }
22452
22453 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_err"))) TS_CResult_NoneBolt12SemanticErrorZ_err(uint32_t e) {
22454         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22455         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22456         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22457         return tag_ptr(ret_conv, true);
22458 }
22459
22460 jboolean  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt12SemanticErrorZ_is_ok(uint64_t o) {
22461         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22462         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22463         return ret_conv;
22464 }
22465
22466 void  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_free"))) TS_CResult_NoneBolt12SemanticErrorZ_free(uint64_t _res) {
22467         if (!ptr_is_owned(_res)) return;
22468         void* _res_ptr = untag_ptr(_res);
22469         CHECK_ACCESS(_res_ptr);
22470         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22471         FREE(untag_ptr(_res));
22472         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22473 }
22474
22475 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22476         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22477         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22478         return tag_ptr(ret_conv, true);
22479 }
22480 int64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22481         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22482         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22483         return ret_conv;
22484 }
22485
22486 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt12SemanticErrorZ_clone"))) TS_CResult_NoneBolt12SemanticErrorZ_clone(uint64_t orig) {
22487         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22488         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22489         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22490         return tag_ptr(ret_conv, true);
22491 }
22492
22493 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_ok(uint64_t o) {
22494         LDKOffer o_conv;
22495         o_conv.inner = untag_ptr(o);
22496         o_conv.is_owned = ptr_is_owned(o);
22497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22498         o_conv = Offer_clone(&o_conv);
22499         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22500         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
22501         return tag_ptr(ret_conv, true);
22502 }
22503
22504 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_err"))) TS_CResult_OfferBolt12SemanticErrorZ_err(uint32_t e) {
22505         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22506         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22507         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
22508         return tag_ptr(ret_conv, true);
22509 }
22510
22511 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_is_ok"))) TS_CResult_OfferBolt12SemanticErrorZ_is_ok(uint64_t o) {
22512         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
22513         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
22514         return ret_conv;
22515 }
22516
22517 void  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_free"))) TS_CResult_OfferBolt12SemanticErrorZ_free(uint64_t _res) {
22518         if (!ptr_is_owned(_res)) return;
22519         void* _res_ptr = untag_ptr(_res);
22520         CHECK_ACCESS(_res_ptr);
22521         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
22522         FREE(untag_ptr(_res));
22523         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
22524 }
22525
22526 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
22527         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22528         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
22529         return tag_ptr(ret_conv, true);
22530 }
22531 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_OfferBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
22532         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
22533         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
22534         return ret_conv;
22535 }
22536
22537 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12SemanticErrorZ_clone"))) TS_CResult_OfferBolt12SemanticErrorZ_clone(uint64_t orig) {
22538         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
22539         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22540         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
22541         return tag_ptr(ret_conv, true);
22542 }
22543
22544 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
22545         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
22546         o_conv.inner = untag_ptr(o);
22547         o_conv.is_owned = ptr_is_owned(o);
22548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22549         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
22550         
22551         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22552         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22553         return tag_ptr(ret_conv, true);
22554 }
22555
22556 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(uint32_t e) {
22557         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22558         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22559         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22560         return tag_ptr(ret_conv, true);
22561 }
22562
22563 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
22564         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22565         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22566         return ret_conv;
22567 }
22568
22569 void  __attribute__((export_name("TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
22570         if (!ptr_is_owned(_res)) return;
22571         void* _res_ptr = untag_ptr(_res);
22572         CHECK_ACCESS(_res_ptr);
22573         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22574         FREE(untag_ptr(_res));
22575         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22576 }
22577
22578 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
22579         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
22580         o_conv.inner = untag_ptr(o);
22581         o_conv.is_owned = ptr_is_owned(o);
22582         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22583         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
22584         
22585         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22586         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22587         return tag_ptr(ret_conv, true);
22588 }
22589
22590 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(uint32_t e) {
22591         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
22592         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22593         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22594         return tag_ptr(ret_conv, true);
22595 }
22596
22597 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
22598         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22599         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22600         return ret_conv;
22601 }
22602
22603 void  __attribute__((export_name("TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
22604         if (!ptr_is_owned(_res)) return;
22605         void* _res_ptr = untag_ptr(_res);
22606         CHECK_ACCESS(_res_ptr);
22607         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22608         FREE(untag_ptr(_res));
22609         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22610 }
22611
22612 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
22613         LDKOffer o_conv;
22614         o_conv.inner = untag_ptr(o);
22615         o_conv.is_owned = ptr_is_owned(o);
22616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22617         o_conv = Offer_clone(&o_conv);
22618         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22619         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22620         return tag_ptr(ret_conv, true);
22621 }
22622
22623 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
22624         LDKBolt12ParseError e_conv;
22625         e_conv.inner = untag_ptr(e);
22626         e_conv.is_owned = ptr_is_owned(e);
22627         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22628         e_conv = Bolt12ParseError_clone(&e_conv);
22629         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22630         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22631         return tag_ptr(ret_conv, true);
22632 }
22633
22634 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
22635         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22636         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22637         return ret_conv;
22638 }
22639
22640 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
22641         if (!ptr_is_owned(_res)) return;
22642         void* _res_ptr = untag_ptr(_res);
22643         CHECK_ACCESS(_res_ptr);
22644         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22645         FREE(untag_ptr(_res));
22646         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22647 }
22648
22649 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22650         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22651         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22652         return tag_ptr(ret_conv, true);
22653 }
22654 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
22655         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22656         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22657         return ret_conv;
22658 }
22659
22660 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
22661         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22662         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22663         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22664         return tag_ptr(ret_conv, true);
22665 }
22666
22667 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
22668         LDKNodeId o_conv;
22669         o_conv.inner = untag_ptr(o);
22670         o_conv.is_owned = ptr_is_owned(o);
22671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22672         o_conv = NodeId_clone(&o_conv);
22673         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22674         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22675         return tag_ptr(ret_conv, true);
22676 }
22677
22678 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
22679         void* e_ptr = untag_ptr(e);
22680         CHECK_ACCESS(e_ptr);
22681         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22682         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22683         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22684         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
22685         return tag_ptr(ret_conv, true);
22686 }
22687
22688 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
22689         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
22690         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
22691         return ret_conv;
22692 }
22693
22694 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
22695         if (!ptr_is_owned(_res)) return;
22696         void* _res_ptr = untag_ptr(_res);
22697         CHECK_ACCESS(_res_ptr);
22698         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
22699         FREE(untag_ptr(_res));
22700         CResult_NodeIdDecodeErrorZ_free(_res_conv);
22701 }
22702
22703 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
22704         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22705         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
22706         return tag_ptr(ret_conv, true);
22707 }
22708 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
22709         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
22710         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
22711         return ret_conv;
22712 }
22713
22714 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
22715         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
22716         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22717         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
22718         return tag_ptr(ret_conv, true);
22719 }
22720
22721 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
22722         LDKPublicKey o_ref;
22723         CHECK(o->arr_len == 33);
22724         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
22725         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22726         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
22727         return tag_ptr(ret_conv, true);
22728 }
22729
22730 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_err"))) TS_CResult_PublicKeySecp256k1ErrorZ_err(uint32_t e) {
22731         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22732         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22733         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
22734         return tag_ptr(ret_conv, true);
22735 }
22736
22737 jboolean  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PublicKeySecp256k1ErrorZ_is_ok(uint64_t o) {
22738         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
22739         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
22740         return ret_conv;
22741 }
22742
22743 void  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_free"))) TS_CResult_PublicKeySecp256k1ErrorZ_free(uint64_t _res) {
22744         if (!ptr_is_owned(_res)) return;
22745         void* _res_ptr = untag_ptr(_res);
22746         CHECK_ACCESS(_res_ptr);
22747         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
22748         FREE(untag_ptr(_res));
22749         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
22750 }
22751
22752 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
22753         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22754         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
22755         return tag_ptr(ret_conv, true);
22756 }
22757 int64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
22758         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
22759         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
22760         return ret_conv;
22761 }
22762
22763 uint64_t  __attribute__((export_name("TS_CResult_PublicKeySecp256k1ErrorZ_clone"))) TS_CResult_PublicKeySecp256k1ErrorZ_clone(uint64_t orig) {
22764         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
22765         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22766         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
22767         return tag_ptr(ret_conv, true);
22768 }
22769
22770 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
22771         void* o_ptr = untag_ptr(o);
22772         CHECK_ACCESS(o_ptr);
22773         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
22774         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
22775         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22776         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
22777         uint64_t ret_ref = tag_ptr(ret_copy, true);
22778         return ret_ref;
22779 }
22780
22781 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
22782         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22783         *ret_copy = COption_NetworkUpdateZ_none();
22784         uint64_t ret_ref = tag_ptr(ret_copy, true);
22785         return ret_ref;
22786 }
22787
22788 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
22789         if (!ptr_is_owned(_res)) return;
22790         void* _res_ptr = untag_ptr(_res);
22791         CHECK_ACCESS(_res_ptr);
22792         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
22793         FREE(untag_ptr(_res));
22794         COption_NetworkUpdateZ_free(_res_conv);
22795 }
22796
22797 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
22798         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22799         *ret_copy = COption_NetworkUpdateZ_clone(arg);
22800         uint64_t ret_ref = tag_ptr(ret_copy, true);
22801         return ret_ref;
22802 }
22803 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
22804         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
22805         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
22806         return ret_conv;
22807 }
22808
22809 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
22810         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
22811         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22812         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
22813         uint64_t ret_ref = tag_ptr(ret_copy, true);
22814         return ret_ref;
22815 }
22816
22817 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
22818         void* o_ptr = untag_ptr(o);
22819         CHECK_ACCESS(o_ptr);
22820         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
22821         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
22822         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22823         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
22824         return tag_ptr(ret_conv, true);
22825 }
22826
22827 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
22828         void* e_ptr = untag_ptr(e);
22829         CHECK_ACCESS(e_ptr);
22830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22832         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22833         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
22834         return tag_ptr(ret_conv, true);
22835 }
22836
22837 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
22838         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
22839         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
22840         return ret_conv;
22841 }
22842
22843 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
22844         if (!ptr_is_owned(_res)) return;
22845         void* _res_ptr = untag_ptr(_res);
22846         CHECK_ACCESS(_res_ptr);
22847         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
22848         FREE(untag_ptr(_res));
22849         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
22850 }
22851
22852 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
22853         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22854         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
22855         return tag_ptr(ret_conv, true);
22856 }
22857 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
22858         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
22859         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
22860         return ret_conv;
22861 }
22862
22863 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
22864         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
22865         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22866         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
22867         return tag_ptr(ret_conv, true);
22868 }
22869
22870 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
22871         void* o_ptr = untag_ptr(o);
22872         CHECK_ACCESS(o_ptr);
22873         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
22874         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
22875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22876                 LDKUtxoLookup_JCalls_cloned(&o_conv);
22877         }
22878         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
22879         *ret_copy = COption_UtxoLookupZ_some(o_conv);
22880         uint64_t ret_ref = tag_ptr(ret_copy, true);
22881         return ret_ref;
22882 }
22883
22884 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
22885         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
22886         *ret_copy = COption_UtxoLookupZ_none();
22887         uint64_t ret_ref = tag_ptr(ret_copy, true);
22888         return ret_ref;
22889 }
22890
22891 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
22892         if (!ptr_is_owned(_res)) return;
22893         void* _res_ptr = untag_ptr(_res);
22894         CHECK_ACCESS(_res_ptr);
22895         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
22896         FREE(untag_ptr(_res));
22897         COption_UtxoLookupZ_free(_res_conv);
22898 }
22899
22900 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
22901         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22902         *ret_conv = CResult_NoneLightningErrorZ_ok();
22903         return tag_ptr(ret_conv, true);
22904 }
22905
22906 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
22907         LDKLightningError e_conv;
22908         e_conv.inner = untag_ptr(e);
22909         e_conv.is_owned = ptr_is_owned(e);
22910         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22911         e_conv = LightningError_clone(&e_conv);
22912         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22913         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
22914         return tag_ptr(ret_conv, true);
22915 }
22916
22917 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
22918         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
22919         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
22920         return ret_conv;
22921 }
22922
22923 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
22924         if (!ptr_is_owned(_res)) return;
22925         void* _res_ptr = untag_ptr(_res);
22926         CHECK_ACCESS(_res_ptr);
22927         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
22928         FREE(untag_ptr(_res));
22929         CResult_NoneLightningErrorZ_free(_res_conv);
22930 }
22931
22932 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
22933         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22934         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
22935         return tag_ptr(ret_conv, true);
22936 }
22937 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
22938         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
22939         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
22940         return ret_conv;
22941 }
22942
22943 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
22944         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
22945         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22946         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
22947         return tag_ptr(ret_conv, true);
22948 }
22949
22950 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
22951         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22952         *ret_conv = CResult_boolLightningErrorZ_ok(o);
22953         return tag_ptr(ret_conv, true);
22954 }
22955
22956 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
22957         LDKLightningError e_conv;
22958         e_conv.inner = untag_ptr(e);
22959         e_conv.is_owned = ptr_is_owned(e);
22960         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22961         e_conv = LightningError_clone(&e_conv);
22962         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22963         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
22964         return tag_ptr(ret_conv, true);
22965 }
22966
22967 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
22968         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
22969         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
22970         return ret_conv;
22971 }
22972
22973 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
22974         if (!ptr_is_owned(_res)) return;
22975         void* _res_ptr = untag_ptr(_res);
22976         CHECK_ACCESS(_res_ptr);
22977         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
22978         FREE(untag_ptr(_res));
22979         CResult_boolLightningErrorZ_free(_res_conv);
22980 }
22981
22982 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
22983         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22984         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
22985         return tag_ptr(ret_conv, true);
22986 }
22987 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
22988         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
22989         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
22990         return ret_conv;
22991 }
22992
22993 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
22994         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
22995         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
22996         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
22997         return tag_ptr(ret_conv, true);
22998 }
22999
23000 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
23001         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23002         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
23003         return tag_ptr(ret_conv, true);
23004 }
23005 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
23006         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
23007         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
23008         return ret_conv;
23009 }
23010
23011 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
23012         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
23013         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23014         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
23015         return tag_ptr(ret_conv, true);
23016 }
23017
23018 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
23019         LDKChannelAnnouncement a_conv;
23020         a_conv.inner = untag_ptr(a);
23021         a_conv.is_owned = ptr_is_owned(a);
23022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23023         a_conv = ChannelAnnouncement_clone(&a_conv);
23024         LDKChannelUpdate b_conv;
23025         b_conv.inner = untag_ptr(b);
23026         b_conv.is_owned = ptr_is_owned(b);
23027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23028         b_conv = ChannelUpdate_clone(&b_conv);
23029         LDKChannelUpdate c_conv;
23030         c_conv.inner = untag_ptr(c);
23031         c_conv.is_owned = ptr_is_owned(c);
23032         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
23033         c_conv = ChannelUpdate_clone(&c_conv);
23034         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23035         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
23036         return tag_ptr(ret_conv, true);
23037 }
23038
23039 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
23040         if (!ptr_is_owned(_res)) return;
23041         void* _res_ptr = untag_ptr(_res);
23042         CHECK_ACCESS(_res_ptr);
23043         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
23044         FREE(untag_ptr(_res));
23045         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
23046 }
23047
23048 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
23049         void* o_ptr = untag_ptr(o);
23050         CHECK_ACCESS(o_ptr);
23051         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
23052         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
23053         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23054         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
23055         uint64_t ret_ref = tag_ptr(ret_copy, true);
23056         return ret_ref;
23057 }
23058
23059 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
23060         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23061         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
23062         uint64_t ret_ref = tag_ptr(ret_copy, true);
23063         return ret_ref;
23064 }
23065
23066 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
23067         if (!ptr_is_owned(_res)) return;
23068         void* _res_ptr = untag_ptr(_res);
23069         CHECK_ACCESS(_res_ptr);
23070         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
23071         FREE(untag_ptr(_res));
23072         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
23073 }
23074
23075 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
23076         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23077         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
23078         uint64_t ret_ref = tag_ptr(ret_copy, true);
23079         return ret_ref;
23080 }
23081 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
23082         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
23083         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
23084         return ret_conv;
23085 }
23086
23087 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
23088         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
23089         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23090         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
23091         uint64_t ret_ref = tag_ptr(ret_copy, true);
23092         return ret_ref;
23093 }
23094
23095 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
23096         LDKCVec_MessageSendEventZ _res_constr;
23097         _res_constr.datalen = _res->arr_len;
23098         if (_res_constr.datalen > 0)
23099                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
23100         else
23101                 _res_constr.data = NULL;
23102         uint64_t* _res_vals = _res->elems;
23103         for (size_t s = 0; s < _res_constr.datalen; s++) {
23104                 uint64_t _res_conv_18 = _res_vals[s];
23105                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
23106                 CHECK_ACCESS(_res_conv_18_ptr);
23107                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
23108                 FREE(untag_ptr(_res_conv_18));
23109                 _res_constr.data[s] = _res_conv_18_conv;
23110         }
23111         FREE(_res);
23112         CVec_MessageSendEventZ_free(_res_constr);
23113 }
23114
23115 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
23116         LDKChannelUpdateInfo o_conv;
23117         o_conv.inner = untag_ptr(o);
23118         o_conv.is_owned = ptr_is_owned(o);
23119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23120         o_conv = ChannelUpdateInfo_clone(&o_conv);
23121         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23122         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
23123         return tag_ptr(ret_conv, true);
23124 }
23125
23126 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
23127         void* e_ptr = untag_ptr(e);
23128         CHECK_ACCESS(e_ptr);
23129         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23130         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23131         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23132         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
23133         return tag_ptr(ret_conv, true);
23134 }
23135
23136 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
23137         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
23138         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
23139         return ret_conv;
23140 }
23141
23142 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
23143         if (!ptr_is_owned(_res)) return;
23144         void* _res_ptr = untag_ptr(_res);
23145         CHECK_ACCESS(_res_ptr);
23146         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
23147         FREE(untag_ptr(_res));
23148         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
23149 }
23150
23151 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
23152         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23153         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
23154         return tag_ptr(ret_conv, true);
23155 }
23156 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23157         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
23158         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
23159         return ret_conv;
23160 }
23161
23162 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
23163         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
23164         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23165         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
23166         return tag_ptr(ret_conv, true);
23167 }
23168
23169 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
23170         LDKChannelInfo o_conv;
23171         o_conv.inner = untag_ptr(o);
23172         o_conv.is_owned = ptr_is_owned(o);
23173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23174         o_conv = ChannelInfo_clone(&o_conv);
23175         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23176         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
23177         return tag_ptr(ret_conv, true);
23178 }
23179
23180 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
23181         void* e_ptr = untag_ptr(e);
23182         CHECK_ACCESS(e_ptr);
23183         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23184         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23185         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23186         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23187         return tag_ptr(ret_conv, true);
23188 }
23189
23190 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
23191         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23192         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23193         return ret_conv;
23194 }
23195
23196 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
23197         if (!ptr_is_owned(_res)) return;
23198         void* _res_ptr = untag_ptr(_res);
23199         CHECK_ACCESS(_res_ptr);
23200         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23201         FREE(untag_ptr(_res));
23202         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23203 }
23204
23205 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23206         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23207         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23208         return tag_ptr(ret_conv, true);
23209 }
23210 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23211         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23212         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23213         return ret_conv;
23214 }
23215
23216 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
23217         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23218         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23219         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23220         return tag_ptr(ret_conv, true);
23221 }
23222
23223 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
23224         LDKRoutingFees o_conv;
23225         o_conv.inner = untag_ptr(o);
23226         o_conv.is_owned = ptr_is_owned(o);
23227         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23228         o_conv = RoutingFees_clone(&o_conv);
23229         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23230         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23231         return tag_ptr(ret_conv, true);
23232 }
23233
23234 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
23235         void* e_ptr = untag_ptr(e);
23236         CHECK_ACCESS(e_ptr);
23237         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23238         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23239         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23240         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23241         return tag_ptr(ret_conv, true);
23242 }
23243
23244 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
23245         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23246         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23247         return ret_conv;
23248 }
23249
23250 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
23251         if (!ptr_is_owned(_res)) return;
23252         void* _res_ptr = untag_ptr(_res);
23253         CHECK_ACCESS(_res_ptr);
23254         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23255         FREE(untag_ptr(_res));
23256         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23257 }
23258
23259 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23260         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23261         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23262         return tag_ptr(ret_conv, true);
23263 }
23264 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
23265         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23266         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23267         return ret_conv;
23268 }
23269
23270 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
23271         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23272         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23273         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23274         return tag_ptr(ret_conv, true);
23275 }
23276
23277 void  __attribute__((export_name("TS_CVec_SocketAddressZ_free"))) TS_CVec_SocketAddressZ_free(uint64_tArray _res) {
23278         LDKCVec_SocketAddressZ _res_constr;
23279         _res_constr.datalen = _res->arr_len;
23280         if (_res_constr.datalen > 0)
23281                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23282         else
23283                 _res_constr.data = NULL;
23284         uint64_t* _res_vals = _res->elems;
23285         for (size_t p = 0; p < _res_constr.datalen; p++) {
23286                 uint64_t _res_conv_15 = _res_vals[p];
23287                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
23288                 CHECK_ACCESS(_res_conv_15_ptr);
23289                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
23290                 FREE(untag_ptr(_res_conv_15));
23291                 _res_constr.data[p] = _res_conv_15_conv;
23292         }
23293         FREE(_res);
23294         CVec_SocketAddressZ_free(_res_constr);
23295 }
23296
23297 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
23298         LDKNodeAnnouncementInfo o_conv;
23299         o_conv.inner = untag_ptr(o);
23300         o_conv.is_owned = ptr_is_owned(o);
23301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23302         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23303         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23304         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23305         return tag_ptr(ret_conv, true);
23306 }
23307
23308 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
23309         void* e_ptr = untag_ptr(e);
23310         CHECK_ACCESS(e_ptr);
23311         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23312         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23313         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23314         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23315         return tag_ptr(ret_conv, true);
23316 }
23317
23318 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
23319         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23320         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23321         return ret_conv;
23322 }
23323
23324 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
23325         if (!ptr_is_owned(_res)) return;
23326         void* _res_ptr = untag_ptr(_res);
23327         CHECK_ACCESS(_res_ptr);
23328         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23329         FREE(untag_ptr(_res));
23330         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23331 }
23332
23333 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23334         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23335         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23336         return tag_ptr(ret_conv, true);
23337 }
23338 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23339         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23340         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23341         return ret_conv;
23342 }
23343
23344 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
23345         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23346         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23347         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23348         return tag_ptr(ret_conv, true);
23349 }
23350
23351 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
23352         LDKNodeAlias o_conv;
23353         o_conv.inner = untag_ptr(o);
23354         o_conv.is_owned = ptr_is_owned(o);
23355         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23356         o_conv = NodeAlias_clone(&o_conv);
23357         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23358         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23359         return tag_ptr(ret_conv, true);
23360 }
23361
23362 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
23363         void* e_ptr = untag_ptr(e);
23364         CHECK_ACCESS(e_ptr);
23365         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23366         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23367         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23368         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23369         return tag_ptr(ret_conv, true);
23370 }
23371
23372 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
23373         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23374         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23375         return ret_conv;
23376 }
23377
23378 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
23379         if (!ptr_is_owned(_res)) return;
23380         void* _res_ptr = untag_ptr(_res);
23381         CHECK_ACCESS(_res_ptr);
23382         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23383         FREE(untag_ptr(_res));
23384         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23385 }
23386
23387 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23388         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23389         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23390         return tag_ptr(ret_conv, true);
23391 }
23392 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
23393         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23394         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23395         return ret_conv;
23396 }
23397
23398 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
23399         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23400         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23401         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23402         return tag_ptr(ret_conv, true);
23403 }
23404
23405 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
23406         LDKNodeInfo o_conv;
23407         o_conv.inner = untag_ptr(o);
23408         o_conv.is_owned = ptr_is_owned(o);
23409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23410         o_conv = NodeInfo_clone(&o_conv);
23411         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23412         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23413         return tag_ptr(ret_conv, true);
23414 }
23415
23416 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
23417         void* e_ptr = untag_ptr(e);
23418         CHECK_ACCESS(e_ptr);
23419         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23420         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23421         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23422         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23423         return tag_ptr(ret_conv, true);
23424 }
23425
23426 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
23427         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23428         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23429         return ret_conv;
23430 }
23431
23432 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
23433         if (!ptr_is_owned(_res)) return;
23434         void* _res_ptr = untag_ptr(_res);
23435         CHECK_ACCESS(_res_ptr);
23436         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23437         FREE(untag_ptr(_res));
23438         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23439 }
23440
23441 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23442         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23443         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23444         return tag_ptr(ret_conv, true);
23445 }
23446 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
23447         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23448         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23449         return ret_conv;
23450 }
23451
23452 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
23453         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23454         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23455         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23456         return tag_ptr(ret_conv, true);
23457 }
23458
23459 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
23460         LDKNetworkGraph o_conv;
23461         o_conv.inner = untag_ptr(o);
23462         o_conv.is_owned = ptr_is_owned(o);
23463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23464         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23465         
23466         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23467         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23468         return tag_ptr(ret_conv, true);
23469 }
23470
23471 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
23472         void* e_ptr = untag_ptr(e);
23473         CHECK_ACCESS(e_ptr);
23474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23476         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23477         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23478         return tag_ptr(ret_conv, true);
23479 }
23480
23481 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
23482         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23483         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23484         return ret_conv;
23485 }
23486
23487 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
23488         if (!ptr_is_owned(_res)) return;
23489         void* _res_ptr = untag_ptr(_res);
23490         CHECK_ACCESS(_res_ptr);
23491         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23492         FREE(untag_ptr(_res));
23493         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23494 }
23495
23496 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_some"))) TS_COption_CVec_SocketAddressZZ_some(uint64_tArray o) {
23497         LDKCVec_SocketAddressZ o_constr;
23498         o_constr.datalen = o->arr_len;
23499         if (o_constr.datalen > 0)
23500                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23501         else
23502                 o_constr.data = NULL;
23503         uint64_t* o_vals = o->elems;
23504         for (size_t p = 0; p < o_constr.datalen; p++) {
23505                 uint64_t o_conv_15 = o_vals[p];
23506                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
23507                 CHECK_ACCESS(o_conv_15_ptr);
23508                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
23509                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
23510                 o_constr.data[p] = o_conv_15_conv;
23511         }
23512         FREE(o);
23513         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23514         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
23515         uint64_t ret_ref = tag_ptr(ret_copy, true);
23516         return ret_ref;
23517 }
23518
23519 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_none"))) TS_COption_CVec_SocketAddressZZ_none() {
23520         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23521         *ret_copy = COption_CVec_SocketAddressZZ_none();
23522         uint64_t ret_ref = tag_ptr(ret_copy, true);
23523         return ret_ref;
23524 }
23525
23526 void  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_free"))) TS_COption_CVec_SocketAddressZZ_free(uint64_t _res) {
23527         if (!ptr_is_owned(_res)) return;
23528         void* _res_ptr = untag_ptr(_res);
23529         CHECK_ACCESS(_res_ptr);
23530         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
23531         FREE(untag_ptr(_res));
23532         COption_CVec_SocketAddressZZ_free(_res_conv);
23533 }
23534
23535 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
23536         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23537         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
23538         uint64_t ret_ref = tag_ptr(ret_copy, true);
23539         return ret_ref;
23540 }
23541 int64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone_ptr"))) TS_COption_CVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
23542         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
23543         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
23544         return ret_conv;
23545 }
23546
23547 uint64_t  __attribute__((export_name("TS_COption_CVec_SocketAddressZZ_clone"))) TS_COption_CVec_SocketAddressZZ_clone(uint64_t orig) {
23548         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
23549         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23550         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
23551         uint64_t ret_ref = tag_ptr(ret_copy, true);
23552         return ret_ref;
23553 }
23554
23555 uint64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_ok"))) TS_CResult_u64ShortChannelIdErrorZ_ok(int64_t o) {
23556         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23557         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
23558         return tag_ptr(ret_conv, true);
23559 }
23560
23561 uint64_t  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_err"))) TS_CResult_u64ShortChannelIdErrorZ_err(uint32_t e) {
23562         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_js(e);
23563         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23564         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
23565         return tag_ptr(ret_conv, true);
23566 }
23567
23568 jboolean  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_is_ok"))) TS_CResult_u64ShortChannelIdErrorZ_is_ok(uint64_t o) {
23569         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
23570         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
23571         return ret_conv;
23572 }
23573
23574 void  __attribute__((export_name("TS_CResult_u64ShortChannelIdErrorZ_free"))) TS_CResult_u64ShortChannelIdErrorZ_free(uint64_t _res) {
23575         if (!ptr_is_owned(_res)) return;
23576         void* _res_ptr = untag_ptr(_res);
23577         CHECK_ACCESS(_res_ptr);
23578         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
23579         FREE(untag_ptr(_res));
23580         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
23581 }
23582
23583 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(uint64_t o) {
23584         LDKPendingHTLCInfo o_conv;
23585         o_conv.inner = untag_ptr(o);
23586         o_conv.is_owned = ptr_is_owned(o);
23587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23588         o_conv = PendingHTLCInfo_clone(&o_conv);
23589         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23590         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
23591         return tag_ptr(ret_conv, true);
23592 }
23593
23594 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_err(uint64_t e) {
23595         LDKInboundHTLCErr e_conv;
23596         e_conv.inner = untag_ptr(e);
23597         e_conv.is_owned = ptr_is_owned(e);
23598         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23599         e_conv = InboundHTLCErr_clone(&e_conv);
23600         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23601         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
23602         return tag_ptr(ret_conv, true);
23603 }
23604
23605 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(uint64_t o) {
23606         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
23607         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
23608         return ret_conv;
23609 }
23610
23611 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_free(uint64_t _res) {
23612         if (!ptr_is_owned(_res)) return;
23613         void* _res_ptr = untag_ptr(_res);
23614         CHECK_ACCESS(_res_ptr);
23615         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
23616         FREE(untag_ptr(_res));
23617         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
23618 }
23619
23620 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
23621         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23622         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
23623         return tag_ptr(ret_conv, true);
23624 }
23625 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(uint64_t arg) {
23626         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
23627         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
23628         return ret_conv;
23629 }
23630
23631 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone"))) TS_CResult_PendingHTLCInfoInboundHTLCErrZ_clone(uint64_t orig) {
23632         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
23633         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23634         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
23635         return tag_ptr(ret_conv, true);
23636 }
23637
23638 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
23639         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23640         _res_constr.datalen = _res->arr_len;
23641         if (_res_constr.datalen > 0)
23642                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23643         else
23644                 _res_constr.data = NULL;
23645         uint64_t* _res_vals = _res->elems;
23646         for (size_t y = 0; y < _res_constr.datalen; y++) {
23647                 uint64_t _res_conv_24 = _res_vals[y];
23648                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23649                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23650                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23651                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23652                 _res_constr.data[y] = _res_conv_24_conv;
23653         }
23654         FREE(_res);
23655         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23656 }
23657
23658 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
23659         LDKCVec_HTLCDescriptorZ _res_constr;
23660         _res_constr.datalen = _res->arr_len;
23661         if (_res_constr.datalen > 0)
23662                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23663         else
23664                 _res_constr.data = NULL;
23665         uint64_t* _res_vals = _res->elems;
23666         for (size_t q = 0; q < _res_constr.datalen; q++) {
23667                 uint64_t _res_conv_16 = _res_vals[q];
23668                 LDKHTLCDescriptor _res_conv_16_conv;
23669                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23670                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23671                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23672                 _res_constr.data[q] = _res_conv_16_conv;
23673         }
23674         FREE(_res);
23675         CVec_HTLCDescriptorZ_free(_res_constr);
23676 }
23677
23678 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
23679         LDKCVec_UtxoZ _res_constr;
23680         _res_constr.datalen = _res->arr_len;
23681         if (_res_constr.datalen > 0)
23682                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23683         else
23684                 _res_constr.data = NULL;
23685         uint64_t* _res_vals = _res->elems;
23686         for (size_t g = 0; g < _res_constr.datalen; g++) {
23687                 uint64_t _res_conv_6 = _res_vals[g];
23688                 LDKUtxo _res_conv_6_conv;
23689                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23690                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23691                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23692                 _res_constr.data[g] = _res_conv_6_conv;
23693         }
23694         FREE(_res);
23695         CVec_UtxoZ_free(_res_constr);
23696 }
23697
23698 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
23699         void* o_ptr = untag_ptr(o);
23700         CHECK_ACCESS(o_ptr);
23701         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23702         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23703         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23704         *ret_copy = COption_TxOutZ_some(o_conv);
23705         uint64_t ret_ref = tag_ptr(ret_copy, true);
23706         return ret_ref;
23707 }
23708
23709 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
23710         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23711         *ret_copy = COption_TxOutZ_none();
23712         uint64_t ret_ref = tag_ptr(ret_copy, true);
23713         return ret_ref;
23714 }
23715
23716 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
23717         if (!ptr_is_owned(_res)) return;
23718         void* _res_ptr = untag_ptr(_res);
23719         CHECK_ACCESS(_res_ptr);
23720         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
23721         FREE(untag_ptr(_res));
23722         COption_TxOutZ_free(_res_conv);
23723 }
23724
23725 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
23726         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23727         *ret_copy = COption_TxOutZ_clone(arg);
23728         uint64_t ret_ref = tag_ptr(ret_copy, true);
23729         return ret_ref;
23730 }
23731 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
23732         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
23733         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
23734         return ret_conv;
23735 }
23736
23737 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
23738         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
23739         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23740         *ret_copy = COption_TxOutZ_clone(orig_conv);
23741         uint64_t ret_ref = tag_ptr(ret_copy, true);
23742         return ret_ref;
23743 }
23744
23745 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
23746         LDKCVec_InputZ _res_constr;
23747         _res_constr.datalen = _res->arr_len;
23748         if (_res_constr.datalen > 0)
23749                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23750         else
23751                 _res_constr.data = NULL;
23752         uint64_t* _res_vals = _res->elems;
23753         for (size_t h = 0; h < _res_constr.datalen; h++) {
23754                 uint64_t _res_conv_7 = _res_vals[h];
23755                 LDKInput _res_conv_7_conv;
23756                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
23757                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
23758                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
23759                 _res_constr.data[h] = _res_conv_7_conv;
23760         }
23761         FREE(_res);
23762         CVec_InputZ_free(_res_constr);
23763 }
23764
23765 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
23766         LDKCoinSelection o_conv;
23767         o_conv.inner = untag_ptr(o);
23768         o_conv.is_owned = ptr_is_owned(o);
23769         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23770         o_conv = CoinSelection_clone(&o_conv);
23771         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23772         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
23773         return tag_ptr(ret_conv, true);
23774 }
23775
23776 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
23777         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23778         *ret_conv = CResult_CoinSelectionNoneZ_err();
23779         return tag_ptr(ret_conv, true);
23780 }
23781
23782 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
23783         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
23784         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
23785         return ret_conv;
23786 }
23787
23788 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
23789         if (!ptr_is_owned(_res)) return;
23790         void* _res_ptr = untag_ptr(_res);
23791         CHECK_ACCESS(_res_ptr);
23792         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
23793         FREE(untag_ptr(_res));
23794         CResult_CoinSelectionNoneZ_free(_res_conv);
23795 }
23796
23797 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
23798         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23799         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
23800         return tag_ptr(ret_conv, true);
23801 }
23802 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
23803         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
23804         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
23805         return ret_conv;
23806 }
23807
23808 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
23809         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
23810         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23811         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
23812         return tag_ptr(ret_conv, true);
23813 }
23814
23815 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
23816         LDKCVec_UtxoZ o_constr;
23817         o_constr.datalen = o->arr_len;
23818         if (o_constr.datalen > 0)
23819                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23820         else
23821                 o_constr.data = NULL;
23822         uint64_t* o_vals = o->elems;
23823         for (size_t g = 0; g < o_constr.datalen; g++) {
23824                 uint64_t o_conv_6 = o_vals[g];
23825                 LDKUtxo o_conv_6_conv;
23826                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
23827                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
23828                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
23829                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
23830                 o_constr.data[g] = o_conv_6_conv;
23831         }
23832         FREE(o);
23833         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23834         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
23835         return tag_ptr(ret_conv, true);
23836 }
23837
23838 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
23839         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23840         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
23841         return tag_ptr(ret_conv, true);
23842 }
23843
23844 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
23845         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
23846         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
23847         return ret_conv;
23848 }
23849
23850 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
23851         if (!ptr_is_owned(_res)) return;
23852         void* _res_ptr = untag_ptr(_res);
23853         CHECK_ACCESS(_res_ptr);
23854         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
23855         FREE(untag_ptr(_res));
23856         CResult_CVec_UtxoZNoneZ_free(_res_conv);
23857 }
23858
23859 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
23860         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23861         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
23862         return tag_ptr(ret_conv, true);
23863 }
23864 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
23865         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
23866         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
23867         return ret_conv;
23868 }
23869
23870 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
23871         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
23872         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23873         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
23874         return tag_ptr(ret_conv, true);
23875 }
23876
23877 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_some"))) TS_COption_PaymentContextZ_some(uint64_t o) {
23878         void* o_ptr = untag_ptr(o);
23879         CHECK_ACCESS(o_ptr);
23880         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
23881         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
23882         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23883         *ret_copy = COption_PaymentContextZ_some(o_conv);
23884         uint64_t ret_ref = tag_ptr(ret_copy, true);
23885         return ret_ref;
23886 }
23887
23888 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_none"))) TS_COption_PaymentContextZ_none() {
23889         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23890         *ret_copy = COption_PaymentContextZ_none();
23891         uint64_t ret_ref = tag_ptr(ret_copy, true);
23892         return ret_ref;
23893 }
23894
23895 void  __attribute__((export_name("TS_COption_PaymentContextZ_free"))) TS_COption_PaymentContextZ_free(uint64_t _res) {
23896         if (!ptr_is_owned(_res)) return;
23897         void* _res_ptr = untag_ptr(_res);
23898         CHECK_ACCESS(_res_ptr);
23899         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
23900         FREE(untag_ptr(_res));
23901         COption_PaymentContextZ_free(_res_conv);
23902 }
23903
23904 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
23905         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23906         *ret_copy = COption_PaymentContextZ_clone(arg);
23907         uint64_t ret_ref = tag_ptr(ret_copy, true);
23908         return ret_ref;
23909 }
23910 int64_t  __attribute__((export_name("TS_COption_PaymentContextZ_clone_ptr"))) TS_COption_PaymentContextZ_clone_ptr(uint64_t arg) {
23911         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
23912         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
23913         return ret_conv;
23914 }
23915
23916 uint64_t  __attribute__((export_name("TS_COption_PaymentContextZ_clone"))) TS_COption_PaymentContextZ_clone(uint64_t orig) {
23917         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
23918         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
23919         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
23920         uint64_t ret_ref = tag_ptr(ret_copy, true);
23921         return ret_ref;
23922 }
23923
23924 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
23925         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23926         *ret_conv = C2Tuple_u64u16Z_clone(arg);
23927         return tag_ptr(ret_conv, true);
23928 }
23929 int64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone_ptr"))) TS_C2Tuple_u64u16Z_clone_ptr(uint64_t arg) {
23930         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
23931         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
23932         return ret_conv;
23933 }
23934
23935 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_clone"))) TS_C2Tuple_u64u16Z_clone(uint64_t orig) {
23936         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
23937         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23938         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
23939         return tag_ptr(ret_conv, true);
23940 }
23941
23942 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u16Z_new"))) TS_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
23943         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
23944         *ret_conv = C2Tuple_u64u16Z_new(a, b);
23945         return tag_ptr(ret_conv, true);
23946 }
23947
23948 void  __attribute__((export_name("TS_C2Tuple_u64u16Z_free"))) TS_C2Tuple_u64u16Z_free(uint64_t _res) {
23949         if (!ptr_is_owned(_res)) return;
23950         void* _res_ptr = untag_ptr(_res);
23951         CHECK_ACCESS(_res_ptr);
23952         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
23953         FREE(untag_ptr(_res));
23954         C2Tuple_u64u16Z_free(_res_conv);
23955 }
23956
23957 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_some"))) TS_COption_C2Tuple_u64u16ZZ_some(uint64_t o) {
23958         void* o_ptr = untag_ptr(o);
23959         CHECK_ACCESS(o_ptr);
23960         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
23961         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
23962         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23963         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
23964         uint64_t ret_ref = tag_ptr(ret_copy, true);
23965         return ret_ref;
23966 }
23967
23968 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_none"))) TS_COption_C2Tuple_u64u16ZZ_none() {
23969         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23970         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
23971         uint64_t ret_ref = tag_ptr(ret_copy, true);
23972         return ret_ref;
23973 }
23974
23975 void  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_free"))) TS_COption_C2Tuple_u64u16ZZ_free(uint64_t _res) {
23976         if (!ptr_is_owned(_res)) return;
23977         void* _res_ptr = untag_ptr(_res);
23978         CHECK_ACCESS(_res_ptr);
23979         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
23980         FREE(untag_ptr(_res));
23981         COption_C2Tuple_u64u16ZZ_free(_res_conv);
23982 }
23983
23984 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
23985         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23986         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
23987         uint64_t ret_ref = tag_ptr(ret_copy, true);
23988         return ret_ref;
23989 }
23990 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u16ZZ_clone_ptr(uint64_t arg) {
23991         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
23992         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
23993         return ret_conv;
23994 }
23995
23996 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u16ZZ_clone"))) TS_COption_C2Tuple_u64u16ZZ_clone(uint64_t orig) {
23997         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
23998         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
23999         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
24000         uint64_t ret_ref = tag_ptr(ret_copy, true);
24001         return ret_ref;
24002 }
24003
24004 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_ok"))) TS_CResult_ChannelIdAPIErrorZ_ok(uint64_t o) {
24005         LDKChannelId o_conv;
24006         o_conv.inner = untag_ptr(o);
24007         o_conv.is_owned = ptr_is_owned(o);
24008         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24009         o_conv = ChannelId_clone(&o_conv);
24010         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24011         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
24012         return tag_ptr(ret_conv, true);
24013 }
24014
24015 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_err"))) TS_CResult_ChannelIdAPIErrorZ_err(uint64_t e) {
24016         void* e_ptr = untag_ptr(e);
24017         CHECK_ACCESS(e_ptr);
24018         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24019         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24020         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24021         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
24022         return tag_ptr(ret_conv, true);
24023 }
24024
24025 jboolean  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_is_ok"))) TS_CResult_ChannelIdAPIErrorZ_is_ok(uint64_t o) {
24026         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
24027         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
24028         return ret_conv;
24029 }
24030
24031 void  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_free"))) TS_CResult_ChannelIdAPIErrorZ_free(uint64_t _res) {
24032         if (!ptr_is_owned(_res)) return;
24033         void* _res_ptr = untag_ptr(_res);
24034         CHECK_ACCESS(_res_ptr);
24035         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
24036         FREE(untag_ptr(_res));
24037         CResult_ChannelIdAPIErrorZ_free(_res_conv);
24038 }
24039
24040 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
24041         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24042         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
24043         return tag_ptr(ret_conv, true);
24044 }
24045 int64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_clone_ptr"))) TS_CResult_ChannelIdAPIErrorZ_clone_ptr(uint64_t arg) {
24046         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
24047         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
24048         return ret_conv;
24049 }
24050
24051 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdAPIErrorZ_clone"))) TS_CResult_ChannelIdAPIErrorZ_clone(uint64_t orig) {
24052         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
24053         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24054         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
24055         return tag_ptr(ret_conv, true);
24056 }
24057
24058 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
24059         LDKCVec_RecentPaymentDetailsZ _res_constr;
24060         _res_constr.datalen = _res->arr_len;
24061         if (_res_constr.datalen > 0)
24062                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
24063         else
24064                 _res_constr.data = NULL;
24065         uint64_t* _res_vals = _res->elems;
24066         for (size_t w = 0; w < _res_constr.datalen; w++) {
24067                 uint64_t _res_conv_22 = _res_vals[w];
24068                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24069                 CHECK_ACCESS(_res_conv_22_ptr);
24070                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
24071                 FREE(untag_ptr(_res_conv_22));
24072                 _res_constr.data[w] = _res_conv_22_conv;
24073         }
24074         FREE(_res);
24075         CVec_RecentPaymentDetailsZ_free(_res_constr);
24076 }
24077
24078 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
24079         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24080         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
24081         return tag_ptr(ret_conv, true);
24082 }
24083
24084 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
24085         void* e_ptr = untag_ptr(e);
24086         CHECK_ACCESS(e_ptr);
24087         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24088         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24089         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24090         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
24091         return tag_ptr(ret_conv, true);
24092 }
24093
24094 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
24095         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
24096         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
24097         return ret_conv;
24098 }
24099
24100 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
24101         if (!ptr_is_owned(_res)) return;
24102         void* _res_ptr = untag_ptr(_res);
24103         CHECK_ACCESS(_res_ptr);
24104         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
24105         FREE(untag_ptr(_res));
24106         CResult_NonePaymentSendFailureZ_free(_res_conv);
24107 }
24108
24109 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
24110         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24111         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
24112         return tag_ptr(ret_conv, true);
24113 }
24114 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
24115         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
24116         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
24117         return ret_conv;
24118 }
24119
24120 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
24121         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
24122         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24123         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
24124         return tag_ptr(ret_conv, true);
24125 }
24126
24127 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
24128         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24129         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
24130         return tag_ptr(ret_conv, true);
24131 }
24132
24133 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
24134         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
24135         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24136         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24137         return tag_ptr(ret_conv, true);
24138 }
24139
24140 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
24141         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24142         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24143         return ret_conv;
24144 }
24145
24146 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
24147         if (!ptr_is_owned(_res)) return;
24148         void* _res_ptr = untag_ptr(_res);
24149         CHECK_ACCESS(_res_ptr);
24150         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24151         FREE(untag_ptr(_res));
24152         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24153 }
24154
24155 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24156         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24157         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24158         return tag_ptr(ret_conv, true);
24159 }
24160 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
24161         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24162         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24163         return ret_conv;
24164 }
24165
24166 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
24167         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24168         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24169         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24170         return tag_ptr(ret_conv, true);
24171 }
24172
24173 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
24174         LDKThirtyTwoBytes o_ref;
24175         CHECK(o->arr_len == 32);
24176         memcpy(o_ref.data, o->elems, 32); FREE(o);
24177         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24178         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
24179         return tag_ptr(ret_conv, true);
24180 }
24181
24182 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(uint64_t e) {
24183         void* e_ptr = untag_ptr(e);
24184         CHECK_ACCESS(e_ptr);
24185         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24186         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24187         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24188         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
24189         return tag_ptr(ret_conv, true);
24190 }
24191
24192 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(uint64_t o) {
24193         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
24194         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
24195         return ret_conv;
24196 }
24197
24198 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(uint64_t _res) {
24199         if (!ptr_is_owned(_res)) return;
24200         void* _res_ptr = untag_ptr(_res);
24201         CHECK_ACCESS(_res_ptr);
24202         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
24203         FREE(untag_ptr(_res));
24204         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
24205 }
24206
24207 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
24208         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24209         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
24210         return tag_ptr(ret_conv, true);
24211 }
24212 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(uint64_t arg) {
24213         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
24214         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
24215         return ret_conv;
24216 }
24217
24218 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(uint64_t orig) {
24219         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
24220         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24221         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
24222         return tag_ptr(ret_conv, true);
24223 }
24224
24225 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
24226         LDKThirtyTwoBytes o_ref;
24227         CHECK(o->arr_len == 32);
24228         memcpy(o_ref.data, o->elems, 32); FREE(o);
24229         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24230         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
24231         return tag_ptr(ret_conv, true);
24232 }
24233
24234 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(uint32_t e) {
24235         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
24236         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24237         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
24238         return tag_ptr(ret_conv, true);
24239 }
24240
24241 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(uint64_t o) {
24242         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
24243         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
24244         return ret_conv;
24245 }
24246
24247 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(uint64_t _res) {
24248         if (!ptr_is_owned(_res)) return;
24249         void* _res_ptr = untag_ptr(_res);
24250         CHECK_ACCESS(_res_ptr);
24251         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
24252         FREE(untag_ptr(_res));
24253         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
24254 }
24255
24256 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
24257         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24258         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
24259         return tag_ptr(ret_conv, true);
24260 }
24261 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(uint64_t arg) {
24262         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
24263         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
24264         return ret_conv;
24265 }
24266
24267 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone"))) TS_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(uint64_t orig) {
24268         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
24269         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24270         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
24271         return tag_ptr(ret_conv, true);
24272 }
24273
24274 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
24275         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24276         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
24277         return tag_ptr(ret_conv, true);
24278 }
24279 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(uint64_t arg) {
24280         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
24281         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
24282         return ret_conv;
24283 }
24284
24285 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(uint64_t orig) {
24286         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
24287         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24288         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
24289         return tag_ptr(ret_conv, true);
24290 }
24291
24292 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
24293         LDKThirtyTwoBytes a_ref;
24294         CHECK(a->arr_len == 32);
24295         memcpy(a_ref.data, a->elems, 32); FREE(a);
24296         LDKThirtyTwoBytes b_ref;
24297         CHECK(b->arr_len == 32);
24298         memcpy(b_ref.data, b->elems, 32); FREE(b);
24299         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24300         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
24301         return tag_ptr(ret_conv, true);
24302 }
24303
24304 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free"))) TS_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(uint64_t _res) {
24305         if (!ptr_is_owned(_res)) return;
24306         void* _res_ptr = untag_ptr(_res);
24307         CHECK_ACCESS(_res_ptr);
24308         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
24309         FREE(untag_ptr(_res));
24310         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
24311 }
24312
24313 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(uint64_t o) {
24314         void* o_ptr = untag_ptr(o);
24315         CHECK_ACCESS(o_ptr);
24316         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24317         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24318         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24319         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
24320         return tag_ptr(ret_conv, true);
24321 }
24322
24323 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(uint64_t e) {
24324         void* e_ptr = untag_ptr(e);
24325         CHECK_ACCESS(e_ptr);
24326         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24327         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24328         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24329         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
24330         return tag_ptr(ret_conv, true);
24331 }
24332
24333 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(uint64_t o) {
24334         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
24335         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
24336         return ret_conv;
24337 }
24338
24339 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(uint64_t _res) {
24340         if (!ptr_is_owned(_res)) return;
24341         void* _res_ptr = untag_ptr(_res);
24342         CHECK_ACCESS(_res_ptr);
24343         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
24344         FREE(untag_ptr(_res));
24345         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
24346 }
24347
24348 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
24349         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24350         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
24351         return tag_ptr(ret_conv, true);
24352 }
24353 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
24354         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
24355         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
24356         return ret_conv;
24357 }
24358
24359 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(uint64_t orig) {
24360         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
24361         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24362         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
24363         return tag_ptr(ret_conv, true);
24364 }
24365
24366 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(uint64_tArray _res) {
24367         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
24368         _res_constr.datalen = _res->arr_len;
24369         if (_res_constr.datalen > 0)
24370                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24371         else
24372                 _res_constr.data = NULL;
24373         uint64_t* _res_vals = _res->elems;
24374         for (size_t o = 0; o < _res_constr.datalen; o++) {
24375                 uint64_t _res_conv_40 = _res_vals[o];
24376                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24377                 CHECK_ACCESS(_res_conv_40_ptr);
24378                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
24379                 FREE(untag_ptr(_res_conv_40));
24380                 _res_constr.data[o] = _res_conv_40_conv;
24381         }
24382         FREE(_res);
24383         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
24384 }
24385
24386 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(uint64_tArray o) {
24387         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
24388         o_constr.datalen = o->arr_len;
24389         if (o_constr.datalen > 0)
24390                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24391         else
24392                 o_constr.data = NULL;
24393         uint64_t* o_vals = o->elems;
24394         for (size_t o = 0; o < o_constr.datalen; o++) {
24395                 uint64_t o_conv_40 = o_vals[o];
24396                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24397                 CHECK_ACCESS(o_conv_40_ptr);
24398                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
24399                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
24400                 o_constr.data[o] = o_conv_40_conv;
24401         }
24402         FREE(o);
24403         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24404         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
24405         return tag_ptr(ret_conv, true);
24406 }
24407
24408 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(uint64_t e) {
24409         void* e_ptr = untag_ptr(e);
24410         CHECK_ACCESS(e_ptr);
24411         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
24412         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
24413         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24414         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
24415         return tag_ptr(ret_conv, true);
24416 }
24417
24418 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(uint64_t o) {
24419         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
24420         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
24421         return ret_conv;
24422 }
24423
24424 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(uint64_t _res) {
24425         if (!ptr_is_owned(_res)) return;
24426         void* _res_ptr = untag_ptr(_res);
24427         CHECK_ACCESS(_res_ptr);
24428         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
24429         FREE(untag_ptr(_res));
24430         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
24431 }
24432
24433 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
24434         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24435         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
24436         return tag_ptr(ret_conv, true);
24437 }
24438 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(uint64_t arg) {
24439         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
24440         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
24441         return ret_conv;
24442 }
24443
24444 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(uint64_t orig) {
24445         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
24446         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24447         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
24448         return tag_ptr(ret_conv, true);
24449 }
24450
24451 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
24452         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24453         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
24454         return tag_ptr(ret_conv, true);
24455 }
24456 int64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_clone_ptr"))) TS_C2Tuple_ChannelIdPublicKeyZ_clone_ptr(uint64_t arg) {
24457         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
24458         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
24459         return ret_conv;
24460 }
24461
24462 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_clone"))) TS_C2Tuple_ChannelIdPublicKeyZ_clone(uint64_t orig) {
24463         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
24464         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24465         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
24466         return tag_ptr(ret_conv, true);
24467 }
24468
24469 uint64_t  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_new"))) TS_C2Tuple_ChannelIdPublicKeyZ_new(uint64_t a, int8_tArray b) {
24470         LDKChannelId a_conv;
24471         a_conv.inner = untag_ptr(a);
24472         a_conv.is_owned = ptr_is_owned(a);
24473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24474         a_conv = ChannelId_clone(&a_conv);
24475         LDKPublicKey b_ref;
24476         CHECK(b->arr_len == 33);
24477         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
24478         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24479         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
24480         return tag_ptr(ret_conv, true);
24481 }
24482
24483 void  __attribute__((export_name("TS_C2Tuple_ChannelIdPublicKeyZ_free"))) TS_C2Tuple_ChannelIdPublicKeyZ_free(uint64_t _res) {
24484         if (!ptr_is_owned(_res)) return;
24485         void* _res_ptr = untag_ptr(_res);
24486         CHECK_ACCESS(_res_ptr);
24487         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
24488         FREE(untag_ptr(_res));
24489         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
24490 }
24491
24492 void  __attribute__((export_name("TS_CVec_C2Tuple_ChannelIdPublicKeyZZ_free"))) TS_CVec_C2Tuple_ChannelIdPublicKeyZZ_free(uint64_tArray _res) {
24493         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
24494         _res_constr.datalen = _res->arr_len;
24495         if (_res_constr.datalen > 0)
24496                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
24497         else
24498                 _res_constr.data = NULL;
24499         uint64_t* _res_vals = _res->elems;
24500         for (size_t e = 0; e < _res_constr.datalen; e++) {
24501                 uint64_t _res_conv_30 = _res_vals[e];
24502                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
24503                 CHECK_ACCESS(_res_conv_30_ptr);
24504                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
24505                 FREE(untag_ptr(_res_conv_30));
24506                 _res_constr.data[e] = _res_conv_30_conv;
24507         }
24508         FREE(_res);
24509         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
24510 }
24511
24512 void  __attribute__((export_name("TS_CVec_ChannelIdZ_free"))) TS_CVec_ChannelIdZ_free(uint64_tArray _res) {
24513         LDKCVec_ChannelIdZ _res_constr;
24514         _res_constr.datalen = _res->arr_len;
24515         if (_res_constr.datalen > 0)
24516                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
24517         else
24518                 _res_constr.data = NULL;
24519         uint64_t* _res_vals = _res->elems;
24520         for (size_t l = 0; l < _res_constr.datalen; l++) {
24521                 uint64_t _res_conv_11 = _res_vals[l];
24522                 LDKChannelId _res_conv_11_conv;
24523                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24524                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24525                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24526                 _res_constr.data[l] = _res_conv_11_conv;
24527         }
24528         FREE(_res);
24529         CVec_ChannelIdZ_free(_res_constr);
24530 }
24531
24532 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
24533         LDKOfferWithDerivedMetadataBuilder o_conv;
24534         o_conv.inner = untag_ptr(o);
24535         o_conv.is_owned = ptr_is_owned(o);
24536         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24537         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
24538         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24539         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
24540         return tag_ptr(ret_conv, true);
24541 }
24542
24543 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(uint32_t e) {
24544         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
24545         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24546         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
24547         return tag_ptr(ret_conv, true);
24548 }
24549
24550 jboolean  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
24551         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
24552         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
24553         return ret_conv;
24554 }
24555
24556 void  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
24557         if (!ptr_is_owned(_res)) return;
24558         void* _res_ptr = untag_ptr(_res);
24559         CHECK_ACCESS(_res_ptr);
24560         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
24561         FREE(untag_ptr(_res));
24562         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
24563 }
24564
24565 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
24566         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24567         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
24568         return tag_ptr(ret_conv, true);
24569 }
24570 int64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
24571         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
24572         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
24573         return ret_conv;
24574 }
24575
24576 uint64_t  __attribute__((export_name("TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone"))) TS_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(uint64_t orig) {
24577         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
24578         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24579         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
24580         return tag_ptr(ret_conv, true);
24581 }
24582
24583 uint64_t  __attribute__((export_name("TS_COption_StrZ_some"))) TS_COption_StrZ_some(jstring o) {
24584         LDKStr o_conv = str_ref_to_owned_c(o);
24585         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24586         *ret_copy = COption_StrZ_some(o_conv);
24587         uint64_t ret_ref = tag_ptr(ret_copy, true);
24588         return ret_ref;
24589 }
24590
24591 uint64_t  __attribute__((export_name("TS_COption_StrZ_none"))) TS_COption_StrZ_none() {
24592         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24593         *ret_copy = COption_StrZ_none();
24594         uint64_t ret_ref = tag_ptr(ret_copy, true);
24595         return ret_ref;
24596 }
24597
24598 void  __attribute__((export_name("TS_COption_StrZ_free"))) TS_COption_StrZ_free(uint64_t _res) {
24599         if (!ptr_is_owned(_res)) return;
24600         void* _res_ptr = untag_ptr(_res);
24601         CHECK_ACCESS(_res_ptr);
24602         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
24603         FREE(untag_ptr(_res));
24604         COption_StrZ_free(_res_conv);
24605 }
24606
24607 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
24608         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24609         *ret_copy = COption_StrZ_clone(arg);
24610         uint64_t ret_ref = tag_ptr(ret_copy, true);
24611         return ret_ref;
24612 }
24613 int64_t  __attribute__((export_name("TS_COption_StrZ_clone_ptr"))) TS_COption_StrZ_clone_ptr(uint64_t arg) {
24614         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
24615         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
24616         return ret_conv;
24617 }
24618
24619 uint64_t  __attribute__((export_name("TS_COption_StrZ_clone"))) TS_COption_StrZ_clone(uint64_t orig) {
24620         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
24621         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24622         *ret_copy = COption_StrZ_clone(orig_conv);
24623         uint64_t ret_ref = tag_ptr(ret_copy, true);
24624         return ret_ref;
24625 }
24626
24627 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(uint64_t o) {
24628         void* o_ptr = untag_ptr(o);
24629         CHECK_ACCESS(o_ptr);
24630         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24631         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24632         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24633         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
24634         return tag_ptr(ret_conv, true);
24635 }
24636
24637 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
24638         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24639         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
24640         return tag_ptr(ret_conv, true);
24641 }
24642
24643 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(uint64_t o) {
24644         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
24645         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
24646         return ret_conv;
24647 }
24648
24649 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(uint64_t _res) {
24650         if (!ptr_is_owned(_res)) return;
24651         void* _res_ptr = untag_ptr(_res);
24652         CHECK_ACCESS(_res_ptr);
24653         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
24654         FREE(untag_ptr(_res));
24655         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
24656 }
24657
24658 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
24659         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24660         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
24661         return tag_ptr(ret_conv, true);
24662 }
24663 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(uint64_t arg) {
24664         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
24665         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
24666         return ret_conv;
24667 }
24668
24669 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(uint64_t orig) {
24670         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
24671         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24672         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
24673         return tag_ptr(ret_conv, true);
24674 }
24675
24676 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
24677         LDKThirtyTwoBytes o_ref;
24678         CHECK(o->arr_len == 32);
24679         memcpy(o_ref.data, o->elems, 32); FREE(o);
24680         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24681         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
24682         return tag_ptr(ret_conv, true);
24683 }
24684
24685 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_err"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_err(uint64_t e) {
24686         void* e_ptr = untag_ptr(e);
24687         CHECK_ACCESS(e_ptr);
24688         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24689         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24690         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24691         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
24692         return tag_ptr(ret_conv, true);
24693 }
24694
24695 jboolean  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(uint64_t o) {
24696         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
24697         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
24698         return ret_conv;
24699 }
24700
24701 void  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_free"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_free(uint64_t _res) {
24702         if (!ptr_is_owned(_res)) return;
24703         void* _res_ptr = untag_ptr(_res);
24704         CHECK_ACCESS(_res_ptr);
24705         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
24706         FREE(untag_ptr(_res));
24707         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
24708 }
24709
24710 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
24711         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24712         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
24713         return tag_ptr(ret_conv, true);
24714 }
24715 int64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(uint64_t arg) {
24716         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
24717         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
24718         return ret_conv;
24719 }
24720
24721 uint64_t  __attribute__((export_name("TS_CResult_ThirtyTwoBytesAPIErrorZ_clone"))) TS_CResult_ThirtyTwoBytesAPIErrorZ_clone(uint64_t orig) {
24722         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
24723         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24724         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
24725         return tag_ptr(ret_conv, true);
24726 }
24727
24728 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
24729         void* o_ptr = untag_ptr(o);
24730         CHECK_ACCESS(o_ptr);
24731         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
24732         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
24733         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24734         *ret_copy = COption_OffersMessageZ_some(o_conv);
24735         uint64_t ret_ref = tag_ptr(ret_copy, true);
24736         return ret_ref;
24737 }
24738
24739 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
24740         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24741         *ret_copy = COption_OffersMessageZ_none();
24742         uint64_t ret_ref = tag_ptr(ret_copy, true);
24743         return ret_ref;
24744 }
24745
24746 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
24747         if (!ptr_is_owned(_res)) return;
24748         void* _res_ptr = untag_ptr(_res);
24749         CHECK_ACCESS(_res_ptr);
24750         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
24751         FREE(untag_ptr(_res));
24752         COption_OffersMessageZ_free(_res_conv);
24753 }
24754
24755 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
24756         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24757         *ret_copy = COption_OffersMessageZ_clone(arg);
24758         uint64_t ret_ref = tag_ptr(ret_copy, true);
24759         return ret_ref;
24760 }
24761 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
24762         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
24763         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
24764         return ret_conv;
24765 }
24766
24767 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
24768         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
24769         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24770         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
24771         uint64_t ret_ref = tag_ptr(ret_copy, true);
24772         return ret_ref;
24773 }
24774
24775 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
24776         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24777         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
24778         return tag_ptr(ret_conv, true);
24779 }
24780 int64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
24781         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
24782         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
24783         return ret_conv;
24784 }
24785
24786 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(uint64_t orig) {
24787         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
24788         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24789         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
24790         return tag_ptr(ret_conv, true);
24791 }
24792
24793 uint64_t  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
24794         void* a_ptr = untag_ptr(a);
24795         CHECK_ACCESS(a_ptr);
24796         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
24797         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
24798         void* b_ptr = untag_ptr(b);
24799         CHECK_ACCESS(b_ptr);
24800         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24801         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24802         LDKBlindedPath c_conv;
24803         c_conv.inner = untag_ptr(c);
24804         c_conv.is_owned = ptr_is_owned(c);
24805         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24806         c_conv = BlindedPath_clone(&c_conv);
24807         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24808         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24809         return tag_ptr(ret_conv, true);
24810 }
24811
24812 void  __attribute__((export_name("TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free"))) TS_C3Tuple_OffersMessageDestinationBlindedPathZ_free(uint64_t _res) {
24813         if (!ptr_is_owned(_res)) return;
24814         void* _res_ptr = untag_ptr(_res);
24815         CHECK_ACCESS(_res_ptr);
24816         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
24817         FREE(untag_ptr(_res));
24818         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
24819 }
24820
24821 void  __attribute__((export_name("TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(uint64_tArray _res) {
24822         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
24823         _res_constr.datalen = _res->arr_len;
24824         if (_res_constr.datalen > 0)
24825                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
24826         else
24827                 _res_constr.data = NULL;
24828         uint64_t* _res_vals = _res->elems;
24829         for (size_t x = 0; x < _res_constr.datalen; x++) {
24830                 uint64_t _res_conv_49 = _res_vals[x];
24831                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24832                 CHECK_ACCESS(_res_conv_49_ptr);
24833                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
24834                 FREE(untag_ptr(_res_conv_49));
24835                 _res_constr.data[x] = _res_conv_49_conv;
24836         }
24837         FREE(_res);
24838         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
24839 }
24840
24841 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
24842         LDKPhantomRouteHints o_conv;
24843         o_conv.inner = untag_ptr(o);
24844         o_conv.is_owned = ptr_is_owned(o);
24845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24846         o_conv = PhantomRouteHints_clone(&o_conv);
24847         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24848         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
24849         return tag_ptr(ret_conv, true);
24850 }
24851
24852 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
24853         void* e_ptr = untag_ptr(e);
24854         CHECK_ACCESS(e_ptr);
24855         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24856         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24857         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24858         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
24859         return tag_ptr(ret_conv, true);
24860 }
24861
24862 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
24863         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
24864         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
24865         return ret_conv;
24866 }
24867
24868 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
24869         if (!ptr_is_owned(_res)) return;
24870         void* _res_ptr = untag_ptr(_res);
24871         CHECK_ACCESS(_res_ptr);
24872         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
24873         FREE(untag_ptr(_res));
24874         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
24875 }
24876
24877 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
24878         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24879         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
24880         return tag_ptr(ret_conv, true);
24881 }
24882 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
24883         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
24884         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
24885         return ret_conv;
24886 }
24887
24888 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
24889         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
24890         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24891         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
24892         return tag_ptr(ret_conv, true);
24893 }
24894
24895 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_ok(uint64_t o) {
24896         LDKBlindedForward o_conv;
24897         o_conv.inner = untag_ptr(o);
24898         o_conv.is_owned = ptr_is_owned(o);
24899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24900         o_conv = BlindedForward_clone(&o_conv);
24901         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24902         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
24903         return tag_ptr(ret_conv, true);
24904 }
24905
24906 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_err"))) TS_CResult_BlindedForwardDecodeErrorZ_err(uint64_t e) {
24907         void* e_ptr = untag_ptr(e);
24908         CHECK_ACCESS(e_ptr);
24909         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24910         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24911         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24912         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
24913         return tag_ptr(ret_conv, true);
24914 }
24915
24916 jboolean  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_is_ok"))) TS_CResult_BlindedForwardDecodeErrorZ_is_ok(uint64_t o) {
24917         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
24918         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
24919         return ret_conv;
24920 }
24921
24922 void  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_free"))) TS_CResult_BlindedForwardDecodeErrorZ_free(uint64_t _res) {
24923         if (!ptr_is_owned(_res)) return;
24924         void* _res_ptr = untag_ptr(_res);
24925         CHECK_ACCESS(_res_ptr);
24926         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
24927         FREE(untag_ptr(_res));
24928         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
24929 }
24930
24931 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
24932         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24933         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
24934         return tag_ptr(ret_conv, true);
24935 }
24936 int64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedForwardDecodeErrorZ_clone_ptr(uint64_t arg) {
24937         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
24938         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
24939         return ret_conv;
24940 }
24941
24942 uint64_t  __attribute__((export_name("TS_CResult_BlindedForwardDecodeErrorZ_clone"))) TS_CResult_BlindedForwardDecodeErrorZ_clone(uint64_t orig) {
24943         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
24944         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
24945         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
24946         return tag_ptr(ret_conv, true);
24947 }
24948
24949 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_ok(uint64_t o) {
24950         void* o_ptr = untag_ptr(o);
24951         CHECK_ACCESS(o_ptr);
24952         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
24953         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
24954         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24955         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
24956         return tag_ptr(ret_conv, true);
24957 }
24958
24959 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_err"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_err(uint64_t e) {
24960         void* e_ptr = untag_ptr(e);
24961         CHECK_ACCESS(e_ptr);
24962         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24963         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24964         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24965         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
24966         return tag_ptr(ret_conv, true);
24967 }
24968
24969 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(uint64_t o) {
24970         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
24971         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
24972         return ret_conv;
24973 }
24974
24975 void  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_free"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_free(uint64_t _res) {
24976         if (!ptr_is_owned(_res)) return;
24977         void* _res_ptr = untag_ptr(_res);
24978         CHECK_ACCESS(_res_ptr);
24979         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
24980         FREE(untag_ptr(_res));
24981         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
24982 }
24983
24984 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
24985         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24986         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
24987         return tag_ptr(ret_conv, true);
24988 }
24989 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(uint64_t arg) {
24990         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
24991         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
24992         return ret_conv;
24993 }
24994
24995 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone"))) TS_CResult_PendingHTLCRoutingDecodeErrorZ_clone(uint64_t orig) {
24996         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
24997         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
24998         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
24999         return tag_ptr(ret_conv, true);
25000 }
25001
25002 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_ok(uint64_t o) {
25003         LDKPendingHTLCInfo o_conv;
25004         o_conv.inner = untag_ptr(o);
25005         o_conv.is_owned = ptr_is_owned(o);
25006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25007         o_conv = PendingHTLCInfo_clone(&o_conv);
25008         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25009         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
25010         return tag_ptr(ret_conv, true);
25011 }
25012
25013 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_err"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_err(uint64_t e) {
25014         void* e_ptr = untag_ptr(e);
25015         CHECK_ACCESS(e_ptr);
25016         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25017         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25018         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25019         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
25020         return tag_ptr(ret_conv, true);
25021 }
25022
25023 jboolean  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(uint64_t o) {
25024         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
25025         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
25026         return ret_conv;
25027 }
25028
25029 void  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_free"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_free(uint64_t _res) {
25030         if (!ptr_is_owned(_res)) return;
25031         void* _res_ptr = untag_ptr(_res);
25032         CHECK_ACCESS(_res_ptr);
25033         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
25034         FREE(untag_ptr(_res));
25035         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
25036 }
25037
25038 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
25039         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25040         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
25041         return tag_ptr(ret_conv, true);
25042 }
25043 int64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
25044         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
25045         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
25046         return ret_conv;
25047 }
25048
25049 uint64_t  __attribute__((export_name("TS_CResult_PendingHTLCInfoDecodeErrorZ_clone"))) TS_CResult_PendingHTLCInfoDecodeErrorZ_clone(uint64_t orig) {
25050         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
25051         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25052         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
25053         return tag_ptr(ret_conv, true);
25054 }
25055
25056 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_ok(uint32_t o) {
25057         LDKBlindedFailure o_conv = LDKBlindedFailure_from_js(o);
25058         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25059         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
25060         return tag_ptr(ret_conv, true);
25061 }
25062
25063 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_err"))) TS_CResult_BlindedFailureDecodeErrorZ_err(uint64_t e) {
25064         void* e_ptr = untag_ptr(e);
25065         CHECK_ACCESS(e_ptr);
25066         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25067         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25068         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25069         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
25070         return tag_ptr(ret_conv, true);
25071 }
25072
25073 jboolean  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_is_ok"))) TS_CResult_BlindedFailureDecodeErrorZ_is_ok(uint64_t o) {
25074         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
25075         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
25076         return ret_conv;
25077 }
25078
25079 void  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_free"))) TS_CResult_BlindedFailureDecodeErrorZ_free(uint64_t _res) {
25080         if (!ptr_is_owned(_res)) return;
25081         void* _res_ptr = untag_ptr(_res);
25082         CHECK_ACCESS(_res_ptr);
25083         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
25084         FREE(untag_ptr(_res));
25085         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
25086 }
25087
25088 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
25089         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25090         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
25091         return tag_ptr(ret_conv, true);
25092 }
25093 int64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedFailureDecodeErrorZ_clone_ptr(uint64_t arg) {
25094         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
25095         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
25096         return ret_conv;
25097 }
25098
25099 uint64_t  __attribute__((export_name("TS_CResult_BlindedFailureDecodeErrorZ_clone"))) TS_CResult_BlindedFailureDecodeErrorZ_clone(uint64_t orig) {
25100         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
25101         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25102         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
25103         return tag_ptr(ret_conv, true);
25104 }
25105
25106 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
25107         LDKCVec_ChannelMonitorZ _res_constr;
25108         _res_constr.datalen = _res->arr_len;
25109         if (_res_constr.datalen > 0)
25110                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25111         else
25112                 _res_constr.data = NULL;
25113         uint64_t* _res_vals = _res->elems;
25114         for (size_t q = 0; q < _res_constr.datalen; q++) {
25115                 uint64_t _res_conv_16 = _res_vals[q];
25116                 LDKChannelMonitor _res_conv_16_conv;
25117                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25118                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25119                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25120                 _res_constr.data[q] = _res_conv_16_conv;
25121         }
25122         FREE(_res);
25123         CVec_ChannelMonitorZ_free(_res_constr);
25124 }
25125
25126 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, uint64_t b) {
25127         LDKThirtyTwoBytes a_ref;
25128         CHECK(a->arr_len == 32);
25129         memcpy(a_ref.data, a->elems, 32); FREE(a);
25130         LDKChannelManager b_conv;
25131         b_conv.inner = untag_ptr(b);
25132         b_conv.is_owned = ptr_is_owned(b);
25133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25134         // WARNING: we need a move here but no clone is available for LDKChannelManager
25135         
25136         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
25137         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
25138         return tag_ptr(ret_conv, true);
25139 }
25140
25141 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(uint64_t _res) {
25142         if (!ptr_is_owned(_res)) return;
25143         void* _res_ptr = untag_ptr(_res);
25144         CHECK_ACCESS(_res_ptr);
25145         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
25146         FREE(untag_ptr(_res));
25147         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
25148 }
25149
25150 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(uint64_t o) {
25151         void* o_ptr = untag_ptr(o);
25152         CHECK_ACCESS(o_ptr);
25153         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
25154         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
25155         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25156         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
25157         return tag_ptr(ret_conv, true);
25158 }
25159
25160 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(uint64_t e) {
25161         void* e_ptr = untag_ptr(e);
25162         CHECK_ACCESS(e_ptr);
25163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25165         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25166         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
25167         return tag_ptr(ret_conv, true);
25168 }
25169
25170 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
25171         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
25172         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
25173         return ret_conv;
25174 }
25175
25176 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(uint64_t _res) {
25177         if (!ptr_is_owned(_res)) return;
25178         void* _res_ptr = untag_ptr(_res);
25179         CHECK_ACCESS(_res_ptr);
25180         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
25181         FREE(untag_ptr(_res));
25182         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
25183 }
25184
25185 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
25186         void* o_ptr = untag_ptr(o);
25187         CHECK_ACCESS(o_ptr);
25188         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25189         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25190         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25191         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25192         return tag_ptr(ret_conv, true);
25193 }
25194
25195 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
25196         void* e_ptr = untag_ptr(e);
25197         CHECK_ACCESS(e_ptr);
25198         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25199         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25200         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25201         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25202         return tag_ptr(ret_conv, true);
25203 }
25204
25205 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
25206         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25207         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25208         return ret_conv;
25209 }
25210
25211 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
25212         if (!ptr_is_owned(_res)) return;
25213         void* _res_ptr = untag_ptr(_res);
25214         CHECK_ACCESS(_res_ptr);
25215         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25216         FREE(untag_ptr(_res));
25217         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25218 }
25219
25220 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25221         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25222         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25223         return tag_ptr(ret_conv, true);
25224 }
25225 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
25226         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25227         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25228         return ret_conv;
25229 }
25230
25231 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
25232         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25233         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25234         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25235         return tag_ptr(ret_conv, true);
25236 }
25237
25238 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
25239         LDKChannelConfig o_conv;
25240         o_conv.inner = untag_ptr(o);
25241         o_conv.is_owned = ptr_is_owned(o);
25242         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25243         o_conv = ChannelConfig_clone(&o_conv);
25244         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25245         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25246         return tag_ptr(ret_conv, true);
25247 }
25248
25249 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
25250         void* e_ptr = untag_ptr(e);
25251         CHECK_ACCESS(e_ptr);
25252         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25253         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25254         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25255         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25256         return tag_ptr(ret_conv, true);
25257 }
25258
25259 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
25260         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25261         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25262         return ret_conv;
25263 }
25264
25265 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
25266         if (!ptr_is_owned(_res)) return;
25267         void* _res_ptr = untag_ptr(_res);
25268         CHECK_ACCESS(_res_ptr);
25269         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25270         FREE(untag_ptr(_res));
25271         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25272 }
25273
25274 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25275         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25276         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25277         return tag_ptr(ret_conv, true);
25278 }
25279 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
25280         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25281         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25282         return ret_conv;
25283 }
25284
25285 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
25286         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25287         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25288         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25289         return tag_ptr(ret_conv, true);
25290 }
25291
25292 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
25293         void* o_ptr = untag_ptr(o);
25294         CHECK_ACCESS(o_ptr);
25295         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25296         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25297         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25298         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25299         uint64_t ret_ref = tag_ptr(ret_copy, true);
25300         return ret_ref;
25301 }
25302
25303 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
25304         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25305         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25306         uint64_t ret_ref = tag_ptr(ret_copy, true);
25307         return ret_ref;
25308 }
25309
25310 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
25311         if (!ptr_is_owned(_res)) return;
25312         void* _res_ptr = untag_ptr(_res);
25313         CHECK_ACCESS(_res_ptr);
25314         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25315         FREE(untag_ptr(_res));
25316         COption_MaxDustHTLCExposureZ_free(_res_conv);
25317 }
25318
25319 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25320         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25321         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25322         uint64_t ret_ref = tag_ptr(ret_copy, true);
25323         return ret_ref;
25324 }
25325 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
25326         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25327         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25328         return ret_conv;
25329 }
25330
25331 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
25332         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25333         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25334         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25335         uint64_t ret_ref = tag_ptr(ret_copy, true);
25336         return ret_ref;
25337 }
25338
25339 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
25340         void* o_ptr = untag_ptr(o);
25341         CHECK_ACCESS(o_ptr);
25342         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25343         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25344         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25345         *ret_copy = COption_APIErrorZ_some(o_conv);
25346         uint64_t ret_ref = tag_ptr(ret_copy, true);
25347         return ret_ref;
25348 }
25349
25350 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
25351         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25352         *ret_copy = COption_APIErrorZ_none();
25353         uint64_t ret_ref = tag_ptr(ret_copy, true);
25354         return ret_ref;
25355 }
25356
25357 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
25358         if (!ptr_is_owned(_res)) return;
25359         void* _res_ptr = untag_ptr(_res);
25360         CHECK_ACCESS(_res_ptr);
25361         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25362         FREE(untag_ptr(_res));
25363         COption_APIErrorZ_free(_res_conv);
25364 }
25365
25366 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25367         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25368         *ret_copy = COption_APIErrorZ_clone(arg);
25369         uint64_t ret_ref = tag_ptr(ret_copy, true);
25370         return ret_ref;
25371 }
25372 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
25373         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25374         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25375         return ret_conv;
25376 }
25377
25378 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
25379         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25380         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25381         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25382         uint64_t ret_ref = tag_ptr(ret_copy, true);
25383         return ret_ref;
25384 }
25385
25386 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
25387         void* o_ptr = untag_ptr(o);
25388         CHECK_ACCESS(o_ptr);
25389         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25390         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25391         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25392         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25393         return tag_ptr(ret_conv, true);
25394 }
25395
25396 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
25397         void* e_ptr = untag_ptr(e);
25398         CHECK_ACCESS(e_ptr);
25399         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25400         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25401         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25402         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25403         return tag_ptr(ret_conv, true);
25404 }
25405
25406 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
25407         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25408         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25409         return ret_conv;
25410 }
25411
25412 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
25413         if (!ptr_is_owned(_res)) return;
25414         void* _res_ptr = untag_ptr(_res);
25415         CHECK_ACCESS(_res_ptr);
25416         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25417         FREE(untag_ptr(_res));
25418         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25419 }
25420
25421 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25422         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25423         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25424         return tag_ptr(ret_conv, true);
25425 }
25426 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
25427         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25428         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25429         return ret_conv;
25430 }
25431
25432 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
25433         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25434         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25435         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25436         return tag_ptr(ret_conv, true);
25437 }
25438
25439 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
25440         LDKChannelMonitorUpdate o_conv;
25441         o_conv.inner = untag_ptr(o);
25442         o_conv.is_owned = ptr_is_owned(o);
25443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25444         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25445         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25446         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25447         return tag_ptr(ret_conv, true);
25448 }
25449
25450 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
25451         void* e_ptr = untag_ptr(e);
25452         CHECK_ACCESS(e_ptr);
25453         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25454         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25455         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25456         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25457         return tag_ptr(ret_conv, true);
25458 }
25459
25460 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
25461         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25462         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25463         return ret_conv;
25464 }
25465
25466 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
25467         if (!ptr_is_owned(_res)) return;
25468         void* _res_ptr = untag_ptr(_res);
25469         CHECK_ACCESS(_res_ptr);
25470         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25471         FREE(untag_ptr(_res));
25472         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25473 }
25474
25475 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25476         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25477         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25478         return tag_ptr(ret_conv, true);
25479 }
25480 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25481         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25482         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25483         return ret_conv;
25484 }
25485
25486 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
25487         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25488         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25489         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25490         return tag_ptr(ret_conv, true);
25491 }
25492
25493 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
25494         void* o_ptr = untag_ptr(o);
25495         CHECK_ACCESS(o_ptr);
25496         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25497         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25498         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25499         *ret_copy = COption_MonitorEventZ_some(o_conv);
25500         uint64_t ret_ref = tag_ptr(ret_copy, true);
25501         return ret_ref;
25502 }
25503
25504 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
25505         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25506         *ret_copy = COption_MonitorEventZ_none();
25507         uint64_t ret_ref = tag_ptr(ret_copy, true);
25508         return ret_ref;
25509 }
25510
25511 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
25512         if (!ptr_is_owned(_res)) return;
25513         void* _res_ptr = untag_ptr(_res);
25514         CHECK_ACCESS(_res_ptr);
25515         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25516         FREE(untag_ptr(_res));
25517         COption_MonitorEventZ_free(_res_conv);
25518 }
25519
25520 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25521         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25522         *ret_copy = COption_MonitorEventZ_clone(arg);
25523         uint64_t ret_ref = tag_ptr(ret_copy, true);
25524         return ret_ref;
25525 }
25526 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
25527         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25528         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25529         return ret_conv;
25530 }
25531
25532 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
25533         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25534         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25535         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25536         uint64_t ret_ref = tag_ptr(ret_copy, true);
25537         return ret_ref;
25538 }
25539
25540 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
25541         void* o_ptr = untag_ptr(o);
25542         CHECK_ACCESS(o_ptr);
25543         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25544         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25545         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25546         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25547         return tag_ptr(ret_conv, true);
25548 }
25549
25550 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
25551         void* e_ptr = untag_ptr(e);
25552         CHECK_ACCESS(e_ptr);
25553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25555         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25556         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25557         return tag_ptr(ret_conv, true);
25558 }
25559
25560 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
25561         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25562         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25563         return ret_conv;
25564 }
25565
25566 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
25567         if (!ptr_is_owned(_res)) return;
25568         void* _res_ptr = untag_ptr(_res);
25569         CHECK_ACCESS(_res_ptr);
25570         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25571         FREE(untag_ptr(_res));
25572         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25573 }
25574
25575 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25576         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25577         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25578         return tag_ptr(ret_conv, true);
25579 }
25580 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
25581         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25582         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25583         return ret_conv;
25584 }
25585
25586 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
25587         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25588         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25589         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25590         return tag_ptr(ret_conv, true);
25591 }
25592
25593 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
25594         LDKHTLCUpdate o_conv;
25595         o_conv.inner = untag_ptr(o);
25596         o_conv.is_owned = ptr_is_owned(o);
25597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25598         o_conv = HTLCUpdate_clone(&o_conv);
25599         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25600         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25601         return tag_ptr(ret_conv, true);
25602 }
25603
25604 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
25605         void* e_ptr = untag_ptr(e);
25606         CHECK_ACCESS(e_ptr);
25607         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25608         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25609         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25610         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
25611         return tag_ptr(ret_conv, true);
25612 }
25613
25614 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
25615         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
25616         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
25617         return ret_conv;
25618 }
25619
25620 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
25621         if (!ptr_is_owned(_res)) return;
25622         void* _res_ptr = untag_ptr(_res);
25623         CHECK_ACCESS(_res_ptr);
25624         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
25625         FREE(untag_ptr(_res));
25626         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
25627 }
25628
25629 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
25630         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25631         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
25632         return tag_ptr(ret_conv, true);
25633 }
25634 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25635         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
25636         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
25637         return ret_conv;
25638 }
25639
25640 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
25641         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
25642         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25643         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
25644         return tag_ptr(ret_conv, true);
25645 }
25646
25647 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
25648         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25649         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
25650         return tag_ptr(ret_conv, true);
25651 }
25652 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(uint64_t arg) {
25653         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
25654         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
25655         return ret_conv;
25656 }
25657
25658 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_clone"))) TS_C2Tuple_OutPointCVec_u8ZZ_clone(uint64_t orig) {
25659         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
25660         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25661         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
25662         return tag_ptr(ret_conv, true);
25663 }
25664
25665 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_new"))) TS_C2Tuple_OutPointCVec_u8ZZ_new(uint64_t a, int8_tArray b) {
25666         LDKOutPoint a_conv;
25667         a_conv.inner = untag_ptr(a);
25668         a_conv.is_owned = ptr_is_owned(a);
25669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25670         a_conv = OutPoint_clone(&a_conv);
25671         LDKCVec_u8Z b_ref;
25672         b_ref.datalen = b->arr_len;
25673         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25674         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25675         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25676         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
25677         return tag_ptr(ret_conv, true);
25678 }
25679
25680 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_u8ZZ_free"))) TS_C2Tuple_OutPointCVec_u8ZZ_free(uint64_t _res) {
25681         if (!ptr_is_owned(_res)) return;
25682         void* _res_ptr = untag_ptr(_res);
25683         CHECK_ACCESS(_res_ptr);
25684         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
25685         FREE(untag_ptr(_res));
25686         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
25687 }
25688
25689 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
25690         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25691         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
25692         return tag_ptr(ret_conv, true);
25693 }
25694 int64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone_ptr"))) TS_C2Tuple_u32CVec_u8ZZ_clone_ptr(uint64_t arg) {
25695         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
25696         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
25697         return ret_conv;
25698 }
25699
25700 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_clone"))) TS_C2Tuple_u32CVec_u8ZZ_clone(uint64_t orig) {
25701         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
25702         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25703         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
25704         return tag_ptr(ret_conv, true);
25705 }
25706
25707 uint64_t  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_new"))) TS_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
25708         LDKCVec_u8Z b_ref;
25709         b_ref.datalen = b->arr_len;
25710         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25711         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25712         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
25713         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
25714         return tag_ptr(ret_conv, true);
25715 }
25716
25717 void  __attribute__((export_name("TS_C2Tuple_u32CVec_u8ZZ_free"))) TS_C2Tuple_u32CVec_u8ZZ_free(uint64_t _res) {
25718         if (!ptr_is_owned(_res)) return;
25719         void* _res_ptr = untag_ptr(_res);
25720         CHECK_ACCESS(_res_ptr);
25721         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
25722         FREE(untag_ptr(_res));
25723         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
25724 }
25725
25726 void  __attribute__((export_name("TS_CVec_C2Tuple_u32CVec_u8ZZZ_free"))) TS_CVec_C2Tuple_u32CVec_u8ZZZ_free(uint64_tArray _res) {
25727         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
25728         _res_constr.datalen = _res->arr_len;
25729         if (_res_constr.datalen > 0)
25730                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
25731         else
25732                 _res_constr.data = NULL;
25733         uint64_t* _res_vals = _res->elems;
25734         for (size_t x = 0; x < _res_constr.datalen; x++) {
25735                 uint64_t _res_conv_23 = _res_vals[x];
25736                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
25737                 CHECK_ACCESS(_res_conv_23_ptr);
25738                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
25739                 FREE(untag_ptr(_res_conv_23));
25740                 _res_constr.data[x] = _res_conv_23_conv;
25741         }
25742         FREE(_res);
25743         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
25744 }
25745
25746 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
25747         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25748         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
25749         return tag_ptr(ret_conv, true);
25750 }
25751 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(uint64_t arg) {
25752         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
25753         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
25754         return ret_conv;
25755 }
25756
25757 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(uint64_t orig) {
25758         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
25759         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25760         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
25761         return tag_ptr(ret_conv, true);
25762 }
25763
25764 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) {
25765         LDKThirtyTwoBytes a_ref;
25766         CHECK(a->arr_len == 32);
25767         memcpy(a_ref.data, a->elems, 32); FREE(a);
25768         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
25769         b_constr.datalen = b->arr_len;
25770         if (b_constr.datalen > 0)
25771                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
25772         else
25773                 b_constr.data = NULL;
25774         uint64_t* b_vals = b->elems;
25775         for (size_t x = 0; x < b_constr.datalen; x++) {
25776                 uint64_t b_conv_23 = b_vals[x];
25777                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
25778                 CHECK_ACCESS(b_conv_23_ptr);
25779                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
25780                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
25781                 b_constr.data[x] = b_conv_23_conv;
25782         }
25783         FREE(b);
25784         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
25785         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
25786         return tag_ptr(ret_conv, true);
25787 }
25788
25789 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(uint64_t _res) {
25790         if (!ptr_is_owned(_res)) return;
25791         void* _res_ptr = untag_ptr(_res);
25792         CHECK_ACCESS(_res_ptr);
25793         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
25794         FREE(untag_ptr(_res));
25795         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
25796 }
25797
25798 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(uint64_tArray _res) {
25799         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
25800         _res_constr.datalen = _res->arr_len;
25801         if (_res_constr.datalen > 0)
25802                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
25803         else
25804                 _res_constr.data = NULL;
25805         uint64_t* _res_vals = _res->elems;
25806         for (size_t a = 0; a < _res_constr.datalen; a++) {
25807                 uint64_t _res_conv_52 = _res_vals[a];
25808                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
25809                 CHECK_ACCESS(_res_conv_52_ptr);
25810                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
25811                 FREE(untag_ptr(_res_conv_52));
25812                 _res_constr.data[a] = _res_conv_52_conv;
25813         }
25814         FREE(_res);
25815         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
25816 }
25817
25818 void  __attribute__((export_name("TS_CVec_CommitmentTransactionZ_free"))) TS_CVec_CommitmentTransactionZ_free(uint64_tArray _res) {
25819         LDKCVec_CommitmentTransactionZ _res_constr;
25820         _res_constr.datalen = _res->arr_len;
25821         if (_res_constr.datalen > 0)
25822                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
25823         else
25824                 _res_constr.data = NULL;
25825         uint64_t* _res_vals = _res->elems;
25826         for (size_t x = 0; x < _res_constr.datalen; x++) {
25827                 uint64_t _res_conv_23 = _res_vals[x];
25828                 LDKCommitmentTransaction _res_conv_23_conv;
25829                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
25830                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
25831                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
25832                 _res_constr.data[x] = _res_conv_23_conv;
25833         }
25834         FREE(_res);
25835         CVec_CommitmentTransactionZ_free(_res_constr);
25836 }
25837
25838 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
25839         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25840         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
25841         return tag_ptr(ret_conv, true);
25842 }
25843 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
25844         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
25845         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
25846         return ret_conv;
25847 }
25848
25849 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
25850         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
25851         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25852         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
25853         return tag_ptr(ret_conv, true);
25854 }
25855
25856 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
25857         void* b_ptr = untag_ptr(b);
25858         CHECK_ACCESS(b_ptr);
25859         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
25860         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
25861         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25862         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
25863         return tag_ptr(ret_conv, true);
25864 }
25865
25866 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
25867         if (!ptr_is_owned(_res)) return;
25868         void* _res_ptr = untag_ptr(_res);
25869         CHECK_ACCESS(_res_ptr);
25870         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
25871         FREE(untag_ptr(_res));
25872         C2Tuple_u32TxOutZ_free(_res_conv);
25873 }
25874
25875 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
25876         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
25877         _res_constr.datalen = _res->arr_len;
25878         if (_res_constr.datalen > 0)
25879                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25880         else
25881                 _res_constr.data = NULL;
25882         uint64_t* _res_vals = _res->elems;
25883         for (size_t u = 0; u < _res_constr.datalen; u++) {
25884                 uint64_t _res_conv_20 = _res_vals[u];
25885                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
25886                 CHECK_ACCESS(_res_conv_20_ptr);
25887                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
25888                 FREE(untag_ptr(_res_conv_20));
25889                 _res_constr.data[u] = _res_conv_20_conv;
25890         }
25891         FREE(_res);
25892         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
25893 }
25894
25895 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
25896         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25897         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
25898         return tag_ptr(ret_conv, true);
25899 }
25900 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
25901         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
25902         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
25903         return ret_conv;
25904 }
25905
25906 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
25907         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
25908         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25909         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
25910         return tag_ptr(ret_conv, true);
25911 }
25912
25913 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
25914         LDKThirtyTwoBytes a_ref;
25915         CHECK(a->arr_len == 32);
25916         memcpy(a_ref.data, a->elems, 32); FREE(a);
25917         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
25918         b_constr.datalen = b->arr_len;
25919         if (b_constr.datalen > 0)
25920                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25921         else
25922                 b_constr.data = NULL;
25923         uint64_t* b_vals = b->elems;
25924         for (size_t u = 0; u < b_constr.datalen; u++) {
25925                 uint64_t b_conv_20 = b_vals[u];
25926                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
25927                 CHECK_ACCESS(b_conv_20_ptr);
25928                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
25929                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
25930                 b_constr.data[u] = b_conv_20_conv;
25931         }
25932         FREE(b);
25933         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
25934         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
25935         return tag_ptr(ret_conv, true);
25936 }
25937
25938 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
25939         if (!ptr_is_owned(_res)) return;
25940         void* _res_ptr = untag_ptr(_res);
25941         CHECK_ACCESS(_res_ptr);
25942         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
25943         FREE(untag_ptr(_res));
25944         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
25945 }
25946
25947 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
25948         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
25949         _res_constr.datalen = _res->arr_len;
25950         if (_res_constr.datalen > 0)
25951                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
25952         else
25953                 _res_constr.data = NULL;
25954         uint64_t* _res_vals = _res->elems;
25955         for (size_t x = 0; x < _res_constr.datalen; x++) {
25956                 uint64_t _res_conv_49 = _res_vals[x];
25957                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
25958                 CHECK_ACCESS(_res_conv_49_ptr);
25959                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
25960                 FREE(untag_ptr(_res_conv_49));
25961                 _res_constr.data[x] = _res_conv_49_conv;
25962         }
25963         FREE(_res);
25964         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
25965 }
25966
25967 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
25968         LDKCVec_BalanceZ _res_constr;
25969         _res_constr.datalen = _res->arr_len;
25970         if (_res_constr.datalen > 0)
25971                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
25972         else
25973                 _res_constr.data = NULL;
25974         uint64_t* _res_vals = _res->elems;
25975         for (size_t j = 0; j < _res_constr.datalen; j++) {
25976                 uint64_t _res_conv_9 = _res_vals[j];
25977                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
25978                 CHECK_ACCESS(_res_conv_9_ptr);
25979                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
25980                 FREE(untag_ptr(_res_conv_9));
25981                 _res_constr.data[j] = _res_conv_9_conv;
25982         }
25983         FREE(_res);
25984         CVec_BalanceZ_free(_res_constr);
25985 }
25986
25987 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
25988         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
25989         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
25990         return tag_ptr(ret_conv, true);
25991 }
25992 int64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(uint64_t arg) {
25993         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
25994         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
25995         return ret_conv;
25996 }
25997
25998 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(uint64_t orig) {
25999         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
26000         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26001         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
26002         return tag_ptr(ret_conv, true);
26003 }
26004
26005 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, uint64_t b) {
26006         LDKThirtyTwoBytes a_ref;
26007         CHECK(a->arr_len == 32);
26008         memcpy(a_ref.data, a->elems, 32); FREE(a);
26009         LDKChannelMonitor b_conv;
26010         b_conv.inner = untag_ptr(b);
26011         b_conv.is_owned = ptr_is_owned(b);
26012         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26013         b_conv = ChannelMonitor_clone(&b_conv);
26014         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26015         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
26016         return tag_ptr(ret_conv, true);
26017 }
26018
26019 void  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(uint64_t _res) {
26020         if (!ptr_is_owned(_res)) return;
26021         void* _res_ptr = untag_ptr(_res);
26022         CHECK_ACCESS(_res_ptr);
26023         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
26024         FREE(untag_ptr(_res));
26025         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
26026 }
26027
26028 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
26029         void* o_ptr = untag_ptr(o);
26030         CHECK_ACCESS(o_ptr);
26031         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
26032         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
26033         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26034         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
26035         return tag_ptr(ret_conv, true);
26036 }
26037
26038 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(uint64_t e) {
26039         void* e_ptr = untag_ptr(e);
26040         CHECK_ACCESS(e_ptr);
26041         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26042         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26043         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26044         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
26045         return tag_ptr(ret_conv, true);
26046 }
26047
26048 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
26049         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
26050         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
26051         return ret_conv;
26052 }
26053
26054 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
26055         if (!ptr_is_owned(_res)) return;
26056         void* _res_ptr = untag_ptr(_res);
26057         CHECK_ACCESS(_res_ptr);
26058         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
26059         FREE(untag_ptr(_res));
26060         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
26061 }
26062
26063 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
26064         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26065         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
26066         return tag_ptr(ret_conv, true);
26067 }
26068 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
26069         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
26070         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
26071         return ret_conv;
26072 }
26073
26074 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
26075         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
26076         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26077         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
26078         return tag_ptr(ret_conv, true);
26079 }
26080
26081 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
26082         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26083         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
26084         return tag_ptr(ret_conv, true);
26085 }
26086 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
26087         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
26088         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
26089         return ret_conv;
26090 }
26091
26092 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
26093         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
26094         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26095         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
26096         return tag_ptr(ret_conv, true);
26097 }
26098
26099 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
26100         LDKPublicKey a_ref;
26101         CHECK(a->arr_len == 33);
26102         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26103         void* b_ptr = untag_ptr(b);
26104         CHECK_ACCESS(b_ptr);
26105         LDKType b_conv = *(LDKType*)(b_ptr);
26106         if (b_conv.free == LDKType_JCalls_free) {
26107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26108                 LDKType_JCalls_cloned(&b_conv);
26109         }
26110         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26111         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26112         return tag_ptr(ret_conv, true);
26113 }
26114
26115 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
26116         if (!ptr_is_owned(_res)) return;
26117         void* _res_ptr = untag_ptr(_res);
26118         CHECK_ACCESS(_res_ptr);
26119         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26120         FREE(untag_ptr(_res));
26121         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26122 }
26123
26124 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
26125         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26126         _res_constr.datalen = _res->arr_len;
26127         if (_res_constr.datalen > 0)
26128                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26129         else
26130                 _res_constr.data = NULL;
26131         uint64_t* _res_vals = _res->elems;
26132         for (size_t z = 0; z < _res_constr.datalen; z++) {
26133                 uint64_t _res_conv_25 = _res_vals[z];
26134                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26135                 CHECK_ACCESS(_res_conv_25_ptr);
26136                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26137                 FREE(untag_ptr(_res_conv_25));
26138                 _res_constr.data[z] = _res_conv_25_conv;
26139         }
26140         FREE(_res);
26141         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26142 }
26143
26144 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
26145         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26146         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
26147         return tag_ptr(ret_conv, true);
26148 }
26149 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(uint64_t arg) {
26150         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
26151         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
26152         return ret_conv;
26153 }
26154
26155 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(uint64_t orig) {
26156         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
26157         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26158         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
26159         return tag_ptr(ret_conv, true);
26160 }
26161
26162 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, uint64_tArray b) {
26163         LDKPublicKey a_ref;
26164         CHECK(a->arr_len == 33);
26165         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26166         LDKCVec_SocketAddressZ b_constr;
26167         b_constr.datalen = b->arr_len;
26168         if (b_constr.datalen > 0)
26169                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26170         else
26171                 b_constr.data = NULL;
26172         uint64_t* b_vals = b->elems;
26173         for (size_t p = 0; p < b_constr.datalen; p++) {
26174                 uint64_t b_conv_15 = b_vals[p];
26175                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
26176                 CHECK_ACCESS(b_conv_15_ptr);
26177                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
26178                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
26179                 b_constr.data[p] = b_conv_15_conv;
26180         }
26181         FREE(b);
26182         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26183         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
26184         return tag_ptr(ret_conv, true);
26185 }
26186
26187 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free"))) TS_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(uint64_t _res) {
26188         if (!ptr_is_owned(_res)) return;
26189         void* _res_ptr = untag_ptr(_res);
26190         CHECK_ACCESS(_res_ptr);
26191         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
26192         FREE(untag_ptr(_res));
26193         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
26194 }
26195
26196 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(uint64_tArray _res) {
26197         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
26198         _res_constr.datalen = _res->arr_len;
26199         if (_res_constr.datalen > 0)
26200                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
26201         else
26202                 _res_constr.data = NULL;
26203         uint64_t* _res_vals = _res->elems;
26204         for (size_t o = 0; o < _res_constr.datalen; o++) {
26205                 uint64_t _res_conv_40 = _res_vals[o];
26206                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26207                 CHECK_ACCESS(_res_conv_40_ptr);
26208                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
26209                 FREE(untag_ptr(_res_conv_40));
26210                 _res_constr.data[o] = _res_conv_40_conv;
26211         }
26212         FREE(_res);
26213         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
26214 }
26215
26216 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_some"))) TS_COption_OnionMessageContentsZ_some(uint64_t o) {
26217         void* o_ptr = untag_ptr(o);
26218         CHECK_ACCESS(o_ptr);
26219         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
26220         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
26221                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26222                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
26223         }
26224         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26225         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
26226         uint64_t ret_ref = tag_ptr(ret_copy, true);
26227         return ret_ref;
26228 }
26229
26230 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_none"))) TS_COption_OnionMessageContentsZ_none() {
26231         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26232         *ret_copy = COption_OnionMessageContentsZ_none();
26233         uint64_t ret_ref = tag_ptr(ret_copy, true);
26234         return ret_ref;
26235 }
26236
26237 void  __attribute__((export_name("TS_COption_OnionMessageContentsZ_free"))) TS_COption_OnionMessageContentsZ_free(uint64_t _res) {
26238         if (!ptr_is_owned(_res)) return;
26239         void* _res_ptr = untag_ptr(_res);
26240         CHECK_ACCESS(_res_ptr);
26241         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
26242         FREE(untag_ptr(_res));
26243         COption_OnionMessageContentsZ_free(_res_conv);
26244 }
26245
26246 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
26247         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26248         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
26249         uint64_t ret_ref = tag_ptr(ret_copy, true);
26250         return ret_ref;
26251 }
26252 int64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone_ptr"))) TS_COption_OnionMessageContentsZ_clone_ptr(uint64_t arg) {
26253         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
26254         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
26255         return ret_conv;
26256 }
26257
26258 uint64_t  __attribute__((export_name("TS_COption_OnionMessageContentsZ_clone"))) TS_COption_OnionMessageContentsZ_clone(uint64_t orig) {
26259         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
26260         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26261         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
26262         uint64_t ret_ref = tag_ptr(ret_copy, true);
26263         return ret_ref;
26264 }
26265
26266 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
26267         void* o_ptr = untag_ptr(o);
26268         CHECK_ACCESS(o_ptr);
26269         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
26270         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
26271         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26272         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
26273         return tag_ptr(ret_conv, true);
26274 }
26275
26276 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
26277         void* e_ptr = untag_ptr(e);
26278         CHECK_ACCESS(e_ptr);
26279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26281         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26282         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
26283         return tag_ptr(ret_conv, true);
26284 }
26285
26286 jboolean  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
26287         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26288         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26289         return ret_conv;
26290 }
26291
26292 void  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
26293         if (!ptr_is_owned(_res)) return;
26294         void* _res_ptr = untag_ptr(_res);
26295         CHECK_ACCESS(_res_ptr);
26296         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26297         FREE(untag_ptr(_res));
26298         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
26299 }
26300
26301 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26302         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26303         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
26304         return tag_ptr(ret_conv, true);
26305 }
26306 int64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
26307         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26308         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26309         return ret_conv;
26310 }
26311
26312 uint64_t  __attribute__((export_name("TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
26313         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26314         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26315         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26316         return tag_ptr(ret_conv, true);
26317 }
26318
26319 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
26320         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26321         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
26322         return tag_ptr(ret_conv, true);
26323 }
26324 int64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(uint64_t arg) {
26325         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
26326         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
26327         return ret_conv;
26328 }
26329
26330 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(uint64_t orig) {
26331         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
26332         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26333         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
26334         return tag_ptr(ret_conv, true);
26335 }
26336
26337 uint64_t  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(uint64_t a, uint64_t b, uint64_t c) {
26338         void* a_ptr = untag_ptr(a);
26339         CHECK_ACCESS(a_ptr);
26340         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
26341         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
26342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26343                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
26344         }
26345         void* b_ptr = untag_ptr(b);
26346         CHECK_ACCESS(b_ptr);
26347         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26348         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26349         LDKBlindedPath c_conv;
26350         c_conv.inner = untag_ptr(c);
26351         c_conv.is_owned = ptr_is_owned(c);
26352         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26353         c_conv = BlindedPath_clone(&c_conv);
26354         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26355         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26356         return tag_ptr(ret_conv, true);
26357 }
26358
26359 void  __attribute__((export_name("TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free"))) TS_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(uint64_t _res) {
26360         if (!ptr_is_owned(_res)) return;
26361         void* _res_ptr = untag_ptr(_res);
26362         CHECK_ACCESS(_res_ptr);
26363         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
26364         FREE(untag_ptr(_res));
26365         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
26366 }
26367
26368 void  __attribute__((export_name("TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free"))) TS_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(uint64_tArray _res) {
26369         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
26370         _res_constr.datalen = _res->arr_len;
26371         if (_res_constr.datalen > 0)
26372                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
26373         else
26374                 _res_constr.data = NULL;
26375         uint64_t* _res_vals = _res->elems;
26376         for (size_t e = 0; e < _res_constr.datalen; e++) {
26377                 uint64_t _res_conv_56 = _res_vals[e];
26378                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
26379                 CHECK_ACCESS(_res_conv_56_ptr);
26380                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
26381                 FREE(untag_ptr(_res_conv_56));
26382                 _res_constr.data[e] = _res_conv_56_conv;
26383         }
26384         FREE(_res);
26385         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
26386 }
26387
26388 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
26389         void* o_ptr = untag_ptr(o);
26390         CHECK_ACCESS(o_ptr);
26391         LDKType o_conv = *(LDKType*)(o_ptr);
26392         if (o_conv.free == LDKType_JCalls_free) {
26393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26394                 LDKType_JCalls_cloned(&o_conv);
26395         }
26396         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26397         *ret_copy = COption_TypeZ_some(o_conv);
26398         uint64_t ret_ref = tag_ptr(ret_copy, true);
26399         return ret_ref;
26400 }
26401
26402 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
26403         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26404         *ret_copy = COption_TypeZ_none();
26405         uint64_t ret_ref = tag_ptr(ret_copy, true);
26406         return ret_ref;
26407 }
26408
26409 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
26410         if (!ptr_is_owned(_res)) return;
26411         void* _res_ptr = untag_ptr(_res);
26412         CHECK_ACCESS(_res_ptr);
26413         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26414         FREE(untag_ptr(_res));
26415         COption_TypeZ_free(_res_conv);
26416 }
26417
26418 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26419         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26420         *ret_copy = COption_TypeZ_clone(arg);
26421         uint64_t ret_ref = tag_ptr(ret_copy, true);
26422         return ret_ref;
26423 }
26424 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
26425         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26426         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26427         return ret_conv;
26428 }
26429
26430 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
26431         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26432         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26433         *ret_copy = COption_TypeZ_clone(orig_conv);
26434         uint64_t ret_ref = tag_ptr(ret_copy, true);
26435         return ret_ref;
26436 }
26437
26438 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
26439         void* o_ptr = untag_ptr(o);
26440         CHECK_ACCESS(o_ptr);
26441         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26442         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26443         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26444         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26445         return tag_ptr(ret_conv, true);
26446 }
26447
26448 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
26449         void* e_ptr = untag_ptr(e);
26450         CHECK_ACCESS(e_ptr);
26451         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26452         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26453         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26454         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26455         return tag_ptr(ret_conv, true);
26456 }
26457
26458 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
26459         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26460         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26461         return ret_conv;
26462 }
26463
26464 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
26465         if (!ptr_is_owned(_res)) return;
26466         void* _res_ptr = untag_ptr(_res);
26467         CHECK_ACCESS(_res_ptr);
26468         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26469         FREE(untag_ptr(_res));
26470         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26471 }
26472
26473 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26474         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26475         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26476         return tag_ptr(ret_conv, true);
26477 }
26478 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
26479         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26480         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26481         return ret_conv;
26482 }
26483
26484 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
26485         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26486         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26487         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26488         return tag_ptr(ret_conv, true);
26489 }
26490
26491 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_some"))) TS_COption_SocketAddressZ_some(uint64_t o) {
26492         void* o_ptr = untag_ptr(o);
26493         CHECK_ACCESS(o_ptr);
26494         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
26495         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
26496         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26497         *ret_copy = COption_SocketAddressZ_some(o_conv);
26498         uint64_t ret_ref = tag_ptr(ret_copy, true);
26499         return ret_ref;
26500 }
26501
26502 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_none"))) TS_COption_SocketAddressZ_none() {
26503         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26504         *ret_copy = COption_SocketAddressZ_none();
26505         uint64_t ret_ref = tag_ptr(ret_copy, true);
26506         return ret_ref;
26507 }
26508
26509 void  __attribute__((export_name("TS_COption_SocketAddressZ_free"))) TS_COption_SocketAddressZ_free(uint64_t _res) {
26510         if (!ptr_is_owned(_res)) return;
26511         void* _res_ptr = untag_ptr(_res);
26512         CHECK_ACCESS(_res_ptr);
26513         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
26514         FREE(untag_ptr(_res));
26515         COption_SocketAddressZ_free(_res_conv);
26516 }
26517
26518 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
26519         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26520         *ret_copy = COption_SocketAddressZ_clone(arg);
26521         uint64_t ret_ref = tag_ptr(ret_copy, true);
26522         return ret_ref;
26523 }
26524 int64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone_ptr"))) TS_COption_SocketAddressZ_clone_ptr(uint64_t arg) {
26525         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
26526         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
26527         return ret_conv;
26528 }
26529
26530 uint64_t  __attribute__((export_name("TS_COption_SocketAddressZ_clone"))) TS_COption_SocketAddressZ_clone(uint64_t orig) {
26531         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
26532         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26533         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
26534         uint64_t ret_ref = tag_ptr(ret_copy, true);
26535         return ret_ref;
26536 }
26537
26538 void  __attribute__((export_name("TS_CVec_PeerDetailsZ_free"))) TS_CVec_PeerDetailsZ_free(uint64_tArray _res) {
26539         LDKCVec_PeerDetailsZ _res_constr;
26540         _res_constr.datalen = _res->arr_len;
26541         if (_res_constr.datalen > 0)
26542                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
26543         else
26544                 _res_constr.data = NULL;
26545         uint64_t* _res_vals = _res->elems;
26546         for (size_t n = 0; n < _res_constr.datalen; n++) {
26547                 uint64_t _res_conv_13 = _res_vals[n];
26548                 LDKPeerDetails _res_conv_13_conv;
26549                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
26550                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
26551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
26552                 _res_constr.data[n] = _res_conv_13_conv;
26553         }
26554         FREE(_res);
26555         CVec_PeerDetailsZ_free(_res_constr);
26556 }
26557
26558 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
26559         LDKCVec_u8Z o_ref;
26560         o_ref.datalen = o->arr_len;
26561         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26562         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26563         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26564         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26565         return tag_ptr(ret_conv, true);
26566 }
26567
26568 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
26569         LDKPeerHandleError e_conv;
26570         e_conv.inner = untag_ptr(e);
26571         e_conv.is_owned = ptr_is_owned(e);
26572         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26573         e_conv = PeerHandleError_clone(&e_conv);
26574         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26575         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26576         return tag_ptr(ret_conv, true);
26577 }
26578
26579 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
26580         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26581         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26582         return ret_conv;
26583 }
26584
26585 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
26586         if (!ptr_is_owned(_res)) return;
26587         void* _res_ptr = untag_ptr(_res);
26588         CHECK_ACCESS(_res_ptr);
26589         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26590         FREE(untag_ptr(_res));
26591         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26592 }
26593
26594 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26595         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26596         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26597         return tag_ptr(ret_conv, true);
26598 }
26599 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
26600         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26601         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26602         return ret_conv;
26603 }
26604
26605 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
26606         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
26607         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26608         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
26609         return tag_ptr(ret_conv, true);
26610 }
26611
26612 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
26613         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26614         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
26615         return tag_ptr(ret_conv, true);
26616 }
26617
26618 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
26619         LDKPeerHandleError e_conv;
26620         e_conv.inner = untag_ptr(e);
26621         e_conv.is_owned = ptr_is_owned(e);
26622         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26623         e_conv = PeerHandleError_clone(&e_conv);
26624         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26625         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
26626         return tag_ptr(ret_conv, true);
26627 }
26628
26629 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
26630         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
26631         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
26632         return ret_conv;
26633 }
26634
26635 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
26636         if (!ptr_is_owned(_res)) return;
26637         void* _res_ptr = untag_ptr(_res);
26638         CHECK_ACCESS(_res_ptr);
26639         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
26640         FREE(untag_ptr(_res));
26641         CResult_NonePeerHandleErrorZ_free(_res_conv);
26642 }
26643
26644 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
26645         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26646         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
26647         return tag_ptr(ret_conv, true);
26648 }
26649 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
26650         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
26651         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
26652         return ret_conv;
26653 }
26654
26655 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
26656         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
26657         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26658         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
26659         return tag_ptr(ret_conv, true);
26660 }
26661
26662 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
26663         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26664         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
26665         return tag_ptr(ret_conv, true);
26666 }
26667
26668 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
26669         LDKPeerHandleError e_conv;
26670         e_conv.inner = untag_ptr(e);
26671         e_conv.is_owned = ptr_is_owned(e);
26672         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26673         e_conv = PeerHandleError_clone(&e_conv);
26674         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26675         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
26676         return tag_ptr(ret_conv, true);
26677 }
26678
26679 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
26680         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
26681         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
26682         return ret_conv;
26683 }
26684
26685 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
26686         if (!ptr_is_owned(_res)) return;
26687         void* _res_ptr = untag_ptr(_res);
26688         CHECK_ACCESS(_res_ptr);
26689         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
26690         FREE(untag_ptr(_res));
26691         CResult_boolPeerHandleErrorZ_free(_res_conv);
26692 }
26693
26694 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
26695         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26696         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
26697         return tag_ptr(ret_conv, true);
26698 }
26699 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
26700         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
26701         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
26702         return ret_conv;
26703 }
26704
26705 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
26706         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
26707         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26708         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
26709         return tag_ptr(ret_conv, true);
26710 }
26711
26712 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
26713         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26714         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
26715         return tag_ptr(ret_conv, true);
26716 }
26717
26718 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
26719         void* e_ptr = untag_ptr(e);
26720         CHECK_ACCESS(e_ptr);
26721         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
26722         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
26723         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26724         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
26725         return tag_ptr(ret_conv, true);
26726 }
26727
26728 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
26729         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
26730         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
26731         return ret_conv;
26732 }
26733
26734 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
26735         if (!ptr_is_owned(_res)) return;
26736         void* _res_ptr = untag_ptr(_res);
26737         CHECK_ACCESS(_res_ptr);
26738         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
26739         FREE(untag_ptr(_res));
26740         CResult_u32GraphSyncErrorZ_free(_res_conv);
26741 }
26742
26743 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_ok"))) TS_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
26744         LDKCVec_u8Z o_ref;
26745         o_ref.datalen = o->arr_len;
26746         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26747         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26748         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26749         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
26750         return tag_ptr(ret_conv, true);
26751 }
26752
26753 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_err"))) TS_CResult_CVec_u8ZIOErrorZ_err(uint32_t e) {
26754         LDKIOError e_conv = LDKIOError_from_js(e);
26755         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26756         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
26757         return tag_ptr(ret_conv, true);
26758 }
26759
26760 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_is_ok"))) TS_CResult_CVec_u8ZIOErrorZ_is_ok(uint64_t o) {
26761         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
26762         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
26763         return ret_conv;
26764 }
26765
26766 void  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_free"))) TS_CResult_CVec_u8ZIOErrorZ_free(uint64_t _res) {
26767         if (!ptr_is_owned(_res)) return;
26768         void* _res_ptr = untag_ptr(_res);
26769         CHECK_ACCESS(_res_ptr);
26770         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
26771         FREE(untag_ptr(_res));
26772         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
26773 }
26774
26775 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
26776         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26777         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
26778         return tag_ptr(ret_conv, true);
26779 }
26780 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZIOErrorZ_clone_ptr(uint64_t arg) {
26781         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
26782         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
26783         return ret_conv;
26784 }
26785
26786 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZIOErrorZ_clone"))) TS_CResult_CVec_u8ZIOErrorZ_clone(uint64_t orig) {
26787         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
26788         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
26789         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
26790         return tag_ptr(ret_conv, true);
26791 }
26792
26793 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_ok"))) TS_CResult_NoneIOErrorZ_ok() {
26794         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26795         *ret_conv = CResult_NoneIOErrorZ_ok();
26796         return tag_ptr(ret_conv, true);
26797 }
26798
26799 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_err"))) TS_CResult_NoneIOErrorZ_err(uint32_t e) {
26800         LDKIOError e_conv = LDKIOError_from_js(e);
26801         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26802         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
26803         return tag_ptr(ret_conv, true);
26804 }
26805
26806 jboolean  __attribute__((export_name("TS_CResult_NoneIOErrorZ_is_ok"))) TS_CResult_NoneIOErrorZ_is_ok(uint64_t o) {
26807         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
26808         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
26809         return ret_conv;
26810 }
26811
26812 void  __attribute__((export_name("TS_CResult_NoneIOErrorZ_free"))) TS_CResult_NoneIOErrorZ_free(uint64_t _res) {
26813         if (!ptr_is_owned(_res)) return;
26814         void* _res_ptr = untag_ptr(_res);
26815         CHECK_ACCESS(_res_ptr);
26816         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
26817         FREE(untag_ptr(_res));
26818         CResult_NoneIOErrorZ_free(_res_conv);
26819 }
26820
26821 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
26822         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26823         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
26824         return tag_ptr(ret_conv, true);
26825 }
26826 int64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone_ptr"))) TS_CResult_NoneIOErrorZ_clone_ptr(uint64_t arg) {
26827         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
26828         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
26829         return ret_conv;
26830 }
26831
26832 uint64_t  __attribute__((export_name("TS_CResult_NoneIOErrorZ_clone"))) TS_CResult_NoneIOErrorZ_clone(uint64_t orig) {
26833         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
26834         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26835         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
26836         return tag_ptr(ret_conv, true);
26837 }
26838
26839 void  __attribute__((export_name("TS_CVec_StrZ_free"))) TS_CVec_StrZ_free(ptrArray _res) {
26840         LDKCVec_StrZ _res_constr;
26841         _res_constr.datalen = _res->arr_len;
26842         if (_res_constr.datalen > 0)
26843                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
26844         else
26845                 _res_constr.data = NULL;
26846         jstring* _res_vals = (void*) _res->elems;
26847         for (size_t i = 0; i < _res_constr.datalen; i++) {
26848                 jstring _res_conv_8 = _res_vals[i];
26849                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
26850                 _res_constr.data[i] = dummy;
26851         }
26852         FREE(_res);
26853         CVec_StrZ_free(_res_constr);
26854 }
26855
26856 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_ok"))) TS_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
26857         LDKCVec_StrZ o_constr;
26858         o_constr.datalen = o->arr_len;
26859         if (o_constr.datalen > 0)
26860                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
26861         else
26862                 o_constr.data = NULL;
26863         jstring* o_vals = (void*) o->elems;
26864         for (size_t i = 0; i < o_constr.datalen; i++) {
26865                 jstring o_conv_8 = o_vals[i];
26866                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
26867                 o_constr.data[i] = o_conv_8_conv;
26868         }
26869         FREE(o);
26870         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26871         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
26872         return tag_ptr(ret_conv, true);
26873 }
26874
26875 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_err"))) TS_CResult_CVec_StrZIOErrorZ_err(uint32_t e) {
26876         LDKIOError e_conv = LDKIOError_from_js(e);
26877         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26878         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
26879         return tag_ptr(ret_conv, true);
26880 }
26881
26882 jboolean  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_is_ok"))) TS_CResult_CVec_StrZIOErrorZ_is_ok(uint64_t o) {
26883         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
26884         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
26885         return ret_conv;
26886 }
26887
26888 void  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_free"))) TS_CResult_CVec_StrZIOErrorZ_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_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
26893         FREE(untag_ptr(_res));
26894         CResult_CVec_StrZIOErrorZ_free(_res_conv);
26895 }
26896
26897 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
26898         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26899         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
26900         return tag_ptr(ret_conv, true);
26901 }
26902 int64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone_ptr"))) TS_CResult_CVec_StrZIOErrorZ_clone_ptr(uint64_t arg) {
26903         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
26904         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
26905         return ret_conv;
26906 }
26907
26908 uint64_t  __attribute__((export_name("TS_CResult_CVec_StrZIOErrorZ_clone"))) TS_CResult_CVec_StrZIOErrorZ_clone(uint64_t orig) {
26909         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
26910         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
26911         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
26912         return tag_ptr(ret_conv, true);
26913 }
26914
26915 void  __attribute__((export_name("TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free"))) TS_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(uint64_tArray _res) {
26916         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
26917         _res_constr.datalen = _res->arr_len;
26918         if (_res_constr.datalen > 0)
26919                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
26920         else
26921                 _res_constr.data = NULL;
26922         uint64_t* _res_vals = _res->elems;
26923         for (size_t o = 0; o < _res_constr.datalen; o++) {
26924                 uint64_t _res_conv_40 = _res_vals[o];
26925                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26926                 CHECK_ACCESS(_res_conv_40_ptr);
26927                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
26928                 FREE(untag_ptr(_res_conv_40));
26929                 _res_constr.data[o] = _res_conv_40_conv;
26930         }
26931         FREE(_res);
26932         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
26933 }
26934
26935 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(uint64_tArray o) {
26936         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
26937         o_constr.datalen = o->arr_len;
26938         if (o_constr.datalen > 0)
26939                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
26940         else
26941                 o_constr.data = NULL;
26942         uint64_t* o_vals = o->elems;
26943         for (size_t o = 0; o < o_constr.datalen; o++) {
26944                 uint64_t o_conv_40 = o_vals[o];
26945                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
26946                 CHECK_ACCESS(o_conv_40_ptr);
26947                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
26948                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
26949                 o_constr.data[o] = o_conv_40_conv;
26950         }
26951         FREE(o);
26952         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
26953         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
26954         return tag_ptr(ret_conv, true);
26955 }
26956
26957 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(uint32_t e) {
26958         LDKIOError e_conv = LDKIOError_from_js(e);
26959         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
26960         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
26961         return tag_ptr(ret_conv, true);
26962 }
26963
26964 jboolean  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(uint64_t o) {
26965         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
26966         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
26967         return ret_conv;
26968 }
26969
26970 void  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(uint64_t _res) {
26971         if (!ptr_is_owned(_res)) return;
26972         void* _res_ptr = untag_ptr(_res);
26973         CHECK_ACCESS(_res_ptr);
26974         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
26975         FREE(untag_ptr(_res));
26976         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
26977 }
26978
26979 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
26980         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
26981         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
26982         return tag_ptr(ret_conv, true);
26983 }
26984 int64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(uint64_t arg) {
26985         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
26986         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
26987         return ret_conv;
26988 }
26989
26990 uint64_t  __attribute__((export_name("TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone"))) TS_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(uint64_t orig) {
26991         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
26992         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
26993         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
26994         return tag_ptr(ret_conv, true);
26995 }
26996
26997 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(uint64_t o) {
26998         void* o_ptr = untag_ptr(o);
26999         CHECK_ACCESS(o_ptr);
27000         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27001         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27002         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27003         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
27004         return tag_ptr(ret_conv, true);
27005 }
27006
27007 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(uint32_t e) {
27008         LDKIOError e_conv = LDKIOError_from_js(e);
27009         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27010         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
27011         return tag_ptr(ret_conv, true);
27012 }
27013
27014 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(uint64_t o) {
27015         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
27016         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
27017         return ret_conv;
27018 }
27019
27020 void  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(uint64_t _res) {
27021         if (!ptr_is_owned(_res)) return;
27022         void* _res_ptr = untag_ptr(_res);
27023         CHECK_ACCESS(_res_ptr);
27024         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
27025         FREE(untag_ptr(_res));
27026         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
27027 }
27028
27029 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
27030         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27031         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
27032         return tag_ptr(ret_conv, true);
27033 }
27034 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(uint64_t arg) {
27035         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
27036         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
27037         return ret_conv;
27038 }
27039
27040 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone"))) TS_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(uint64_t orig) {
27041         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
27042         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27043         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
27044         return tag_ptr(ret_conv, true);
27045 }
27046
27047 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(uint64_t o) {
27048         LDKUnsignedInvoiceRequest o_conv;
27049         o_conv.inner = untag_ptr(o);
27050         o_conv.is_owned = ptr_is_owned(o);
27051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27052         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
27053         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27054         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27055         return tag_ptr(ret_conv, true);
27056 }
27057
27058 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(uint32_t e) {
27059         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27060         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27061         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27062         return tag_ptr(ret_conv, true);
27063 }
27064
27065 jboolean  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(uint64_t o) {
27066         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27067         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27068         return ret_conv;
27069 }
27070
27071 void  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(uint64_t _res) {
27072         if (!ptr_is_owned(_res)) return;
27073         void* _res_ptr = untag_ptr(_res);
27074         CHECK_ACCESS(_res_ptr);
27075         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27076         FREE(untag_ptr(_res));
27077         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27078 }
27079
27080 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27081         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27082         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
27083         return tag_ptr(ret_conv, true);
27084 }
27085 int64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
27086         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27087         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27088         return ret_conv;
27089 }
27090
27091 uint64_t  __attribute__((export_name("TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone"))) TS_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(uint64_t orig) {
27092         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27093         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27094         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27095         return tag_ptr(ret_conv, true);
27096 }
27097
27098 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_ok(uint64_t o) {
27099         LDKInvoiceRequest o_conv;
27100         o_conv.inner = untag_ptr(o);
27101         o_conv.is_owned = ptr_is_owned(o);
27102         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27103         o_conv = InvoiceRequest_clone(&o_conv);
27104         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27105         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27106         return tag_ptr(ret_conv, true);
27107 }
27108
27109 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_err(uint32_t e) {
27110         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27111         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27112         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27113         return tag_ptr(ret_conv, true);
27114 }
27115
27116 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(uint64_t o) {
27117         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27118         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27119         return ret_conv;
27120 }
27121
27122 void  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_free(uint64_t _res) {
27123         if (!ptr_is_owned(_res)) return;
27124         void* _res_ptr = untag_ptr(_res);
27125         CHECK_ACCESS(_res_ptr);
27126         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27127         FREE(untag_ptr(_res));
27128         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27129 }
27130
27131 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27132         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27133         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
27134         return tag_ptr(ret_conv, true);
27135 }
27136 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(uint64_t arg) {
27137         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27138         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27139         return ret_conv;
27140 }
27141
27142 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone"))) TS_CResult_InvoiceRequestBolt12SemanticErrorZ_clone(uint64_t orig) {
27143         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27144         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27145         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27146         return tag_ptr(ret_conv, true);
27147 }
27148
27149 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_some"))) TS_COption_SecretKeyZ_some(int8_tArray o) {
27150         LDKSecretKey o_ref;
27151         CHECK(o->arr_len == 32);
27152         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
27153         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27154         *ret_copy = COption_SecretKeyZ_some(o_ref);
27155         uint64_t ret_ref = tag_ptr(ret_copy, true);
27156         return ret_ref;
27157 }
27158
27159 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_none"))) TS_COption_SecretKeyZ_none() {
27160         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27161         *ret_copy = COption_SecretKeyZ_none();
27162         uint64_t ret_ref = tag_ptr(ret_copy, true);
27163         return ret_ref;
27164 }
27165
27166 void  __attribute__((export_name("TS_COption_SecretKeyZ_free"))) TS_COption_SecretKeyZ_free(uint64_t _res) {
27167         if (!ptr_is_owned(_res)) return;
27168         void* _res_ptr = untag_ptr(_res);
27169         CHECK_ACCESS(_res_ptr);
27170         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
27171         FREE(untag_ptr(_res));
27172         COption_SecretKeyZ_free(_res_conv);
27173 }
27174
27175 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
27176         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27177         *ret_copy = COption_SecretKeyZ_clone(arg);
27178         uint64_t ret_ref = tag_ptr(ret_copy, true);
27179         return ret_ref;
27180 }
27181 int64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone_ptr"))) TS_COption_SecretKeyZ_clone_ptr(uint64_t arg) {
27182         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
27183         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
27184         return ret_conv;
27185 }
27186
27187 uint64_t  __attribute__((export_name("TS_COption_SecretKeyZ_clone"))) TS_COption_SecretKeyZ_clone(uint64_t orig) {
27188         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
27189         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27190         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
27191         uint64_t ret_ref = tag_ptr(ret_copy, true);
27192         return ret_ref;
27193 }
27194
27195 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
27196         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
27197         o_conv.inner = untag_ptr(o);
27198         o_conv.is_owned = ptr_is_owned(o);
27199         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27200         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
27201         
27202         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27203         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27204         return tag_ptr(ret_conv, true);
27205 }
27206
27207 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(uint32_t e) {
27208         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27209         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27210         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27211         return tag_ptr(ret_conv, true);
27212 }
27213
27214 jboolean  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
27215         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27216         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27217         return ret_conv;
27218 }
27219
27220 void  __attribute__((export_name("TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
27221         if (!ptr_is_owned(_res)) return;
27222         void* _res_ptr = untag_ptr(_res);
27223         CHECK_ACCESS(_res_ptr);
27224         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27225         FREE(untag_ptr(_res));
27226         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27227 }
27228
27229 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_ok(uint64_t o) {
27230         LDKVerifiedInvoiceRequest o_conv;
27231         o_conv.inner = untag_ptr(o);
27232         o_conv.is_owned = ptr_is_owned(o);
27233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27234         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
27235         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27236         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
27237         return tag_ptr(ret_conv, true);
27238 }
27239
27240 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_err"))) TS_CResult_VerifiedInvoiceRequestNoneZ_err() {
27241         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27242         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
27243         return tag_ptr(ret_conv, true);
27244 }
27245
27246 jboolean  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok"))) TS_CResult_VerifiedInvoiceRequestNoneZ_is_ok(uint64_t o) {
27247         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
27248         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
27249         return ret_conv;
27250 }
27251
27252 void  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_free"))) TS_CResult_VerifiedInvoiceRequestNoneZ_free(uint64_t _res) {
27253         if (!ptr_is_owned(_res)) return;
27254         void* _res_ptr = untag_ptr(_res);
27255         CHECK_ACCESS(_res_ptr);
27256         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
27257         FREE(untag_ptr(_res));
27258         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
27259 }
27260
27261 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
27262         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27263         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
27264         return tag_ptr(ret_conv, true);
27265 }
27266 int64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(uint64_t arg) {
27267         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
27268         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
27269         return ret_conv;
27270 }
27271
27272 uint64_t  __attribute__((export_name("TS_CResult_VerifiedInvoiceRequestNoneZ_clone"))) TS_CResult_VerifiedInvoiceRequestNoneZ_clone(uint64_t orig) {
27273         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
27274         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27275         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
27276         return tag_ptr(ret_conv, true);
27277 }
27278
27279 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(uint64_t o) {
27280         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
27281         o_conv.inner = untag_ptr(o);
27282         o_conv.is_owned = ptr_is_owned(o);
27283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27284         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
27285         
27286         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27287         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27288         return tag_ptr(ret_conv, true);
27289 }
27290
27291 uint64_t  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(uint32_t e) {
27292         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_js(e);
27293         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27294         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27295         return tag_ptr(ret_conv, true);
27296 }
27297
27298 jboolean  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(uint64_t o) {
27299         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27300         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27301         return ret_conv;
27302 }
27303
27304 void  __attribute__((export_name("TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free"))) TS_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(uint64_t _res) {
27305         if (!ptr_is_owned(_res)) return;
27306         void* _res_ptr = untag_ptr(_res);
27307         CHECK_ACCESS(_res_ptr);
27308         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27309         FREE(untag_ptr(_res));
27310         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27311 }
27312
27313 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_ok(uint64_t o) {
27314         LDKInvoiceRequestFields o_conv;
27315         o_conv.inner = untag_ptr(o);
27316         o_conv.is_owned = ptr_is_owned(o);
27317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27318         o_conv = InvoiceRequestFields_clone(&o_conv);
27319         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27320         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
27321         return tag_ptr(ret_conv, true);
27322 }
27323
27324 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_err"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_err(uint64_t e) {
27325         void* e_ptr = untag_ptr(e);
27326         CHECK_ACCESS(e_ptr);
27327         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27328         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27329         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27330         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
27331         return tag_ptr(ret_conv, true);
27332 }
27333
27334 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(uint64_t o) {
27335         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
27336         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
27337         return ret_conv;
27338 }
27339
27340 void  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_free(uint64_t _res) {
27341         if (!ptr_is_owned(_res)) return;
27342         void* _res_ptr = untag_ptr(_res);
27343         CHECK_ACCESS(_res_ptr);
27344         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
27345         FREE(untag_ptr(_res));
27346         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
27347 }
27348
27349 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
27350         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27351         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
27352         return tag_ptr(ret_conv, true);
27353 }
27354 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
27355         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
27356         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
27357         return ret_conv;
27358 }
27359
27360 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone"))) TS_CResult_InvoiceRequestFieldsDecodeErrorZ_clone(uint64_t orig) {
27361         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
27362         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27363         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
27364         return tag_ptr(ret_conv, true);
27365 }
27366
27367 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
27368         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
27369         return ret_conv;
27370 }
27371
27372 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
27373         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
27374         return ret_conv;
27375 }
27376
27377 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
27378         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
27379         COption_NoneZ_free(_res_conv);
27380 }
27381
27382 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
27383         LDKCVec_WitnessZ _res_constr;
27384         _res_constr.datalen = _res->arr_len;
27385         if (_res_constr.datalen > 0)
27386                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
27387         else
27388                 _res_constr.data = NULL;
27389         int8_tArray* _res_vals = (void*) _res->elems;
27390         for (size_t m = 0; m < _res_constr.datalen; m++) {
27391                 int8_tArray _res_conv_12 = _res_vals[m];
27392                 LDKWitness _res_conv_12_ref;
27393                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
27394                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
27395                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
27396                 _res_conv_12_ref.data_is_owned = true;
27397                 _res_constr.data[m] = _res_conv_12_ref;
27398         }
27399         FREE(_res);
27400         CVec_WitnessZ_free(_res_constr);
27401 }
27402
27403 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_some"))) TS_COption_ECDSASignatureZ_some(int8_tArray o) {
27404         LDKECDSASignature o_ref;
27405         CHECK(o->arr_len == 64);
27406         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
27407         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27408         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
27409         uint64_t ret_ref = tag_ptr(ret_copy, true);
27410         return ret_ref;
27411 }
27412
27413 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_none"))) TS_COption_ECDSASignatureZ_none() {
27414         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27415         *ret_copy = COption_ECDSASignatureZ_none();
27416         uint64_t ret_ref = tag_ptr(ret_copy, true);
27417         return ret_ref;
27418 }
27419
27420 void  __attribute__((export_name("TS_COption_ECDSASignatureZ_free"))) TS_COption_ECDSASignatureZ_free(uint64_t _res) {
27421         if (!ptr_is_owned(_res)) return;
27422         void* _res_ptr = untag_ptr(_res);
27423         CHECK_ACCESS(_res_ptr);
27424         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
27425         FREE(untag_ptr(_res));
27426         COption_ECDSASignatureZ_free(_res_conv);
27427 }
27428
27429 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
27430         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27431         *ret_copy = COption_ECDSASignatureZ_clone(arg);
27432         uint64_t ret_ref = tag_ptr(ret_copy, true);
27433         return ret_ref;
27434 }
27435 int64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_clone_ptr"))) TS_COption_ECDSASignatureZ_clone_ptr(uint64_t arg) {
27436         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
27437         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
27438         return ret_conv;
27439 }
27440
27441 uint64_t  __attribute__((export_name("TS_COption_ECDSASignatureZ_clone"))) TS_COption_ECDSASignatureZ_clone(uint64_t orig) {
27442         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
27443         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27444         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
27445         uint64_t ret_ref = tag_ptr(ret_copy, true);
27446         return ret_ref;
27447 }
27448
27449 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
27450         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27451         *ret_copy = COption_i64Z_some(o);
27452         uint64_t ret_ref = tag_ptr(ret_copy, true);
27453         return ret_ref;
27454 }
27455
27456 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
27457         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27458         *ret_copy = COption_i64Z_none();
27459         uint64_t ret_ref = tag_ptr(ret_copy, true);
27460         return ret_ref;
27461 }
27462
27463 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
27464         if (!ptr_is_owned(_res)) return;
27465         void* _res_ptr = untag_ptr(_res);
27466         CHECK_ACCESS(_res_ptr);
27467         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
27468         FREE(untag_ptr(_res));
27469         COption_i64Z_free(_res_conv);
27470 }
27471
27472 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
27473         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27474         *ret_copy = COption_i64Z_clone(arg);
27475         uint64_t ret_ref = tag_ptr(ret_copy, true);
27476         return ret_ref;
27477 }
27478 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
27479         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
27480         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
27481         return ret_conv;
27482 }
27483
27484 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
27485         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
27486         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27487         *ret_copy = COption_i64Z_clone(orig_conv);
27488         uint64_t ret_ref = tag_ptr(ret_copy, true);
27489         return ret_ref;
27490 }
27491
27492 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_ok"))) TS_CResult_SocketAddressDecodeErrorZ_ok(uint64_t o) {
27493         void* o_ptr = untag_ptr(o);
27494         CHECK_ACCESS(o_ptr);
27495         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27496         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27497         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27498         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
27499         return tag_ptr(ret_conv, true);
27500 }
27501
27502 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_err"))) TS_CResult_SocketAddressDecodeErrorZ_err(uint64_t e) {
27503         void* e_ptr = untag_ptr(e);
27504         CHECK_ACCESS(e_ptr);
27505         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27506         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27507         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27508         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
27509         return tag_ptr(ret_conv, true);
27510 }
27511
27512 jboolean  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_is_ok"))) TS_CResult_SocketAddressDecodeErrorZ_is_ok(uint64_t o) {
27513         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
27514         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
27515         return ret_conv;
27516 }
27517
27518 void  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_free"))) TS_CResult_SocketAddressDecodeErrorZ_free(uint64_t _res) {
27519         if (!ptr_is_owned(_res)) return;
27520         void* _res_ptr = untag_ptr(_res);
27521         CHECK_ACCESS(_res_ptr);
27522         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
27523         FREE(untag_ptr(_res));
27524         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
27525 }
27526
27527 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
27528         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27529         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
27530         return tag_ptr(ret_conv, true);
27531 }
27532 int64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone_ptr"))) TS_CResult_SocketAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
27533         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
27534         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
27535         return ret_conv;
27536 }
27537
27538 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressDecodeErrorZ_clone"))) TS_CResult_SocketAddressDecodeErrorZ_clone(uint64_t orig) {
27539         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
27540         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27541         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
27542         return tag_ptr(ret_conv, true);
27543 }
27544
27545 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_ok(uint64_t o) {
27546         void* o_ptr = untag_ptr(o);
27547         CHECK_ACCESS(o_ptr);
27548         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27549         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27550         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27551         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
27552         return tag_ptr(ret_conv, true);
27553 }
27554
27555 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_err"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_err(uint32_t e) {
27556         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_js(e);
27557         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27558         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
27559         return tag_ptr(ret_conv, true);
27560 }
27561
27562 jboolean  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(uint64_t o) {
27563         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
27564         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
27565         return ret_conv;
27566 }
27567
27568 void  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_free"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_free(uint64_t _res) {
27569         if (!ptr_is_owned(_res)) return;
27570         void* _res_ptr = untag_ptr(_res);
27571         CHECK_ACCESS(_res_ptr);
27572         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
27573         FREE(untag_ptr(_res));
27574         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
27575 }
27576
27577 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
27578         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27579         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
27580         return tag_ptr(ret_conv, true);
27581 }
27582 int64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(uint64_t arg) {
27583         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
27584         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
27585         return ret_conv;
27586 }
27587
27588 uint64_t  __attribute__((export_name("TS_CResult_SocketAddressSocketAddressParseErrorZ_clone"))) TS_CResult_SocketAddressSocketAddressParseErrorZ_clone(uint64_t orig) {
27589         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
27590         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27591         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
27592         return tag_ptr(ret_conv, true);
27593 }
27594
27595 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
27596         LDKCVec_UpdateAddHTLCZ _res_constr;
27597         _res_constr.datalen = _res->arr_len;
27598         if (_res_constr.datalen > 0)
27599                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27600         else
27601                 _res_constr.data = NULL;
27602         uint64_t* _res_vals = _res->elems;
27603         for (size_t p = 0; p < _res_constr.datalen; p++) {
27604                 uint64_t _res_conv_15 = _res_vals[p];
27605                 LDKUpdateAddHTLC _res_conv_15_conv;
27606                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
27607                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
27608                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
27609                 _res_constr.data[p] = _res_conv_15_conv;
27610         }
27611         FREE(_res);
27612         CVec_UpdateAddHTLCZ_free(_res_constr);
27613 }
27614
27615 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
27616         LDKCVec_UpdateFulfillHTLCZ _res_constr;
27617         _res_constr.datalen = _res->arr_len;
27618         if (_res_constr.datalen > 0)
27619                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27620         else
27621                 _res_constr.data = NULL;
27622         uint64_t* _res_vals = _res->elems;
27623         for (size_t t = 0; t < _res_constr.datalen; t++) {
27624                 uint64_t _res_conv_19 = _res_vals[t];
27625                 LDKUpdateFulfillHTLC _res_conv_19_conv;
27626                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
27627                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
27628                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
27629                 _res_constr.data[t] = _res_conv_19_conv;
27630         }
27631         FREE(_res);
27632         CVec_UpdateFulfillHTLCZ_free(_res_constr);
27633 }
27634
27635 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
27636         LDKCVec_UpdateFailHTLCZ _res_constr;
27637         _res_constr.datalen = _res->arr_len;
27638         if (_res_constr.datalen > 0)
27639                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27640         else
27641                 _res_constr.data = NULL;
27642         uint64_t* _res_vals = _res->elems;
27643         for (size_t q = 0; q < _res_constr.datalen; q++) {
27644                 uint64_t _res_conv_16 = _res_vals[q];
27645                 LDKUpdateFailHTLC _res_conv_16_conv;
27646                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
27647                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
27648                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
27649                 _res_constr.data[q] = _res_conv_16_conv;
27650         }
27651         FREE(_res);
27652         CVec_UpdateFailHTLCZ_free(_res_constr);
27653 }
27654
27655 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
27656         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
27657         _res_constr.datalen = _res->arr_len;
27658         if (_res_constr.datalen > 0)
27659                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27660         else
27661                 _res_constr.data = NULL;
27662         uint64_t* _res_vals = _res->elems;
27663         for (size_t z = 0; z < _res_constr.datalen; z++) {
27664                 uint64_t _res_conv_25 = _res_vals[z];
27665                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
27666                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
27667                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
27668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
27669                 _res_constr.data[z] = _res_conv_25_conv;
27670         }
27671         FREE(_res);
27672         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
27673 }
27674
27675 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
27676         LDKAcceptChannel o_conv;
27677         o_conv.inner = untag_ptr(o);
27678         o_conv.is_owned = ptr_is_owned(o);
27679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27680         o_conv = AcceptChannel_clone(&o_conv);
27681         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27682         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
27683         return tag_ptr(ret_conv, true);
27684 }
27685
27686 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
27687         void* e_ptr = untag_ptr(e);
27688         CHECK_ACCESS(e_ptr);
27689         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27690         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27691         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27692         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
27693         return tag_ptr(ret_conv, true);
27694 }
27695
27696 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
27697         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
27698         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
27699         return ret_conv;
27700 }
27701
27702 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
27703         if (!ptr_is_owned(_res)) return;
27704         void* _res_ptr = untag_ptr(_res);
27705         CHECK_ACCESS(_res_ptr);
27706         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
27707         FREE(untag_ptr(_res));
27708         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
27709 }
27710
27711 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
27712         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27713         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
27714         return tag_ptr(ret_conv, true);
27715 }
27716 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
27717         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
27718         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
27719         return ret_conv;
27720 }
27721
27722 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
27723         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
27724         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27725         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
27726         return tag_ptr(ret_conv, true);
27727 }
27728
27729 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
27730         LDKAcceptChannelV2 o_conv;
27731         o_conv.inner = untag_ptr(o);
27732         o_conv.is_owned = ptr_is_owned(o);
27733         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27734         o_conv = AcceptChannelV2_clone(&o_conv);
27735         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27736         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
27737         return tag_ptr(ret_conv, true);
27738 }
27739
27740 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
27741         void* e_ptr = untag_ptr(e);
27742         CHECK_ACCESS(e_ptr);
27743         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27744         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27745         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27746         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
27747         return tag_ptr(ret_conv, true);
27748 }
27749
27750 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
27751         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
27752         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
27753         return ret_conv;
27754 }
27755
27756 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
27757         if (!ptr_is_owned(_res)) return;
27758         void* _res_ptr = untag_ptr(_res);
27759         CHECK_ACCESS(_res_ptr);
27760         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
27761         FREE(untag_ptr(_res));
27762         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
27763 }
27764
27765 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
27766         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27767         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
27768         return tag_ptr(ret_conv, true);
27769 }
27770 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
27771         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
27772         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
27773         return ret_conv;
27774 }
27775
27776 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
27777         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
27778         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27779         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
27780         return tag_ptr(ret_conv, true);
27781 }
27782
27783 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_ok"))) TS_CResult_StfuDecodeErrorZ_ok(uint64_t o) {
27784         LDKStfu o_conv;
27785         o_conv.inner = untag_ptr(o);
27786         o_conv.is_owned = ptr_is_owned(o);
27787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27788         o_conv = Stfu_clone(&o_conv);
27789         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27790         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
27791         return tag_ptr(ret_conv, true);
27792 }
27793
27794 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_err"))) TS_CResult_StfuDecodeErrorZ_err(uint64_t e) {
27795         void* e_ptr = untag_ptr(e);
27796         CHECK_ACCESS(e_ptr);
27797         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27798         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27799         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27800         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
27801         return tag_ptr(ret_conv, true);
27802 }
27803
27804 jboolean  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_is_ok"))) TS_CResult_StfuDecodeErrorZ_is_ok(uint64_t o) {
27805         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
27806         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
27807         return ret_conv;
27808 }
27809
27810 void  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_free"))) TS_CResult_StfuDecodeErrorZ_free(uint64_t _res) {
27811         if (!ptr_is_owned(_res)) return;
27812         void* _res_ptr = untag_ptr(_res);
27813         CHECK_ACCESS(_res_ptr);
27814         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
27815         FREE(untag_ptr(_res));
27816         CResult_StfuDecodeErrorZ_free(_res_conv);
27817 }
27818
27819 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
27820         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27821         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
27822         return tag_ptr(ret_conv, true);
27823 }
27824 int64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone_ptr"))) TS_CResult_StfuDecodeErrorZ_clone_ptr(uint64_t arg) {
27825         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
27826         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
27827         return ret_conv;
27828 }
27829
27830 uint64_t  __attribute__((export_name("TS_CResult_StfuDecodeErrorZ_clone"))) TS_CResult_StfuDecodeErrorZ_clone(uint64_t orig) {
27831         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
27832         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
27833         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
27834         return tag_ptr(ret_conv, true);
27835 }
27836
27837 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_ok"))) TS_CResult_SpliceDecodeErrorZ_ok(uint64_t o) {
27838         LDKSplice o_conv;
27839         o_conv.inner = untag_ptr(o);
27840         o_conv.is_owned = ptr_is_owned(o);
27841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27842         o_conv = Splice_clone(&o_conv);
27843         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27844         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
27845         return tag_ptr(ret_conv, true);
27846 }
27847
27848 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_err"))) TS_CResult_SpliceDecodeErrorZ_err(uint64_t e) {
27849         void* e_ptr = untag_ptr(e);
27850         CHECK_ACCESS(e_ptr);
27851         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27852         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27853         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27854         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
27855         return tag_ptr(ret_conv, true);
27856 }
27857
27858 jboolean  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_is_ok"))) TS_CResult_SpliceDecodeErrorZ_is_ok(uint64_t o) {
27859         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
27860         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
27861         return ret_conv;
27862 }
27863
27864 void  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_free"))) TS_CResult_SpliceDecodeErrorZ_free(uint64_t _res) {
27865         if (!ptr_is_owned(_res)) return;
27866         void* _res_ptr = untag_ptr(_res);
27867         CHECK_ACCESS(_res_ptr);
27868         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
27869         FREE(untag_ptr(_res));
27870         CResult_SpliceDecodeErrorZ_free(_res_conv);
27871 }
27872
27873 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
27874         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27875         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
27876         return tag_ptr(ret_conv, true);
27877 }
27878 int64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceDecodeErrorZ_clone_ptr(uint64_t arg) {
27879         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
27880         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
27881         return ret_conv;
27882 }
27883
27884 uint64_t  __attribute__((export_name("TS_CResult_SpliceDecodeErrorZ_clone"))) TS_CResult_SpliceDecodeErrorZ_clone(uint64_t orig) {
27885         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
27886         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
27887         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
27888         return tag_ptr(ret_conv, true);
27889 }
27890
27891 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_ok"))) TS_CResult_SpliceAckDecodeErrorZ_ok(uint64_t o) {
27892         LDKSpliceAck o_conv;
27893         o_conv.inner = untag_ptr(o);
27894         o_conv.is_owned = ptr_is_owned(o);
27895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27896         o_conv = SpliceAck_clone(&o_conv);
27897         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27898         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
27899         return tag_ptr(ret_conv, true);
27900 }
27901
27902 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_err"))) TS_CResult_SpliceAckDecodeErrorZ_err(uint64_t e) {
27903         void* e_ptr = untag_ptr(e);
27904         CHECK_ACCESS(e_ptr);
27905         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27906         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27907         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27908         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
27909         return tag_ptr(ret_conv, true);
27910 }
27911
27912 jboolean  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_is_ok"))) TS_CResult_SpliceAckDecodeErrorZ_is_ok(uint64_t o) {
27913         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
27914         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
27915         return ret_conv;
27916 }
27917
27918 void  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_free"))) TS_CResult_SpliceAckDecodeErrorZ_free(uint64_t _res) {
27919         if (!ptr_is_owned(_res)) return;
27920         void* _res_ptr = untag_ptr(_res);
27921         CHECK_ACCESS(_res_ptr);
27922         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
27923         FREE(untag_ptr(_res));
27924         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
27925 }
27926
27927 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
27928         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27929         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
27930         return tag_ptr(ret_conv, true);
27931 }
27932 int64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceAckDecodeErrorZ_clone_ptr(uint64_t arg) {
27933         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
27934         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
27935         return ret_conv;
27936 }
27937
27938 uint64_t  __attribute__((export_name("TS_CResult_SpliceAckDecodeErrorZ_clone"))) TS_CResult_SpliceAckDecodeErrorZ_clone(uint64_t orig) {
27939         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
27940         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
27941         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
27942         return tag_ptr(ret_conv, true);
27943 }
27944
27945 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_ok(uint64_t o) {
27946         LDKSpliceLocked o_conv;
27947         o_conv.inner = untag_ptr(o);
27948         o_conv.is_owned = ptr_is_owned(o);
27949         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27950         o_conv = SpliceLocked_clone(&o_conv);
27951         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
27952         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
27953         return tag_ptr(ret_conv, true);
27954 }
27955
27956 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_err"))) TS_CResult_SpliceLockedDecodeErrorZ_err(uint64_t e) {
27957         void* e_ptr = untag_ptr(e);
27958         CHECK_ACCESS(e_ptr);
27959         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27960         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27961         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
27962         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
27963         return tag_ptr(ret_conv, true);
27964 }
27965
27966 jboolean  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_is_ok"))) TS_CResult_SpliceLockedDecodeErrorZ_is_ok(uint64_t o) {
27967         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
27968         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
27969         return ret_conv;
27970 }
27971
27972 void  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_free"))) TS_CResult_SpliceLockedDecodeErrorZ_free(uint64_t _res) {
27973         if (!ptr_is_owned(_res)) return;
27974         void* _res_ptr = untag_ptr(_res);
27975         CHECK_ACCESS(_res_ptr);
27976         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
27977         FREE(untag_ptr(_res));
27978         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
27979 }
27980
27981 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
27982         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
27983         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
27984         return tag_ptr(ret_conv, true);
27985 }
27986 int64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr"))) TS_CResult_SpliceLockedDecodeErrorZ_clone_ptr(uint64_t arg) {
27987         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
27988         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
27989         return ret_conv;
27990 }
27991
27992 uint64_t  __attribute__((export_name("TS_CResult_SpliceLockedDecodeErrorZ_clone"))) TS_CResult_SpliceLockedDecodeErrorZ_clone(uint64_t orig) {
27993         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
27994         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
27995         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
27996         return tag_ptr(ret_conv, true);
27997 }
27998
27999 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
28000         LDKTxAddInput o_conv;
28001         o_conv.inner = untag_ptr(o);
28002         o_conv.is_owned = ptr_is_owned(o);
28003         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28004         o_conv = TxAddInput_clone(&o_conv);
28005         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28006         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28007         return tag_ptr(ret_conv, true);
28008 }
28009
28010 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
28011         void* e_ptr = untag_ptr(e);
28012         CHECK_ACCESS(e_ptr);
28013         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28014         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28015         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28016         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28017         return tag_ptr(ret_conv, true);
28018 }
28019
28020 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
28021         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28022         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28023         return ret_conv;
28024 }
28025
28026 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
28027         if (!ptr_is_owned(_res)) return;
28028         void* _res_ptr = untag_ptr(_res);
28029         CHECK_ACCESS(_res_ptr);
28030         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28031         FREE(untag_ptr(_res));
28032         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28033 }
28034
28035 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28036         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28037         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28038         return tag_ptr(ret_conv, true);
28039 }
28040 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
28041         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28042         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28043         return ret_conv;
28044 }
28045
28046 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
28047         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28048         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28049         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28050         return tag_ptr(ret_conv, true);
28051 }
28052
28053 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
28054         LDKTxAddOutput o_conv;
28055         o_conv.inner = untag_ptr(o);
28056         o_conv.is_owned = ptr_is_owned(o);
28057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28058         o_conv = TxAddOutput_clone(&o_conv);
28059         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28060         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28061         return tag_ptr(ret_conv, true);
28062 }
28063
28064 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
28065         void* e_ptr = untag_ptr(e);
28066         CHECK_ACCESS(e_ptr);
28067         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28068         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28069         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28070         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28071         return tag_ptr(ret_conv, true);
28072 }
28073
28074 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
28075         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28076         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28077         return ret_conv;
28078 }
28079
28080 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
28081         if (!ptr_is_owned(_res)) return;
28082         void* _res_ptr = untag_ptr(_res);
28083         CHECK_ACCESS(_res_ptr);
28084         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28085         FREE(untag_ptr(_res));
28086         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28087 }
28088
28089 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28090         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28091         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28092         return tag_ptr(ret_conv, true);
28093 }
28094 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
28095         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28096         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28097         return ret_conv;
28098 }
28099
28100 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
28101         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28102         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28103         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28104         return tag_ptr(ret_conv, true);
28105 }
28106
28107 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
28108         LDKTxRemoveInput o_conv;
28109         o_conv.inner = untag_ptr(o);
28110         o_conv.is_owned = ptr_is_owned(o);
28111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28112         o_conv = TxRemoveInput_clone(&o_conv);
28113         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28114         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28115         return tag_ptr(ret_conv, true);
28116 }
28117
28118 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
28119         void* e_ptr = untag_ptr(e);
28120         CHECK_ACCESS(e_ptr);
28121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28123         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28124         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28125         return tag_ptr(ret_conv, true);
28126 }
28127
28128 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
28129         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28130         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28131         return ret_conv;
28132 }
28133
28134 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
28135         if (!ptr_is_owned(_res)) return;
28136         void* _res_ptr = untag_ptr(_res);
28137         CHECK_ACCESS(_res_ptr);
28138         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28139         FREE(untag_ptr(_res));
28140         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28141 }
28142
28143 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28144         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28145         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28146         return tag_ptr(ret_conv, true);
28147 }
28148 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
28149         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28150         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28151         return ret_conv;
28152 }
28153
28154 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
28155         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28156         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28157         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28158         return tag_ptr(ret_conv, true);
28159 }
28160
28161 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
28162         LDKTxRemoveOutput o_conv;
28163         o_conv.inner = untag_ptr(o);
28164         o_conv.is_owned = ptr_is_owned(o);
28165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28166         o_conv = TxRemoveOutput_clone(&o_conv);
28167         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28168         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28169         return tag_ptr(ret_conv, true);
28170 }
28171
28172 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
28173         void* e_ptr = untag_ptr(e);
28174         CHECK_ACCESS(e_ptr);
28175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28177         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28178         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28179         return tag_ptr(ret_conv, true);
28180 }
28181
28182 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
28183         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28184         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28185         return ret_conv;
28186 }
28187
28188 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
28189         if (!ptr_is_owned(_res)) return;
28190         void* _res_ptr = untag_ptr(_res);
28191         CHECK_ACCESS(_res_ptr);
28192         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28193         FREE(untag_ptr(_res));
28194         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28195 }
28196
28197 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28198         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28199         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28200         return tag_ptr(ret_conv, true);
28201 }
28202 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
28203         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28204         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28205         return ret_conv;
28206 }
28207
28208 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
28209         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28210         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28211         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28212         return tag_ptr(ret_conv, true);
28213 }
28214
28215 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
28216         LDKTxComplete o_conv;
28217         o_conv.inner = untag_ptr(o);
28218         o_conv.is_owned = ptr_is_owned(o);
28219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28220         o_conv = TxComplete_clone(&o_conv);
28221         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28222         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28223         return tag_ptr(ret_conv, true);
28224 }
28225
28226 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
28227         void* e_ptr = untag_ptr(e);
28228         CHECK_ACCESS(e_ptr);
28229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28231         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28232         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28233         return tag_ptr(ret_conv, true);
28234 }
28235
28236 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
28237         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28238         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28239         return ret_conv;
28240 }
28241
28242 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
28243         if (!ptr_is_owned(_res)) return;
28244         void* _res_ptr = untag_ptr(_res);
28245         CHECK_ACCESS(_res_ptr);
28246         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28247         FREE(untag_ptr(_res));
28248         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28249 }
28250
28251 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28252         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28253         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28254         return tag_ptr(ret_conv, true);
28255 }
28256 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
28257         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28258         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28259         return ret_conv;
28260 }
28261
28262 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
28263         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28264         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28265         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28266         return tag_ptr(ret_conv, true);
28267 }
28268
28269 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
28270         LDKTxSignatures o_conv;
28271         o_conv.inner = untag_ptr(o);
28272         o_conv.is_owned = ptr_is_owned(o);
28273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28274         o_conv = TxSignatures_clone(&o_conv);
28275         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28276         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28277         return tag_ptr(ret_conv, true);
28278 }
28279
28280 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
28281         void* e_ptr = untag_ptr(e);
28282         CHECK_ACCESS(e_ptr);
28283         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28284         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28285         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28286         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28287         return tag_ptr(ret_conv, true);
28288 }
28289
28290 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
28291         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28292         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28293         return ret_conv;
28294 }
28295
28296 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
28297         if (!ptr_is_owned(_res)) return;
28298         void* _res_ptr = untag_ptr(_res);
28299         CHECK_ACCESS(_res_ptr);
28300         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28301         FREE(untag_ptr(_res));
28302         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28303 }
28304
28305 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28306         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28307         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28308         return tag_ptr(ret_conv, true);
28309 }
28310 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
28311         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28312         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28313         return ret_conv;
28314 }
28315
28316 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
28317         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28318         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28319         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28320         return tag_ptr(ret_conv, true);
28321 }
28322
28323 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
28324         LDKTxInitRbf o_conv;
28325         o_conv.inner = untag_ptr(o);
28326         o_conv.is_owned = ptr_is_owned(o);
28327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28328         o_conv = TxInitRbf_clone(&o_conv);
28329         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28330         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28331         return tag_ptr(ret_conv, true);
28332 }
28333
28334 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
28335         void* e_ptr = untag_ptr(e);
28336         CHECK_ACCESS(e_ptr);
28337         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28338         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28339         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28340         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28341         return tag_ptr(ret_conv, true);
28342 }
28343
28344 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
28345         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28346         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28347         return ret_conv;
28348 }
28349
28350 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
28351         if (!ptr_is_owned(_res)) return;
28352         void* _res_ptr = untag_ptr(_res);
28353         CHECK_ACCESS(_res_ptr);
28354         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28355         FREE(untag_ptr(_res));
28356         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28357 }
28358
28359 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28360         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28361         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28362         return tag_ptr(ret_conv, true);
28363 }
28364 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
28365         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28366         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28367         return ret_conv;
28368 }
28369
28370 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
28371         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28372         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28373         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28374         return tag_ptr(ret_conv, true);
28375 }
28376
28377 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
28378         LDKTxAckRbf o_conv;
28379         o_conv.inner = untag_ptr(o);
28380         o_conv.is_owned = ptr_is_owned(o);
28381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28382         o_conv = TxAckRbf_clone(&o_conv);
28383         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28384         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28385         return tag_ptr(ret_conv, true);
28386 }
28387
28388 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
28389         void* e_ptr = untag_ptr(e);
28390         CHECK_ACCESS(e_ptr);
28391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28393         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28394         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28395         return tag_ptr(ret_conv, true);
28396 }
28397
28398 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
28399         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28400         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28401         return ret_conv;
28402 }
28403
28404 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
28405         if (!ptr_is_owned(_res)) return;
28406         void* _res_ptr = untag_ptr(_res);
28407         CHECK_ACCESS(_res_ptr);
28408         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28409         FREE(untag_ptr(_res));
28410         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28411 }
28412
28413 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
28414         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28415         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
28416         return tag_ptr(ret_conv, true);
28417 }
28418 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
28419         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
28420         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
28421         return ret_conv;
28422 }
28423
28424 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
28425         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
28426         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28427         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
28428         return tag_ptr(ret_conv, true);
28429 }
28430
28431 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
28432         LDKTxAbort o_conv;
28433         o_conv.inner = untag_ptr(o);
28434         o_conv.is_owned = ptr_is_owned(o);
28435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28436         o_conv = TxAbort_clone(&o_conv);
28437         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28438         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
28439         return tag_ptr(ret_conv, true);
28440 }
28441
28442 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
28443         void* e_ptr = untag_ptr(e);
28444         CHECK_ACCESS(e_ptr);
28445         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28446         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28447         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28448         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
28449         return tag_ptr(ret_conv, true);
28450 }
28451
28452 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
28453         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
28454         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
28455         return ret_conv;
28456 }
28457
28458 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
28459         if (!ptr_is_owned(_res)) return;
28460         void* _res_ptr = untag_ptr(_res);
28461         CHECK_ACCESS(_res_ptr);
28462         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
28463         FREE(untag_ptr(_res));
28464         CResult_TxAbortDecodeErrorZ_free(_res_conv);
28465 }
28466
28467 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
28468         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28469         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
28470         return tag_ptr(ret_conv, true);
28471 }
28472 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
28473         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
28474         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
28475         return ret_conv;
28476 }
28477
28478 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
28479         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
28480         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28481         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
28482         return tag_ptr(ret_conv, true);
28483 }
28484
28485 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
28486         LDKAnnouncementSignatures o_conv;
28487         o_conv.inner = untag_ptr(o);
28488         o_conv.is_owned = ptr_is_owned(o);
28489         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28490         o_conv = AnnouncementSignatures_clone(&o_conv);
28491         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28492         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
28493         return tag_ptr(ret_conv, true);
28494 }
28495
28496 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
28497         void* e_ptr = untag_ptr(e);
28498         CHECK_ACCESS(e_ptr);
28499         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28500         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28501         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28502         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
28503         return tag_ptr(ret_conv, true);
28504 }
28505
28506 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
28507         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
28508         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
28509         return ret_conv;
28510 }
28511
28512 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
28513         if (!ptr_is_owned(_res)) return;
28514         void* _res_ptr = untag_ptr(_res);
28515         CHECK_ACCESS(_res_ptr);
28516         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
28517         FREE(untag_ptr(_res));
28518         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
28519 }
28520
28521 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28522         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28523         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
28524         return tag_ptr(ret_conv, true);
28525 }
28526 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
28527         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
28528         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28529         return ret_conv;
28530 }
28531
28532 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
28533         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
28534         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28535         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
28536         return tag_ptr(ret_conv, true);
28537 }
28538
28539 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
28540         LDKChannelReestablish o_conv;
28541         o_conv.inner = untag_ptr(o);
28542         o_conv.is_owned = ptr_is_owned(o);
28543         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28544         o_conv = ChannelReestablish_clone(&o_conv);
28545         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28546         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
28547         return tag_ptr(ret_conv, true);
28548 }
28549
28550 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
28551         void* e_ptr = untag_ptr(e);
28552         CHECK_ACCESS(e_ptr);
28553         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28554         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28555         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28556         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
28557         return tag_ptr(ret_conv, true);
28558 }
28559
28560 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
28561         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
28562         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
28563         return ret_conv;
28564 }
28565
28566 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
28567         if (!ptr_is_owned(_res)) return;
28568         void* _res_ptr = untag_ptr(_res);
28569         CHECK_ACCESS(_res_ptr);
28570         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
28571         FREE(untag_ptr(_res));
28572         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
28573 }
28574
28575 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
28576         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28577         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
28578         return tag_ptr(ret_conv, true);
28579 }
28580 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
28581         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
28582         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
28583         return ret_conv;
28584 }
28585
28586 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
28587         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
28588         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28589         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
28590         return tag_ptr(ret_conv, true);
28591 }
28592
28593 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
28594         LDKClosingSigned o_conv;
28595         o_conv.inner = untag_ptr(o);
28596         o_conv.is_owned = ptr_is_owned(o);
28597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28598         o_conv = ClosingSigned_clone(&o_conv);
28599         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28600         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
28601         return tag_ptr(ret_conv, true);
28602 }
28603
28604 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
28605         void* e_ptr = untag_ptr(e);
28606         CHECK_ACCESS(e_ptr);
28607         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28608         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28609         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28610         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
28611         return tag_ptr(ret_conv, true);
28612 }
28613
28614 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
28615         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
28616         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
28617         return ret_conv;
28618 }
28619
28620 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
28621         if (!ptr_is_owned(_res)) return;
28622         void* _res_ptr = untag_ptr(_res);
28623         CHECK_ACCESS(_res_ptr);
28624         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
28625         FREE(untag_ptr(_res));
28626         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
28627 }
28628
28629 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
28630         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28631         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
28632         return tag_ptr(ret_conv, true);
28633 }
28634 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28635         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
28636         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
28637         return ret_conv;
28638 }
28639
28640 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
28641         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
28642         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28643         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
28644         return tag_ptr(ret_conv, true);
28645 }
28646
28647 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
28648         LDKClosingSignedFeeRange o_conv;
28649         o_conv.inner = untag_ptr(o);
28650         o_conv.is_owned = ptr_is_owned(o);
28651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28652         o_conv = ClosingSignedFeeRange_clone(&o_conv);
28653         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28654         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
28655         return tag_ptr(ret_conv, true);
28656 }
28657
28658 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
28659         void* e_ptr = untag_ptr(e);
28660         CHECK_ACCESS(e_ptr);
28661         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28662         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28663         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28664         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
28665         return tag_ptr(ret_conv, true);
28666 }
28667
28668 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
28669         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
28670         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
28671         return ret_conv;
28672 }
28673
28674 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
28675         if (!ptr_is_owned(_res)) return;
28676         void* _res_ptr = untag_ptr(_res);
28677         CHECK_ACCESS(_res_ptr);
28678         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
28679         FREE(untag_ptr(_res));
28680         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
28681 }
28682
28683 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
28684         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28685         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
28686         return tag_ptr(ret_conv, true);
28687 }
28688 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
28689         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
28690         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
28691         return ret_conv;
28692 }
28693
28694 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
28695         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
28696         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28697         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
28698         return tag_ptr(ret_conv, true);
28699 }
28700
28701 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
28702         LDKCommitmentSigned o_conv;
28703         o_conv.inner = untag_ptr(o);
28704         o_conv.is_owned = ptr_is_owned(o);
28705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28706         o_conv = CommitmentSigned_clone(&o_conv);
28707         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28708         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
28709         return tag_ptr(ret_conv, true);
28710 }
28711
28712 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
28713         void* e_ptr = untag_ptr(e);
28714         CHECK_ACCESS(e_ptr);
28715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28717         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28718         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
28719         return tag_ptr(ret_conv, true);
28720 }
28721
28722 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
28723         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
28724         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
28725         return ret_conv;
28726 }
28727
28728 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
28729         if (!ptr_is_owned(_res)) return;
28730         void* _res_ptr = untag_ptr(_res);
28731         CHECK_ACCESS(_res_ptr);
28732         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
28733         FREE(untag_ptr(_res));
28734         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
28735 }
28736
28737 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
28738         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28739         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
28740         return tag_ptr(ret_conv, true);
28741 }
28742 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28743         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
28744         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
28745         return ret_conv;
28746 }
28747
28748 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
28749         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
28750         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28751         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
28752         return tag_ptr(ret_conv, true);
28753 }
28754
28755 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
28756         LDKFundingCreated o_conv;
28757         o_conv.inner = untag_ptr(o);
28758         o_conv.is_owned = ptr_is_owned(o);
28759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28760         o_conv = FundingCreated_clone(&o_conv);
28761         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28762         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
28763         return tag_ptr(ret_conv, true);
28764 }
28765
28766 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
28767         void* e_ptr = untag_ptr(e);
28768         CHECK_ACCESS(e_ptr);
28769         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28770         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28771         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28772         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
28773         return tag_ptr(ret_conv, true);
28774 }
28775
28776 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
28777         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
28778         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
28779         return ret_conv;
28780 }
28781
28782 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
28783         if (!ptr_is_owned(_res)) return;
28784         void* _res_ptr = untag_ptr(_res);
28785         CHECK_ACCESS(_res_ptr);
28786         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
28787         FREE(untag_ptr(_res));
28788         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
28789 }
28790
28791 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
28792         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28793         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
28794         return tag_ptr(ret_conv, true);
28795 }
28796 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
28797         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
28798         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
28799         return ret_conv;
28800 }
28801
28802 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
28803         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
28804         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
28805         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
28806         return tag_ptr(ret_conv, true);
28807 }
28808
28809 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
28810         LDKFundingSigned o_conv;
28811         o_conv.inner = untag_ptr(o);
28812         o_conv.is_owned = ptr_is_owned(o);
28813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28814         o_conv = FundingSigned_clone(&o_conv);
28815         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28816         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
28817         return tag_ptr(ret_conv, true);
28818 }
28819
28820 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
28821         void* e_ptr = untag_ptr(e);
28822         CHECK_ACCESS(e_ptr);
28823         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28824         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28825         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28826         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
28827         return tag_ptr(ret_conv, true);
28828 }
28829
28830 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
28831         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
28832         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
28833         return ret_conv;
28834 }
28835
28836 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
28837         if (!ptr_is_owned(_res)) return;
28838         void* _res_ptr = untag_ptr(_res);
28839         CHECK_ACCESS(_res_ptr);
28840         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
28841         FREE(untag_ptr(_res));
28842         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
28843 }
28844
28845 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
28846         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28847         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
28848         return tag_ptr(ret_conv, true);
28849 }
28850 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
28851         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
28852         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
28853         return ret_conv;
28854 }
28855
28856 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
28857         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
28858         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
28859         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
28860         return tag_ptr(ret_conv, true);
28861 }
28862
28863 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
28864         LDKChannelReady o_conv;
28865         o_conv.inner = untag_ptr(o);
28866         o_conv.is_owned = ptr_is_owned(o);
28867         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28868         o_conv = ChannelReady_clone(&o_conv);
28869         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28870         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
28871         return tag_ptr(ret_conv, true);
28872 }
28873
28874 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
28875         void* e_ptr = untag_ptr(e);
28876         CHECK_ACCESS(e_ptr);
28877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28879         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28880         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
28881         return tag_ptr(ret_conv, true);
28882 }
28883
28884 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
28885         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
28886         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
28887         return ret_conv;
28888 }
28889
28890 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
28891         if (!ptr_is_owned(_res)) return;
28892         void* _res_ptr = untag_ptr(_res);
28893         CHECK_ACCESS(_res_ptr);
28894         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
28895         FREE(untag_ptr(_res));
28896         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
28897 }
28898
28899 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
28900         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28901         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
28902         return tag_ptr(ret_conv, true);
28903 }
28904 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
28905         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
28906         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
28907         return ret_conv;
28908 }
28909
28910 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
28911         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
28912         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28913         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
28914         return tag_ptr(ret_conv, true);
28915 }
28916
28917 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
28918         LDKInit o_conv;
28919         o_conv.inner = untag_ptr(o);
28920         o_conv.is_owned = ptr_is_owned(o);
28921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28922         o_conv = Init_clone(&o_conv);
28923         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28924         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
28925         return tag_ptr(ret_conv, true);
28926 }
28927
28928 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
28929         void* e_ptr = untag_ptr(e);
28930         CHECK_ACCESS(e_ptr);
28931         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28932         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28933         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28934         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
28935         return tag_ptr(ret_conv, true);
28936 }
28937
28938 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
28939         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
28940         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
28941         return ret_conv;
28942 }
28943
28944 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
28945         if (!ptr_is_owned(_res)) return;
28946         void* _res_ptr = untag_ptr(_res);
28947         CHECK_ACCESS(_res_ptr);
28948         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
28949         FREE(untag_ptr(_res));
28950         CResult_InitDecodeErrorZ_free(_res_conv);
28951 }
28952
28953 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
28954         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28955         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
28956         return tag_ptr(ret_conv, true);
28957 }
28958 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
28959         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
28960         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
28961         return ret_conv;
28962 }
28963
28964 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
28965         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
28966         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28967         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
28968         return tag_ptr(ret_conv, true);
28969 }
28970
28971 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
28972         LDKOpenChannel o_conv;
28973         o_conv.inner = untag_ptr(o);
28974         o_conv.is_owned = ptr_is_owned(o);
28975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28976         o_conv = OpenChannel_clone(&o_conv);
28977         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28978         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
28979         return tag_ptr(ret_conv, true);
28980 }
28981
28982 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
28983         void* e_ptr = untag_ptr(e);
28984         CHECK_ACCESS(e_ptr);
28985         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28986         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28987         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28988         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
28989         return tag_ptr(ret_conv, true);
28990 }
28991
28992 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
28993         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
28994         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
28995         return ret_conv;
28996 }
28997
28998 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
28999         if (!ptr_is_owned(_res)) return;
29000         void* _res_ptr = untag_ptr(_res);
29001         CHECK_ACCESS(_res_ptr);
29002         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29003         FREE(untag_ptr(_res));
29004         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29005 }
29006
29007 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29008         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29009         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29010         return tag_ptr(ret_conv, true);
29011 }
29012 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
29013         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29014         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29015         return ret_conv;
29016 }
29017
29018 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
29019         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29020         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29021         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29022         return tag_ptr(ret_conv, true);
29023 }
29024
29025 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
29026         LDKOpenChannelV2 o_conv;
29027         o_conv.inner = untag_ptr(o);
29028         o_conv.is_owned = ptr_is_owned(o);
29029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29030         o_conv = OpenChannelV2_clone(&o_conv);
29031         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29032         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29033         return tag_ptr(ret_conv, true);
29034 }
29035
29036 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
29037         void* e_ptr = untag_ptr(e);
29038         CHECK_ACCESS(e_ptr);
29039         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29040         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29041         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29042         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29043         return tag_ptr(ret_conv, true);
29044 }
29045
29046 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
29047         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29048         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29049         return ret_conv;
29050 }
29051
29052 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
29053         if (!ptr_is_owned(_res)) return;
29054         void* _res_ptr = untag_ptr(_res);
29055         CHECK_ACCESS(_res_ptr);
29056         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29057         FREE(untag_ptr(_res));
29058         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29059 }
29060
29061 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29062         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29063         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29064         return tag_ptr(ret_conv, true);
29065 }
29066 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
29067         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29068         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29069         return ret_conv;
29070 }
29071
29072 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
29073         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29074         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29075         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29076         return tag_ptr(ret_conv, true);
29077 }
29078
29079 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
29080         LDKRevokeAndACK o_conv;
29081         o_conv.inner = untag_ptr(o);
29082         o_conv.is_owned = ptr_is_owned(o);
29083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29084         o_conv = RevokeAndACK_clone(&o_conv);
29085         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29086         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29087         return tag_ptr(ret_conv, true);
29088 }
29089
29090 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
29091         void* e_ptr = untag_ptr(e);
29092         CHECK_ACCESS(e_ptr);
29093         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29094         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29095         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29096         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29097         return tag_ptr(ret_conv, true);
29098 }
29099
29100 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
29101         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29102         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29103         return ret_conv;
29104 }
29105
29106 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
29107         if (!ptr_is_owned(_res)) return;
29108         void* _res_ptr = untag_ptr(_res);
29109         CHECK_ACCESS(_res_ptr);
29110         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29111         FREE(untag_ptr(_res));
29112         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29113 }
29114
29115 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29116         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29117         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29118         return tag_ptr(ret_conv, true);
29119 }
29120 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
29121         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29122         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29123         return ret_conv;
29124 }
29125
29126 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
29127         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29128         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29129         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29130         return tag_ptr(ret_conv, true);
29131 }
29132
29133 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
29134         LDKShutdown o_conv;
29135         o_conv.inner = untag_ptr(o);
29136         o_conv.is_owned = ptr_is_owned(o);
29137         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29138         o_conv = Shutdown_clone(&o_conv);
29139         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29140         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29141         return tag_ptr(ret_conv, true);
29142 }
29143
29144 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
29145         void* e_ptr = untag_ptr(e);
29146         CHECK_ACCESS(e_ptr);
29147         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29148         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29149         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29150         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29151         return tag_ptr(ret_conv, true);
29152 }
29153
29154 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
29155         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29156         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29157         return ret_conv;
29158 }
29159
29160 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
29161         if (!ptr_is_owned(_res)) return;
29162         void* _res_ptr = untag_ptr(_res);
29163         CHECK_ACCESS(_res_ptr);
29164         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29165         FREE(untag_ptr(_res));
29166         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29167 }
29168
29169 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29170         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29171         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29172         return tag_ptr(ret_conv, true);
29173 }
29174 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
29175         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29176         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29177         return ret_conv;
29178 }
29179
29180 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
29181         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29182         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29183         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29184         return tag_ptr(ret_conv, true);
29185 }
29186
29187 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
29188         LDKUpdateFailHTLC o_conv;
29189         o_conv.inner = untag_ptr(o);
29190         o_conv.is_owned = ptr_is_owned(o);
29191         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29192         o_conv = UpdateFailHTLC_clone(&o_conv);
29193         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29194         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29195         return tag_ptr(ret_conv, true);
29196 }
29197
29198 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
29199         void* e_ptr = untag_ptr(e);
29200         CHECK_ACCESS(e_ptr);
29201         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29202         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29203         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29204         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29205         return tag_ptr(ret_conv, true);
29206 }
29207
29208 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
29209         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29210         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29211         return ret_conv;
29212 }
29213
29214 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
29215         if (!ptr_is_owned(_res)) return;
29216         void* _res_ptr = untag_ptr(_res);
29217         CHECK_ACCESS(_res_ptr);
29218         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29219         FREE(untag_ptr(_res));
29220         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29221 }
29222
29223 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29224         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29225         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29226         return tag_ptr(ret_conv, true);
29227 }
29228 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29229         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29230         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29231         return ret_conv;
29232 }
29233
29234 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
29235         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29236         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29237         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29238         return tag_ptr(ret_conv, true);
29239 }
29240
29241 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
29242         LDKUpdateFailMalformedHTLC o_conv;
29243         o_conv.inner = untag_ptr(o);
29244         o_conv.is_owned = ptr_is_owned(o);
29245         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29246         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29247         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29248         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29249         return tag_ptr(ret_conv, true);
29250 }
29251
29252 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
29253         void* e_ptr = untag_ptr(e);
29254         CHECK_ACCESS(e_ptr);
29255         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29256         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29257         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29258         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29259         return tag_ptr(ret_conv, true);
29260 }
29261
29262 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
29263         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29264         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29265         return ret_conv;
29266 }
29267
29268 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
29269         if (!ptr_is_owned(_res)) return;
29270         void* _res_ptr = untag_ptr(_res);
29271         CHECK_ACCESS(_res_ptr);
29272         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29273         FREE(untag_ptr(_res));
29274         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29275 }
29276
29277 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29278         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29279         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29280         return tag_ptr(ret_conv, true);
29281 }
29282 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29283         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29284         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29285         return ret_conv;
29286 }
29287
29288 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
29289         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29290         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29291         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29292         return tag_ptr(ret_conv, true);
29293 }
29294
29295 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
29296         LDKUpdateFee o_conv;
29297         o_conv.inner = untag_ptr(o);
29298         o_conv.is_owned = ptr_is_owned(o);
29299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29300         o_conv = UpdateFee_clone(&o_conv);
29301         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29302         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29303         return tag_ptr(ret_conv, true);
29304 }
29305
29306 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
29307         void* e_ptr = untag_ptr(e);
29308         CHECK_ACCESS(e_ptr);
29309         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29310         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29311         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29312         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29313         return tag_ptr(ret_conv, true);
29314 }
29315
29316 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
29317         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29318         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29319         return ret_conv;
29320 }
29321
29322 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
29323         if (!ptr_is_owned(_res)) return;
29324         void* _res_ptr = untag_ptr(_res);
29325         CHECK_ACCESS(_res_ptr);
29326         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29327         FREE(untag_ptr(_res));
29328         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29329 }
29330
29331 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29332         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29333         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29334         return tag_ptr(ret_conv, true);
29335 }
29336 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
29337         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29338         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29339         return ret_conv;
29340 }
29341
29342 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
29343         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29344         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29345         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29346         return tag_ptr(ret_conv, true);
29347 }
29348
29349 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
29350         LDKUpdateFulfillHTLC o_conv;
29351         o_conv.inner = untag_ptr(o);
29352         o_conv.is_owned = ptr_is_owned(o);
29353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29354         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29355         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29356         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29357         return tag_ptr(ret_conv, true);
29358 }
29359
29360 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
29361         void* e_ptr = untag_ptr(e);
29362         CHECK_ACCESS(e_ptr);
29363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29365         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29366         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29367         return tag_ptr(ret_conv, true);
29368 }
29369
29370 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
29371         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29372         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29373         return ret_conv;
29374 }
29375
29376 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
29377         if (!ptr_is_owned(_res)) return;
29378         void* _res_ptr = untag_ptr(_res);
29379         CHECK_ACCESS(_res_ptr);
29380         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29381         FREE(untag_ptr(_res));
29382         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29383 }
29384
29385 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29386         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29387         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29388         return tag_ptr(ret_conv, true);
29389 }
29390 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29391         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29392         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29393         return ret_conv;
29394 }
29395
29396 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
29397         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29398         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29399         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29400         return tag_ptr(ret_conv, true);
29401 }
29402
29403 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_ok"))) TS_CResult_OnionPacketDecodeErrorZ_ok(uint64_t o) {
29404         LDKOnionPacket o_conv;
29405         o_conv.inner = untag_ptr(o);
29406         o_conv.is_owned = ptr_is_owned(o);
29407         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29408         o_conv = OnionPacket_clone(&o_conv);
29409         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29410         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
29411         return tag_ptr(ret_conv, true);
29412 }
29413
29414 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_err"))) TS_CResult_OnionPacketDecodeErrorZ_err(uint64_t e) {
29415         void* e_ptr = untag_ptr(e);
29416         CHECK_ACCESS(e_ptr);
29417         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29418         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29419         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29420         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
29421         return tag_ptr(ret_conv, true);
29422 }
29423
29424 jboolean  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_is_ok"))) TS_CResult_OnionPacketDecodeErrorZ_is_ok(uint64_t o) {
29425         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
29426         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
29427         return ret_conv;
29428 }
29429
29430 void  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_free"))) TS_CResult_OnionPacketDecodeErrorZ_free(uint64_t _res) {
29431         if (!ptr_is_owned(_res)) return;
29432         void* _res_ptr = untag_ptr(_res);
29433         CHECK_ACCESS(_res_ptr);
29434         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
29435         FREE(untag_ptr(_res));
29436         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
29437 }
29438
29439 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
29440         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29441         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
29442         return tag_ptr(ret_conv, true);
29443 }
29444 int64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone_ptr"))) TS_CResult_OnionPacketDecodeErrorZ_clone_ptr(uint64_t arg) {
29445         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
29446         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
29447         return ret_conv;
29448 }
29449
29450 uint64_t  __attribute__((export_name("TS_CResult_OnionPacketDecodeErrorZ_clone"))) TS_CResult_OnionPacketDecodeErrorZ_clone(uint64_t orig) {
29451         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
29452         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29453         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
29454         return tag_ptr(ret_conv, true);
29455 }
29456
29457 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
29458         LDKUpdateAddHTLC o_conv;
29459         o_conv.inner = untag_ptr(o);
29460         o_conv.is_owned = ptr_is_owned(o);
29461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29462         o_conv = UpdateAddHTLC_clone(&o_conv);
29463         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29464         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29465         return tag_ptr(ret_conv, true);
29466 }
29467
29468 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
29469         void* e_ptr = untag_ptr(e);
29470         CHECK_ACCESS(e_ptr);
29471         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29472         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29473         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29474         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
29475         return tag_ptr(ret_conv, true);
29476 }
29477
29478 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
29479         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
29480         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
29481         return ret_conv;
29482 }
29483
29484 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
29485         if (!ptr_is_owned(_res)) return;
29486         void* _res_ptr = untag_ptr(_res);
29487         CHECK_ACCESS(_res_ptr);
29488         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
29489         FREE(untag_ptr(_res));
29490         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
29491 }
29492
29493 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
29494         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29495         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
29496         return tag_ptr(ret_conv, true);
29497 }
29498 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
29499         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
29500         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
29501         return ret_conv;
29502 }
29503
29504 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
29505         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
29506         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29507         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
29508         return tag_ptr(ret_conv, true);
29509 }
29510
29511 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
29512         LDKOnionMessage o_conv;
29513         o_conv.inner = untag_ptr(o);
29514         o_conv.is_owned = ptr_is_owned(o);
29515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29516         o_conv = OnionMessage_clone(&o_conv);
29517         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29518         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
29519         return tag_ptr(ret_conv, true);
29520 }
29521
29522 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
29523         void* e_ptr = untag_ptr(e);
29524         CHECK_ACCESS(e_ptr);
29525         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29526         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29527         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29528         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
29529         return tag_ptr(ret_conv, true);
29530 }
29531
29532 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
29533         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
29534         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
29535         return ret_conv;
29536 }
29537
29538 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
29539         if (!ptr_is_owned(_res)) return;
29540         void* _res_ptr = untag_ptr(_res);
29541         CHECK_ACCESS(_res_ptr);
29542         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
29543         FREE(untag_ptr(_res));
29544         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
29545 }
29546
29547 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
29548         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29549         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
29550         return tag_ptr(ret_conv, true);
29551 }
29552 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
29553         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
29554         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
29555         return ret_conv;
29556 }
29557
29558 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
29559         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
29560         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29561         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
29562         return tag_ptr(ret_conv, true);
29563 }
29564
29565 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_ok(uint64_t o) {
29566         LDKFinalOnionHopData o_conv;
29567         o_conv.inner = untag_ptr(o);
29568         o_conv.is_owned = ptr_is_owned(o);
29569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29570         o_conv = FinalOnionHopData_clone(&o_conv);
29571         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29572         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
29573         return tag_ptr(ret_conv, true);
29574 }
29575
29576 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_err"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_err(uint64_t e) {
29577         void* e_ptr = untag_ptr(e);
29578         CHECK_ACCESS(e_ptr);
29579         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29580         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29581         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29582         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
29583         return tag_ptr(ret_conv, true);
29584 }
29585
29586 jboolean  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(uint64_t o) {
29587         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
29588         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
29589         return ret_conv;
29590 }
29591
29592 void  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_free"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_free(uint64_t _res) {
29593         if (!ptr_is_owned(_res)) return;
29594         void* _res_ptr = untag_ptr(_res);
29595         CHECK_ACCESS(_res_ptr);
29596         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
29597         FREE(untag_ptr(_res));
29598         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
29599 }
29600
29601 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
29602         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29603         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
29604         return tag_ptr(ret_conv, true);
29605 }
29606 int64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(uint64_t arg) {
29607         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
29608         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
29609         return ret_conv;
29610 }
29611
29612 uint64_t  __attribute__((export_name("TS_CResult_FinalOnionHopDataDecodeErrorZ_clone"))) TS_CResult_FinalOnionHopDataDecodeErrorZ_clone(uint64_t orig) {
29613         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
29614         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29615         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
29616         return tag_ptr(ret_conv, true);
29617 }
29618
29619 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
29620         LDKPing o_conv;
29621         o_conv.inner = untag_ptr(o);
29622         o_conv.is_owned = ptr_is_owned(o);
29623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29624         o_conv = Ping_clone(&o_conv);
29625         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29626         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
29627         return tag_ptr(ret_conv, true);
29628 }
29629
29630 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
29631         void* e_ptr = untag_ptr(e);
29632         CHECK_ACCESS(e_ptr);
29633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29635         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29636         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
29637         return tag_ptr(ret_conv, true);
29638 }
29639
29640 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
29641         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
29642         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
29643         return ret_conv;
29644 }
29645
29646 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
29647         if (!ptr_is_owned(_res)) return;
29648         void* _res_ptr = untag_ptr(_res);
29649         CHECK_ACCESS(_res_ptr);
29650         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
29651         FREE(untag_ptr(_res));
29652         CResult_PingDecodeErrorZ_free(_res_conv);
29653 }
29654
29655 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
29656         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29657         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
29658         return tag_ptr(ret_conv, true);
29659 }
29660 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
29661         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
29662         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
29663         return ret_conv;
29664 }
29665
29666 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
29667         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
29668         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29669         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
29670         return tag_ptr(ret_conv, true);
29671 }
29672
29673 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
29674         LDKPong o_conv;
29675         o_conv.inner = untag_ptr(o);
29676         o_conv.is_owned = ptr_is_owned(o);
29677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29678         o_conv = Pong_clone(&o_conv);
29679         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29680         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
29681         return tag_ptr(ret_conv, true);
29682 }
29683
29684 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
29685         void* e_ptr = untag_ptr(e);
29686         CHECK_ACCESS(e_ptr);
29687         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29688         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29689         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29690         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
29691         return tag_ptr(ret_conv, true);
29692 }
29693
29694 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
29695         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
29696         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
29697         return ret_conv;
29698 }
29699
29700 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
29701         if (!ptr_is_owned(_res)) return;
29702         void* _res_ptr = untag_ptr(_res);
29703         CHECK_ACCESS(_res_ptr);
29704         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
29705         FREE(untag_ptr(_res));
29706         CResult_PongDecodeErrorZ_free(_res_conv);
29707 }
29708
29709 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
29710         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29711         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
29712         return tag_ptr(ret_conv, true);
29713 }
29714 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
29715         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
29716         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
29717         return ret_conv;
29718 }
29719
29720 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
29721         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
29722         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29723         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
29724         return tag_ptr(ret_conv, true);
29725 }
29726
29727 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
29728         LDKUnsignedChannelAnnouncement o_conv;
29729         o_conv.inner = untag_ptr(o);
29730         o_conv.is_owned = ptr_is_owned(o);
29731         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29732         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
29733         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29734         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
29735         return tag_ptr(ret_conv, true);
29736 }
29737
29738 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
29739         void* e_ptr = untag_ptr(e);
29740         CHECK_ACCESS(e_ptr);
29741         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29742         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29743         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29744         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
29745         return tag_ptr(ret_conv, true);
29746 }
29747
29748 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
29749         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
29750         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
29751         return ret_conv;
29752 }
29753
29754 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
29755         if (!ptr_is_owned(_res)) return;
29756         void* _res_ptr = untag_ptr(_res);
29757         CHECK_ACCESS(_res_ptr);
29758         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
29759         FREE(untag_ptr(_res));
29760         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
29761 }
29762
29763 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29764         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29765         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
29766         return tag_ptr(ret_conv, true);
29767 }
29768 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
29769         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
29770         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29771         return ret_conv;
29772 }
29773
29774 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
29775         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
29776         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
29777         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
29778         return tag_ptr(ret_conv, true);
29779 }
29780
29781 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
29782         LDKChannelAnnouncement o_conv;
29783         o_conv.inner = untag_ptr(o);
29784         o_conv.is_owned = ptr_is_owned(o);
29785         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29786         o_conv = ChannelAnnouncement_clone(&o_conv);
29787         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29788         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
29789         return tag_ptr(ret_conv, true);
29790 }
29791
29792 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
29793         void* e_ptr = untag_ptr(e);
29794         CHECK_ACCESS(e_ptr);
29795         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29796         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29797         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29798         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
29799         return tag_ptr(ret_conv, true);
29800 }
29801
29802 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
29803         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
29804         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
29805         return ret_conv;
29806 }
29807
29808 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
29809         if (!ptr_is_owned(_res)) return;
29810         void* _res_ptr = untag_ptr(_res);
29811         CHECK_ACCESS(_res_ptr);
29812         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
29813         FREE(untag_ptr(_res));
29814         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
29815 }
29816
29817 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29818         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29819         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
29820         return tag_ptr(ret_conv, true);
29821 }
29822 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
29823         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
29824         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29825         return ret_conv;
29826 }
29827
29828 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
29829         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
29830         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
29831         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
29832         return tag_ptr(ret_conv, true);
29833 }
29834
29835 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
29836         LDKUnsignedChannelUpdate 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 = UnsignedChannelUpdate_clone(&o_conv);
29841         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29842         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
29843         return tag_ptr(ret_conv, true);
29844 }
29845
29846 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
29847         void* e_ptr = untag_ptr(e);
29848         CHECK_ACCESS(e_ptr);
29849         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29850         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29851         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29852         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
29853         return tag_ptr(ret_conv, true);
29854 }
29855
29856 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
29857         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
29858         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
29859         return ret_conv;
29860 }
29861
29862 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
29863         if (!ptr_is_owned(_res)) return;
29864         void* _res_ptr = untag_ptr(_res);
29865         CHECK_ACCESS(_res_ptr);
29866         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
29867         FREE(untag_ptr(_res));
29868         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
29869 }
29870
29871 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
29872         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29873         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
29874         return tag_ptr(ret_conv, true);
29875 }
29876 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
29877         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
29878         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
29879         return ret_conv;
29880 }
29881
29882 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
29883         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
29884         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
29885         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
29886         return tag_ptr(ret_conv, true);
29887 }
29888
29889 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
29890         LDKChannelUpdate o_conv;
29891         o_conv.inner = untag_ptr(o);
29892         o_conv.is_owned = ptr_is_owned(o);
29893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29894         o_conv = ChannelUpdate_clone(&o_conv);
29895         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29896         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
29897         return tag_ptr(ret_conv, true);
29898 }
29899
29900 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
29901         void* e_ptr = untag_ptr(e);
29902         CHECK_ACCESS(e_ptr);
29903         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29904         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29905         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29906         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
29907         return tag_ptr(ret_conv, true);
29908 }
29909
29910 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
29911         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
29912         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
29913         return ret_conv;
29914 }
29915
29916 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
29917         if (!ptr_is_owned(_res)) return;
29918         void* _res_ptr = untag_ptr(_res);
29919         CHECK_ACCESS(_res_ptr);
29920         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
29921         FREE(untag_ptr(_res));
29922         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
29923 }
29924
29925 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
29926         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29927         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
29928         return tag_ptr(ret_conv, true);
29929 }
29930 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
29931         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
29932         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
29933         return ret_conv;
29934 }
29935
29936 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
29937         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
29938         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
29939         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
29940         return tag_ptr(ret_conv, true);
29941 }
29942
29943 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
29944         LDKErrorMessage o_conv;
29945         o_conv.inner = untag_ptr(o);
29946         o_conv.is_owned = ptr_is_owned(o);
29947         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29948         o_conv = ErrorMessage_clone(&o_conv);
29949         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
29950         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
29951         return tag_ptr(ret_conv, true);
29952 }
29953
29954 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
29955         void* e_ptr = untag_ptr(e);
29956         CHECK_ACCESS(e_ptr);
29957         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29958         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29959         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
29960         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
29961         return tag_ptr(ret_conv, true);
29962 }
29963
29964 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
29965         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
29966         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
29967         return ret_conv;
29968 }
29969
29970 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
29971         if (!ptr_is_owned(_res)) return;
29972         void* _res_ptr = untag_ptr(_res);
29973         CHECK_ACCESS(_res_ptr);
29974         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
29975         FREE(untag_ptr(_res));
29976         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
29977 }
29978
29979 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
29980         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
29981         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
29982         return tag_ptr(ret_conv, true);
29983 }
29984 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
29985         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
29986         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
29987         return ret_conv;
29988 }
29989
29990 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
29991         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
29992         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
29993         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
29994         return tag_ptr(ret_conv, true);
29995 }
29996
29997 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
29998         LDKWarningMessage o_conv;
29999         o_conv.inner = untag_ptr(o);
30000         o_conv.is_owned = ptr_is_owned(o);
30001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30002         o_conv = WarningMessage_clone(&o_conv);
30003         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30004         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30005         return tag_ptr(ret_conv, true);
30006 }
30007
30008 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
30009         void* e_ptr = untag_ptr(e);
30010         CHECK_ACCESS(e_ptr);
30011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30013         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30014         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30015         return tag_ptr(ret_conv, true);
30016 }
30017
30018 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
30019         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30020         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30021         return ret_conv;
30022 }
30023
30024 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
30025         if (!ptr_is_owned(_res)) return;
30026         void* _res_ptr = untag_ptr(_res);
30027         CHECK_ACCESS(_res_ptr);
30028         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30029         FREE(untag_ptr(_res));
30030         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30031 }
30032
30033 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30034         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30035         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30036         return tag_ptr(ret_conv, true);
30037 }
30038 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
30039         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30040         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30041         return ret_conv;
30042 }
30043
30044 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
30045         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30046         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30047         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30048         return tag_ptr(ret_conv, true);
30049 }
30050
30051 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
30052         LDKUnsignedNodeAnnouncement o_conv;
30053         o_conv.inner = untag_ptr(o);
30054         o_conv.is_owned = ptr_is_owned(o);
30055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30056         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30057         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30058         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30059         return tag_ptr(ret_conv, true);
30060 }
30061
30062 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
30063         void* e_ptr = untag_ptr(e);
30064         CHECK_ACCESS(e_ptr);
30065         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30066         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30067         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30068         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30069         return tag_ptr(ret_conv, true);
30070 }
30071
30072 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
30073         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30074         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30075         return ret_conv;
30076 }
30077
30078 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_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_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30083         FREE(untag_ptr(_res));
30084         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30085 }
30086
30087 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30088         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30089         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30090         return tag_ptr(ret_conv, true);
30091 }
30092 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
30093         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30094         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30095         return ret_conv;
30096 }
30097
30098 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
30099         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30100         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30101         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30102         return tag_ptr(ret_conv, true);
30103 }
30104
30105 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
30106         LDKNodeAnnouncement 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 = NodeAnnouncement_clone(&o_conv);
30111         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30112         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30113         return tag_ptr(ret_conv, true);
30114 }
30115
30116 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
30117         void* e_ptr = untag_ptr(e);
30118         CHECK_ACCESS(e_ptr);
30119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30121         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30122         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30123         return tag_ptr(ret_conv, true);
30124 }
30125
30126 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
30127         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30128         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30129         return ret_conv;
30130 }
30131
30132 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
30133         if (!ptr_is_owned(_res)) return;
30134         void* _res_ptr = untag_ptr(_res);
30135         CHECK_ACCESS(_res_ptr);
30136         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30137         FREE(untag_ptr(_res));
30138         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30139 }
30140
30141 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30142         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30143         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30144         return tag_ptr(ret_conv, true);
30145 }
30146 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
30147         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30148         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30149         return ret_conv;
30150 }
30151
30152 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
30153         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30154         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30155         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30156         return tag_ptr(ret_conv, true);
30157 }
30158
30159 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
30160         LDKQueryShortChannelIds o_conv;
30161         o_conv.inner = untag_ptr(o);
30162         o_conv.is_owned = ptr_is_owned(o);
30163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30164         o_conv = QueryShortChannelIds_clone(&o_conv);
30165         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30166         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30167         return tag_ptr(ret_conv, true);
30168 }
30169
30170 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
30171         void* e_ptr = untag_ptr(e);
30172         CHECK_ACCESS(e_ptr);
30173         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30174         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30175         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30176         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30177         return tag_ptr(ret_conv, true);
30178 }
30179
30180 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
30181         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30182         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30183         return ret_conv;
30184 }
30185
30186 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
30187         if (!ptr_is_owned(_res)) return;
30188         void* _res_ptr = untag_ptr(_res);
30189         CHECK_ACCESS(_res_ptr);
30190         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30191         FREE(untag_ptr(_res));
30192         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30193 }
30194
30195 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30196         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30197         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30198         return tag_ptr(ret_conv, true);
30199 }
30200 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
30201         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30202         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30203         return ret_conv;
30204 }
30205
30206 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
30207         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30208         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30209         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30210         return tag_ptr(ret_conv, true);
30211 }
30212
30213 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
30214         LDKReplyShortChannelIdsEnd o_conv;
30215         o_conv.inner = untag_ptr(o);
30216         o_conv.is_owned = ptr_is_owned(o);
30217         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30218         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30219         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30220         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30221         return tag_ptr(ret_conv, true);
30222 }
30223
30224 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
30225         void* e_ptr = untag_ptr(e);
30226         CHECK_ACCESS(e_ptr);
30227         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30228         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30229         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30230         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30231         return tag_ptr(ret_conv, true);
30232 }
30233
30234 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
30235         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30236         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30237         return ret_conv;
30238 }
30239
30240 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
30241         if (!ptr_is_owned(_res)) return;
30242         void* _res_ptr = untag_ptr(_res);
30243         CHECK_ACCESS(_res_ptr);
30244         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30245         FREE(untag_ptr(_res));
30246         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30247 }
30248
30249 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30250         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30251         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30252         return tag_ptr(ret_conv, true);
30253 }
30254 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
30255         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30256         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30257         return ret_conv;
30258 }
30259
30260 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
30261         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30262         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30263         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30264         return tag_ptr(ret_conv, true);
30265 }
30266
30267 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
30268         LDKQueryChannelRange o_conv;
30269         o_conv.inner = untag_ptr(o);
30270         o_conv.is_owned = ptr_is_owned(o);
30271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30272         o_conv = QueryChannelRange_clone(&o_conv);
30273         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30274         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30275         return tag_ptr(ret_conv, true);
30276 }
30277
30278 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
30279         void* e_ptr = untag_ptr(e);
30280         CHECK_ACCESS(e_ptr);
30281         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30282         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30283         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30284         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30285         return tag_ptr(ret_conv, true);
30286 }
30287
30288 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
30289         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30290         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30291         return ret_conv;
30292 }
30293
30294 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
30295         if (!ptr_is_owned(_res)) return;
30296         void* _res_ptr = untag_ptr(_res);
30297         CHECK_ACCESS(_res_ptr);
30298         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30299         FREE(untag_ptr(_res));
30300         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30301 }
30302
30303 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30304         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30305         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30306         return tag_ptr(ret_conv, true);
30307 }
30308 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
30309         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30310         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30311         return ret_conv;
30312 }
30313
30314 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
30315         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30316         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30317         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30318         return tag_ptr(ret_conv, true);
30319 }
30320
30321 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
30322         LDKReplyChannelRange o_conv;
30323         o_conv.inner = untag_ptr(o);
30324         o_conv.is_owned = ptr_is_owned(o);
30325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30326         o_conv = ReplyChannelRange_clone(&o_conv);
30327         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30328         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30329         return tag_ptr(ret_conv, true);
30330 }
30331
30332 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
30333         void* e_ptr = untag_ptr(e);
30334         CHECK_ACCESS(e_ptr);
30335         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30336         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30337         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30338         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30339         return tag_ptr(ret_conv, true);
30340 }
30341
30342 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
30343         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30344         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30345         return ret_conv;
30346 }
30347
30348 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
30349         if (!ptr_is_owned(_res)) return;
30350         void* _res_ptr = untag_ptr(_res);
30351         CHECK_ACCESS(_res_ptr);
30352         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30353         FREE(untag_ptr(_res));
30354         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30355 }
30356
30357 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30358         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30359         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30360         return tag_ptr(ret_conv, true);
30361 }
30362 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
30363         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30364         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30365         return ret_conv;
30366 }
30367
30368 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
30369         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30370         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30371         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30372         return tag_ptr(ret_conv, true);
30373 }
30374
30375 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
30376         LDKGossipTimestampFilter o_conv;
30377         o_conv.inner = untag_ptr(o);
30378         o_conv.is_owned = ptr_is_owned(o);
30379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30380         o_conv = GossipTimestampFilter_clone(&o_conv);
30381         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30382         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30383         return tag_ptr(ret_conv, true);
30384 }
30385
30386 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
30387         void* e_ptr = untag_ptr(e);
30388         CHECK_ACCESS(e_ptr);
30389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30391         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30392         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30393         return tag_ptr(ret_conv, true);
30394 }
30395
30396 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
30397         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30398         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30399         return ret_conv;
30400 }
30401
30402 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
30403         if (!ptr_is_owned(_res)) return;
30404         void* _res_ptr = untag_ptr(_res);
30405         CHECK_ACCESS(_res_ptr);
30406         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30407         FREE(untag_ptr(_res));
30408         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30409 }
30410
30411 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30412         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30413         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30414         return tag_ptr(ret_conv, true);
30415 }
30416 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
30417         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30418         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30419         return ret_conv;
30420 }
30421
30422 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
30423         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30424         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30425         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30426         return tag_ptr(ret_conv, true);
30427 }
30428
30429 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
30430         LDKCVec_PhantomRouteHintsZ _res_constr;
30431         _res_constr.datalen = _res->arr_len;
30432         if (_res_constr.datalen > 0)
30433                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30434         else
30435                 _res_constr.data = NULL;
30436         uint64_t* _res_vals = _res->elems;
30437         for (size_t t = 0; t < _res_constr.datalen; t++) {
30438                 uint64_t _res_conv_19 = _res_vals[t];
30439                 LDKPhantomRouteHints _res_conv_19_conv;
30440                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30441                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30443                 _res_constr.data[t] = _res_conv_19_conv;
30444         }
30445         FREE(_res);
30446         CVec_PhantomRouteHintsZ_free(_res_constr);
30447 }
30448
30449 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
30450         LDKBolt11Invoice o_conv;
30451         o_conv.inner = untag_ptr(o);
30452         o_conv.is_owned = ptr_is_owned(o);
30453         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30454         o_conv = Bolt11Invoice_clone(&o_conv);
30455         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30456         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30457         return tag_ptr(ret_conv, true);
30458 }
30459
30460 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
30461         void* e_ptr = untag_ptr(e);
30462         CHECK_ACCESS(e_ptr);
30463         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30464         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30465         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30466         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30467         return tag_ptr(ret_conv, true);
30468 }
30469
30470 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
30471         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30472         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30473         return ret_conv;
30474 }
30475
30476 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
30477         if (!ptr_is_owned(_res)) return;
30478         void* _res_ptr = untag_ptr(_res);
30479         CHECK_ACCESS(_res_ptr);
30480         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30481         FREE(untag_ptr(_res));
30482         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30483 }
30484
30485 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30486         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30487         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30488         return tag_ptr(ret_conv, true);
30489 }
30490 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
30491         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30492         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30493         return ret_conv;
30494 }
30495
30496 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
30497         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30498         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30499         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30500         return tag_ptr(ret_conv, true);
30501 }
30502
30503 uint64_t  __attribute__((export_name("TS_COption_InboundHTLCStateDetailsZ_some"))) TS_COption_InboundHTLCStateDetailsZ_some(uint32_t o) {
30504         LDKInboundHTLCStateDetails o_conv = LDKInboundHTLCStateDetails_from_js(o);
30505         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30506         *ret_copy = COption_InboundHTLCStateDetailsZ_some(o_conv);
30507         uint64_t ret_ref = tag_ptr(ret_copy, true);
30508         return ret_ref;
30509 }
30510
30511 uint64_t  __attribute__((export_name("TS_COption_InboundHTLCStateDetailsZ_none"))) TS_COption_InboundHTLCStateDetailsZ_none() {
30512         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30513         *ret_copy = COption_InboundHTLCStateDetailsZ_none();
30514         uint64_t ret_ref = tag_ptr(ret_copy, true);
30515         return ret_ref;
30516 }
30517
30518 void  __attribute__((export_name("TS_COption_InboundHTLCStateDetailsZ_free"))) TS_COption_InboundHTLCStateDetailsZ_free(uint64_t _res) {
30519         if (!ptr_is_owned(_res)) return;
30520         void* _res_ptr = untag_ptr(_res);
30521         CHECK_ACCESS(_res_ptr);
30522         LDKCOption_InboundHTLCStateDetailsZ _res_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(_res_ptr);
30523         FREE(untag_ptr(_res));
30524         COption_InboundHTLCStateDetailsZ_free(_res_conv);
30525 }
30526
30527 static inline uint64_t COption_InboundHTLCStateDetailsZ_clone_ptr(LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR arg) {
30528         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30529         *ret_copy = COption_InboundHTLCStateDetailsZ_clone(arg);
30530         uint64_t ret_ref = tag_ptr(ret_copy, true);
30531         return ret_ref;
30532 }
30533 int64_t  __attribute__((export_name("TS_COption_InboundHTLCStateDetailsZ_clone_ptr"))) TS_COption_InboundHTLCStateDetailsZ_clone_ptr(uint64_t arg) {
30534         LDKCOption_InboundHTLCStateDetailsZ* arg_conv = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(arg);
30535         int64_t ret_conv = COption_InboundHTLCStateDetailsZ_clone_ptr(arg_conv);
30536         return ret_conv;
30537 }
30538
30539 uint64_t  __attribute__((export_name("TS_COption_InboundHTLCStateDetailsZ_clone"))) TS_COption_InboundHTLCStateDetailsZ_clone(uint64_t orig) {
30540         LDKCOption_InboundHTLCStateDetailsZ* orig_conv = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(orig);
30541         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30542         *ret_copy = COption_InboundHTLCStateDetailsZ_clone(orig_conv);
30543         uint64_t ret_ref = tag_ptr(ret_copy, true);
30544         return ret_ref;
30545 }
30546
30547 uint64_t  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(uint64_t o) {
30548         void* o_ptr = untag_ptr(o);
30549         CHECK_ACCESS(o_ptr);
30550         LDKCOption_InboundHTLCStateDetailsZ o_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(o_ptr);
30551         o_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(o));
30552         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30553         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o_conv);
30554         return tag_ptr(ret_conv, true);
30555 }
30556
30557 uint64_t  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(uint64_t e) {
30558         void* e_ptr = untag_ptr(e);
30559         CHECK_ACCESS(e_ptr);
30560         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30561         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30562         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30563         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e_conv);
30564         return tag_ptr(ret_conv, true);
30565 }
30566
30567 jboolean  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(uint64_t o) {
30568         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* o_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(o);
30569         jboolean ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o_conv);
30570         return ret_conv;
30571 }
30572
30573 void  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(uint64_t _res) {
30574         if (!ptr_is_owned(_res)) return;
30575         void* _res_ptr = untag_ptr(_res);
30576         CHECK_ACCESS(_res_ptr);
30577         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res_conv = *(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)(_res_ptr);
30578         FREE(untag_ptr(_res));
30579         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res_conv);
30580 }
30581
30582 static inline uint64_t CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR arg) {
30583         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30584         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(arg);
30585         return tag_ptr(ret_conv, true);
30586 }
30587 int64_t  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(uint64_t arg) {
30588         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* arg_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(arg);
30589         int64_t ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(arg_conv);
30590         return ret_conv;
30591 }
30592
30593 uint64_t  __attribute__((export_name("TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone"))) TS_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(uint64_t orig) {
30594         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* orig_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(orig);
30595         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30596         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig_conv);
30597         return tag_ptr(ret_conv, true);
30598 }
30599
30600 uint64_t  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_ok"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_ok(uint64_t o) {
30601         LDKInboundHTLCDetails o_conv;
30602         o_conv.inner = untag_ptr(o);
30603         o_conv.is_owned = ptr_is_owned(o);
30604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30605         o_conv = InboundHTLCDetails_clone(&o_conv);
30606         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30607         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_ok(o_conv);
30608         return tag_ptr(ret_conv, true);
30609 }
30610
30611 uint64_t  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_err"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_err(uint64_t e) {
30612         void* e_ptr = untag_ptr(e);
30613         CHECK_ACCESS(e_ptr);
30614         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30615         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30616         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30617         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_err(e_conv);
30618         return tag_ptr(ret_conv, true);
30619 }
30620
30621 jboolean  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_is_ok"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(uint64_t o) {
30622         LDKCResult_InboundHTLCDetailsDecodeErrorZ* o_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(o);
30623         jboolean ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o_conv);
30624         return ret_conv;
30625 }
30626
30627 void  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_free"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_free(uint64_t _res) {
30628         if (!ptr_is_owned(_res)) return;
30629         void* _res_ptr = untag_ptr(_res);
30630         CHECK_ACCESS(_res_ptr);
30631         LDKCResult_InboundHTLCDetailsDecodeErrorZ _res_conv = *(LDKCResult_InboundHTLCDetailsDecodeErrorZ*)(_res_ptr);
30632         FREE(untag_ptr(_res));
30633         CResult_InboundHTLCDetailsDecodeErrorZ_free(_res_conv);
30634 }
30635
30636 static inline uint64_t CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR arg) {
30637         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30638         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone(arg);
30639         return tag_ptr(ret_conv, true);
30640 }
30641 int64_t  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
30642         LDKCResult_InboundHTLCDetailsDecodeErrorZ* arg_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(arg);
30643         int64_t ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(arg_conv);
30644         return ret_conv;
30645 }
30646
30647 uint64_t  __attribute__((export_name("TS_CResult_InboundHTLCDetailsDecodeErrorZ_clone"))) TS_CResult_InboundHTLCDetailsDecodeErrorZ_clone(uint64_t orig) {
30648         LDKCResult_InboundHTLCDetailsDecodeErrorZ* orig_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(orig);
30649         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30650         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig_conv);
30651         return tag_ptr(ret_conv, true);
30652 }
30653
30654 uint64_t  __attribute__((export_name("TS_COption_OutboundHTLCStateDetailsZ_some"))) TS_COption_OutboundHTLCStateDetailsZ_some(uint32_t o) {
30655         LDKOutboundHTLCStateDetails o_conv = LDKOutboundHTLCStateDetails_from_js(o);
30656         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30657         *ret_copy = COption_OutboundHTLCStateDetailsZ_some(o_conv);
30658         uint64_t ret_ref = tag_ptr(ret_copy, true);
30659         return ret_ref;
30660 }
30661
30662 uint64_t  __attribute__((export_name("TS_COption_OutboundHTLCStateDetailsZ_none"))) TS_COption_OutboundHTLCStateDetailsZ_none() {
30663         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30664         *ret_copy = COption_OutboundHTLCStateDetailsZ_none();
30665         uint64_t ret_ref = tag_ptr(ret_copy, true);
30666         return ret_ref;
30667 }
30668
30669 void  __attribute__((export_name("TS_COption_OutboundHTLCStateDetailsZ_free"))) TS_COption_OutboundHTLCStateDetailsZ_free(uint64_t _res) {
30670         if (!ptr_is_owned(_res)) return;
30671         void* _res_ptr = untag_ptr(_res);
30672         CHECK_ACCESS(_res_ptr);
30673         LDKCOption_OutboundHTLCStateDetailsZ _res_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(_res_ptr);
30674         FREE(untag_ptr(_res));
30675         COption_OutboundHTLCStateDetailsZ_free(_res_conv);
30676 }
30677
30678 static inline uint64_t COption_OutboundHTLCStateDetailsZ_clone_ptr(LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR arg) {
30679         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30680         *ret_copy = COption_OutboundHTLCStateDetailsZ_clone(arg);
30681         uint64_t ret_ref = tag_ptr(ret_copy, true);
30682         return ret_ref;
30683 }
30684 int64_t  __attribute__((export_name("TS_COption_OutboundHTLCStateDetailsZ_clone_ptr"))) TS_COption_OutboundHTLCStateDetailsZ_clone_ptr(uint64_t arg) {
30685         LDKCOption_OutboundHTLCStateDetailsZ* arg_conv = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(arg);
30686         int64_t ret_conv = COption_OutboundHTLCStateDetailsZ_clone_ptr(arg_conv);
30687         return ret_conv;
30688 }
30689
30690 uint64_t  __attribute__((export_name("TS_COption_OutboundHTLCStateDetailsZ_clone"))) TS_COption_OutboundHTLCStateDetailsZ_clone(uint64_t orig) {
30691         LDKCOption_OutboundHTLCStateDetailsZ* orig_conv = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(orig);
30692         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30693         *ret_copy = COption_OutboundHTLCStateDetailsZ_clone(orig_conv);
30694         uint64_t ret_ref = tag_ptr(ret_copy, true);
30695         return ret_ref;
30696 }
30697
30698 uint64_t  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(uint64_t o) {
30699         void* o_ptr = untag_ptr(o);
30700         CHECK_ACCESS(o_ptr);
30701         LDKCOption_OutboundHTLCStateDetailsZ o_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(o_ptr);
30702         o_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(o));
30703         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
30704         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o_conv);
30705         return tag_ptr(ret_conv, true);
30706 }
30707
30708 uint64_t  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(uint64_t e) {
30709         void* e_ptr = untag_ptr(e);
30710         CHECK_ACCESS(e_ptr);
30711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30713         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
30714         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e_conv);
30715         return tag_ptr(ret_conv, true);
30716 }
30717
30718 jboolean  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(uint64_t o) {
30719         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* o_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(o);
30720         jboolean ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o_conv);
30721         return ret_conv;
30722 }
30723
30724 void  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(uint64_t _res) {
30725         if (!ptr_is_owned(_res)) return;
30726         void* _res_ptr = untag_ptr(_res);
30727         CHECK_ACCESS(_res_ptr);
30728         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)(_res_ptr);
30729         FREE(untag_ptr(_res));
30730         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res_conv);
30731 }
30732
30733 static inline uint64_t CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR arg) {
30734         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
30735         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(arg);
30736         return tag_ptr(ret_conv, true);
30737 }
30738 int64_t  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(uint64_t arg) {
30739         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(arg);
30740         int64_t ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(arg_conv);
30741         return ret_conv;
30742 }
30743
30744 uint64_t  __attribute__((export_name("TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone"))) TS_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(uint64_t orig) {
30745         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(orig);
30746         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
30747         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig_conv);
30748         return tag_ptr(ret_conv, true);
30749 }
30750
30751 uint64_t  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_ok"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_ok(uint64_t o) {
30752         LDKOutboundHTLCDetails o_conv;
30753         o_conv.inner = untag_ptr(o);
30754         o_conv.is_owned = ptr_is_owned(o);
30755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30756         o_conv = OutboundHTLCDetails_clone(&o_conv);
30757         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
30758         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o_conv);
30759         return tag_ptr(ret_conv, true);
30760 }
30761
30762 uint64_t  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_err"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_err(uint64_t e) {
30763         void* e_ptr = untag_ptr(e);
30764         CHECK_ACCESS(e_ptr);
30765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30767         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
30768         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_err(e_conv);
30769         return tag_ptr(ret_conv, true);
30770 }
30771
30772 jboolean  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(uint64_t o) {
30773         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* o_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(o);
30774         jboolean ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o_conv);
30775         return ret_conv;
30776 }
30777
30778 void  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_free"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_free(uint64_t _res) {
30779         if (!ptr_is_owned(_res)) return;
30780         void* _res_ptr = untag_ptr(_res);
30781         CHECK_ACCESS(_res_ptr);
30782         LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res_conv = *(LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)(_res_ptr);
30783         FREE(untag_ptr(_res));
30784         CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res_conv);
30785 }
30786
30787 static inline uint64_t CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR arg) {
30788         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
30789         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone(arg);
30790         return tag_ptr(ret_conv, true);
30791 }
30792 int64_t  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
30793         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* arg_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(arg);
30794         int64_t ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(arg_conv);
30795         return ret_conv;
30796 }
30797
30798 uint64_t  __attribute__((export_name("TS_CResult_OutboundHTLCDetailsDecodeErrorZ_clone"))) TS_CResult_OutboundHTLCDetailsDecodeErrorZ_clone(uint64_t orig) {
30799         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* orig_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(orig);
30800         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
30801         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig_conv);
30802         return tag_ptr(ret_conv, true);
30803 }
30804
30805 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
30806         LDKCounterpartyForwardingInfo o_conv;
30807         o_conv.inner = untag_ptr(o);
30808         o_conv.is_owned = ptr_is_owned(o);
30809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30810         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
30811         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30812         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
30813         return tag_ptr(ret_conv, true);
30814 }
30815
30816 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
30817         void* e_ptr = untag_ptr(e);
30818         CHECK_ACCESS(e_ptr);
30819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30821         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30822         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
30823         return tag_ptr(ret_conv, true);
30824 }
30825
30826 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
30827         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
30828         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
30829         return ret_conv;
30830 }
30831
30832 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
30833         if (!ptr_is_owned(_res)) return;
30834         void* _res_ptr = untag_ptr(_res);
30835         CHECK_ACCESS(_res_ptr);
30836         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
30837         FREE(untag_ptr(_res));
30838         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
30839 }
30840
30841 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
30842         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30843         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
30844         return tag_ptr(ret_conv, true);
30845 }
30846 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
30847         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
30848         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
30849         return ret_conv;
30850 }
30851
30852 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
30853         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
30854         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30855         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
30856         return tag_ptr(ret_conv, true);
30857 }
30858
30859 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
30860         LDKChannelCounterparty o_conv;
30861         o_conv.inner = untag_ptr(o);
30862         o_conv.is_owned = ptr_is_owned(o);
30863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30864         o_conv = ChannelCounterparty_clone(&o_conv);
30865         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30866         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
30867         return tag_ptr(ret_conv, true);
30868 }
30869
30870 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
30871         void* e_ptr = untag_ptr(e);
30872         CHECK_ACCESS(e_ptr);
30873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30875         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30876         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
30877         return tag_ptr(ret_conv, true);
30878 }
30879
30880 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
30881         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
30882         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
30883         return ret_conv;
30884 }
30885
30886 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
30887         if (!ptr_is_owned(_res)) return;
30888         void* _res_ptr = untag_ptr(_res);
30889         CHECK_ACCESS(_res_ptr);
30890         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
30891         FREE(untag_ptr(_res));
30892         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
30893 }
30894
30895 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
30896         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30897         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
30898         return tag_ptr(ret_conv, true);
30899 }
30900 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
30901         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
30902         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
30903         return ret_conv;
30904 }
30905
30906 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
30907         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
30908         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30909         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
30910         return tag_ptr(ret_conv, true);
30911 }
30912
30913 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
30914         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
30915         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
30916         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
30917         uint64_t ret_ref = tag_ptr(ret_copy, true);
30918         return ret_ref;
30919 }
30920
30921 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
30922         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
30923         *ret_copy = COption_ChannelShutdownStateZ_none();
30924         uint64_t ret_ref = tag_ptr(ret_copy, true);
30925         return ret_ref;
30926 }
30927
30928 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
30929         if (!ptr_is_owned(_res)) return;
30930         void* _res_ptr = untag_ptr(_res);
30931         CHECK_ACCESS(_res_ptr);
30932         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
30933         FREE(untag_ptr(_res));
30934         COption_ChannelShutdownStateZ_free(_res_conv);
30935 }
30936
30937 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
30938         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
30939         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
30940         uint64_t ret_ref = tag_ptr(ret_copy, true);
30941         return ret_ref;
30942 }
30943 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
30944         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
30945         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
30946         return ret_conv;
30947 }
30948
30949 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
30950         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
30951         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
30952         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
30953         uint64_t ret_ref = tag_ptr(ret_copy, true);
30954         return ret_ref;
30955 }
30956
30957 void  __attribute__((export_name("TS_CVec_InboundHTLCDetailsZ_free"))) TS_CVec_InboundHTLCDetailsZ_free(uint64_tArray _res) {
30958         LDKCVec_InboundHTLCDetailsZ _res_constr;
30959         _res_constr.datalen = _res->arr_len;
30960         if (_res_constr.datalen > 0)
30961                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
30962         else
30963                 _res_constr.data = NULL;
30964         uint64_t* _res_vals = _res->elems;
30965         for (size_t u = 0; u < _res_constr.datalen; u++) {
30966                 uint64_t _res_conv_20 = _res_vals[u];
30967                 LDKInboundHTLCDetails _res_conv_20_conv;
30968                 _res_conv_20_conv.inner = untag_ptr(_res_conv_20);
30969                 _res_conv_20_conv.is_owned = ptr_is_owned(_res_conv_20);
30970                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_20_conv);
30971                 _res_constr.data[u] = _res_conv_20_conv;
30972         }
30973         FREE(_res);
30974         CVec_InboundHTLCDetailsZ_free(_res_constr);
30975 }
30976
30977 void  __attribute__((export_name("TS_CVec_OutboundHTLCDetailsZ_free"))) TS_CVec_OutboundHTLCDetailsZ_free(uint64_tArray _res) {
30978         LDKCVec_OutboundHTLCDetailsZ _res_constr;
30979         _res_constr.datalen = _res->arr_len;
30980         if (_res_constr.datalen > 0)
30981                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
30982         else
30983                 _res_constr.data = NULL;
30984         uint64_t* _res_vals = _res->elems;
30985         for (size_t v = 0; v < _res_constr.datalen; v++) {
30986                 uint64_t _res_conv_21 = _res_vals[v];
30987                 LDKOutboundHTLCDetails _res_conv_21_conv;
30988                 _res_conv_21_conv.inner = untag_ptr(_res_conv_21);
30989                 _res_conv_21_conv.is_owned = ptr_is_owned(_res_conv_21);
30990                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_21_conv);
30991                 _res_constr.data[v] = _res_conv_21_conv;
30992         }
30993         FREE(_res);
30994         CVec_OutboundHTLCDetailsZ_free(_res_constr);
30995 }
30996
30997 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
30998         LDKChannelDetails o_conv;
30999         o_conv.inner = untag_ptr(o);
31000         o_conv.is_owned = ptr_is_owned(o);
31001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31002         o_conv = ChannelDetails_clone(&o_conv);
31003         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31004         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
31005         return tag_ptr(ret_conv, true);
31006 }
31007
31008 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
31009         void* e_ptr = untag_ptr(e);
31010         CHECK_ACCESS(e_ptr);
31011         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31012         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31013         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31014         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
31015         return tag_ptr(ret_conv, true);
31016 }
31017
31018 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
31019         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
31020         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
31021         return ret_conv;
31022 }
31023
31024 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
31025         if (!ptr_is_owned(_res)) return;
31026         void* _res_ptr = untag_ptr(_res);
31027         CHECK_ACCESS(_res_ptr);
31028         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
31029         FREE(untag_ptr(_res));
31030         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
31031 }
31032
31033 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
31034         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31035         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
31036         return tag_ptr(ret_conv, true);
31037 }
31038 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
31039         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
31040         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
31041         return ret_conv;
31042 }
31043
31044 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
31045         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
31046         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31047         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
31048         return tag_ptr(ret_conv, true);
31049 }
31050
31051 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
31052         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
31053         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31054         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
31055         return tag_ptr(ret_conv, true);
31056 }
31057
31058 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
31059         void* e_ptr = untag_ptr(e);
31060         CHECK_ACCESS(e_ptr);
31061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31063         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31064         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
31065         return tag_ptr(ret_conv, true);
31066 }
31067
31068 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
31069         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
31070         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
31071         return ret_conv;
31072 }
31073
31074 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
31075         if (!ptr_is_owned(_res)) return;
31076         void* _res_ptr = untag_ptr(_res);
31077         CHECK_ACCESS(_res_ptr);
31078         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
31079         FREE(untag_ptr(_res));
31080         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
31081 }
31082
31083 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
31084         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31085         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
31086         return tag_ptr(ret_conv, true);
31087 }
31088 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
31089         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
31090         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
31091         return ret_conv;
31092 }
31093
31094 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
31095         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
31096         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31097         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
31098         return tag_ptr(ret_conv, true);
31099 }
31100
31101 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
31102         void* o_ptr = untag_ptr(o);
31103         CHECK_ACCESS(o_ptr);
31104         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
31105         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
31106         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31107         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
31108         return tag_ptr(ret_conv, true);
31109 }
31110
31111 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
31112         void* e_ptr = untag_ptr(e);
31113         CHECK_ACCESS(e_ptr);
31114         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31115         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31116         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31117         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
31118         return tag_ptr(ret_conv, true);
31119 }
31120
31121 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
31122         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
31123         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
31124         return ret_conv;
31125 }
31126
31127 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
31128         if (!ptr_is_owned(_res)) return;
31129         void* _res_ptr = untag_ptr(_res);
31130         CHECK_ACCESS(_res_ptr);
31131         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
31132         FREE(untag_ptr(_res));
31133         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
31134 }
31135
31136 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
31137         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31138         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
31139         return tag_ptr(ret_conv, true);
31140 }
31141 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
31142         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
31143         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
31144         return ret_conv;
31145 }
31146
31147 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
31148         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
31149         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31150         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
31151         return tag_ptr(ret_conv, true);
31152 }
31153
31154 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
31155         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
31156         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31157         *ret_copy = COption_HTLCClaimZ_some(o_conv);
31158         uint64_t ret_ref = tag_ptr(ret_copy, true);
31159         return ret_ref;
31160 }
31161
31162 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
31163         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31164         *ret_copy = COption_HTLCClaimZ_none();
31165         uint64_t ret_ref = tag_ptr(ret_copy, true);
31166         return ret_ref;
31167 }
31168
31169 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
31170         if (!ptr_is_owned(_res)) return;
31171         void* _res_ptr = untag_ptr(_res);
31172         CHECK_ACCESS(_res_ptr);
31173         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
31174         FREE(untag_ptr(_res));
31175         COption_HTLCClaimZ_free(_res_conv);
31176 }
31177
31178 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
31179         LDKCounterpartyCommitmentSecrets o_conv;
31180         o_conv.inner = untag_ptr(o);
31181         o_conv.is_owned = ptr_is_owned(o);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31183         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
31184         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31185         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
31186         return tag_ptr(ret_conv, true);
31187 }
31188
31189 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
31190         void* e_ptr = untag_ptr(e);
31191         CHECK_ACCESS(e_ptr);
31192         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31193         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31194         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31195         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
31196         return tag_ptr(ret_conv, true);
31197 }
31198
31199 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
31200         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
31201         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
31202         return ret_conv;
31203 }
31204
31205 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
31206         if (!ptr_is_owned(_res)) return;
31207         void* _res_ptr = untag_ptr(_res);
31208         CHECK_ACCESS(_res_ptr);
31209         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
31210         FREE(untag_ptr(_res));
31211         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
31212 }
31213
31214 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
31215         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31216         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
31217         return tag_ptr(ret_conv, true);
31218 }
31219 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
31220         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
31221         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
31222         return ret_conv;
31223 }
31224
31225 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
31226         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
31227         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31228         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
31229         return tag_ptr(ret_conv, true);
31230 }
31231
31232 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
31233         LDKTxCreationKeys o_conv;
31234         o_conv.inner = untag_ptr(o);
31235         o_conv.is_owned = ptr_is_owned(o);
31236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31237         o_conv = TxCreationKeys_clone(&o_conv);
31238         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31239         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31240         return tag_ptr(ret_conv, true);
31241 }
31242
31243 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
31244         void* e_ptr = untag_ptr(e);
31245         CHECK_ACCESS(e_ptr);
31246         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31247         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31248         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31249         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31250         return tag_ptr(ret_conv, true);
31251 }
31252
31253 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
31254         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31255         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31256         return ret_conv;
31257 }
31258
31259 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
31260         if (!ptr_is_owned(_res)) return;
31261         void* _res_ptr = untag_ptr(_res);
31262         CHECK_ACCESS(_res_ptr);
31263         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31264         FREE(untag_ptr(_res));
31265         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31266 }
31267
31268 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31269         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31270         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31271         return tag_ptr(ret_conv, true);
31272 }
31273 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
31274         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31275         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31276         return ret_conv;
31277 }
31278
31279 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
31280         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31281         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31282         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31283         return tag_ptr(ret_conv, true);
31284 }
31285
31286 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
31287         LDKChannelPublicKeys o_conv;
31288         o_conv.inner = untag_ptr(o);
31289         o_conv.is_owned = ptr_is_owned(o);
31290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31291         o_conv = ChannelPublicKeys_clone(&o_conv);
31292         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31293         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31294         return tag_ptr(ret_conv, true);
31295 }
31296
31297 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
31298         void* e_ptr = untag_ptr(e);
31299         CHECK_ACCESS(e_ptr);
31300         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31301         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31302         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31303         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31304         return tag_ptr(ret_conv, true);
31305 }
31306
31307 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
31308         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31309         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31310         return ret_conv;
31311 }
31312
31313 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
31314         if (!ptr_is_owned(_res)) return;
31315         void* _res_ptr = untag_ptr(_res);
31316         CHECK_ACCESS(_res_ptr);
31317         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31318         FREE(untag_ptr(_res));
31319         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31320 }
31321
31322 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31323         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31324         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31325         return tag_ptr(ret_conv, true);
31326 }
31327 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
31328         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31329         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31330         return ret_conv;
31331 }
31332
31333 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
31334         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31335         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31336         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31337         return tag_ptr(ret_conv, true);
31338 }
31339
31340 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
31341         LDKHTLCOutputInCommitment o_conv;
31342         o_conv.inner = untag_ptr(o);
31343         o_conv.is_owned = ptr_is_owned(o);
31344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31345         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31346         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31347         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31348         return tag_ptr(ret_conv, true);
31349 }
31350
31351 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
31352         void* e_ptr = untag_ptr(e);
31353         CHECK_ACCESS(e_ptr);
31354         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31355         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31356         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31357         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31358         return tag_ptr(ret_conv, true);
31359 }
31360
31361 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
31362         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31363         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31364         return ret_conv;
31365 }
31366
31367 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
31368         if (!ptr_is_owned(_res)) return;
31369         void* _res_ptr = untag_ptr(_res);
31370         CHECK_ACCESS(_res_ptr);
31371         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31372         FREE(untag_ptr(_res));
31373         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31374 }
31375
31376 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31377         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31378         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31379         return tag_ptr(ret_conv, true);
31380 }
31381 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
31382         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31383         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31384         return ret_conv;
31385 }
31386
31387 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
31388         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31389         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31390         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31391         return tag_ptr(ret_conv, true);
31392 }
31393
31394 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
31395         LDKCounterpartyChannelTransactionParameters o_conv;
31396         o_conv.inner = untag_ptr(o);
31397         o_conv.is_owned = ptr_is_owned(o);
31398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31399         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31400         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31401         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31402         return tag_ptr(ret_conv, true);
31403 }
31404
31405 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
31406         void* e_ptr = untag_ptr(e);
31407         CHECK_ACCESS(e_ptr);
31408         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31409         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31410         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31411         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31412         return tag_ptr(ret_conv, true);
31413 }
31414
31415 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
31416         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31417         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31418         return ret_conv;
31419 }
31420
31421 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
31422         if (!ptr_is_owned(_res)) return;
31423         void* _res_ptr = untag_ptr(_res);
31424         CHECK_ACCESS(_res_ptr);
31425         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31426         FREE(untag_ptr(_res));
31427         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31428 }
31429
31430 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31431         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31432         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31433         return tag_ptr(ret_conv, true);
31434 }
31435 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
31436         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31437         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31438         return ret_conv;
31439 }
31440
31441 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
31442         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31443         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31444         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31445         return tag_ptr(ret_conv, true);
31446 }
31447
31448 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
31449         LDKChannelTransactionParameters o_conv;
31450         o_conv.inner = untag_ptr(o);
31451         o_conv.is_owned = ptr_is_owned(o);
31452         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31453         o_conv = ChannelTransactionParameters_clone(&o_conv);
31454         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31455         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31456         return tag_ptr(ret_conv, true);
31457 }
31458
31459 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
31460         void* e_ptr = untag_ptr(e);
31461         CHECK_ACCESS(e_ptr);
31462         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31463         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31464         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31465         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31466         return tag_ptr(ret_conv, true);
31467 }
31468
31469 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
31470         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31471         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31472         return ret_conv;
31473 }
31474
31475 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
31476         if (!ptr_is_owned(_res)) return;
31477         void* _res_ptr = untag_ptr(_res);
31478         CHECK_ACCESS(_res_ptr);
31479         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31480         FREE(untag_ptr(_res));
31481         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31482 }
31483
31484 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31485         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31486         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31487         return tag_ptr(ret_conv, true);
31488 }
31489 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
31490         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31491         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31492         return ret_conv;
31493 }
31494
31495 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
31496         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31497         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31498         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31499         return tag_ptr(ret_conv, true);
31500 }
31501
31502 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31503         LDKHolderCommitmentTransaction o_conv;
31504         o_conv.inner = untag_ptr(o);
31505         o_conv.is_owned = ptr_is_owned(o);
31506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31507         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31508         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31509         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31510         return tag_ptr(ret_conv, true);
31511 }
31512
31513 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31514         void* e_ptr = untag_ptr(e);
31515         CHECK_ACCESS(e_ptr);
31516         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31517         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31518         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31519         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31520         return tag_ptr(ret_conv, true);
31521 }
31522
31523 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31524         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31525         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31526         return ret_conv;
31527 }
31528
31529 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31530         if (!ptr_is_owned(_res)) return;
31531         void* _res_ptr = untag_ptr(_res);
31532         CHECK_ACCESS(_res_ptr);
31533         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31534         FREE(untag_ptr(_res));
31535         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31536 }
31537
31538 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31539         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31540         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31541         return tag_ptr(ret_conv, true);
31542 }
31543 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31544         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31545         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31546         return ret_conv;
31547 }
31548
31549 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31550         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31551         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31552         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31553         return tag_ptr(ret_conv, true);
31554 }
31555
31556 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31557         LDKBuiltCommitmentTransaction o_conv;
31558         o_conv.inner = untag_ptr(o);
31559         o_conv.is_owned = ptr_is_owned(o);
31560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31561         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31562         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31563         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31564         return tag_ptr(ret_conv, true);
31565 }
31566
31567 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31568         void* e_ptr = untag_ptr(e);
31569         CHECK_ACCESS(e_ptr);
31570         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31571         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31572         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31573         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31574         return tag_ptr(ret_conv, true);
31575 }
31576
31577 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31578         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31579         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31580         return ret_conv;
31581 }
31582
31583 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31584         if (!ptr_is_owned(_res)) return;
31585         void* _res_ptr = untag_ptr(_res);
31586         CHECK_ACCESS(_res_ptr);
31587         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31588         FREE(untag_ptr(_res));
31589         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31590 }
31591
31592 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31593         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31594         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31595         return tag_ptr(ret_conv, true);
31596 }
31597 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31598         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31599         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31600         return ret_conv;
31601 }
31602
31603 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31604         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31605         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31606         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31607         return tag_ptr(ret_conv, true);
31608 }
31609
31610 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
31611         LDKTrustedClosingTransaction o_conv;
31612         o_conv.inner = untag_ptr(o);
31613         o_conv.is_owned = ptr_is_owned(o);
31614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31615         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31616         
31617         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31618         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31619         return tag_ptr(ret_conv, true);
31620 }
31621
31622 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
31623         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31624         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31625         return tag_ptr(ret_conv, true);
31626 }
31627
31628 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
31629         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31630         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31631         return ret_conv;
31632 }
31633
31634 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
31635         if (!ptr_is_owned(_res)) return;
31636         void* _res_ptr = untag_ptr(_res);
31637         CHECK_ACCESS(_res_ptr);
31638         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31639         FREE(untag_ptr(_res));
31640         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31641 }
31642
31643 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
31644         LDKCommitmentTransaction o_conv;
31645         o_conv.inner = untag_ptr(o);
31646         o_conv.is_owned = ptr_is_owned(o);
31647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31648         o_conv = CommitmentTransaction_clone(&o_conv);
31649         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31650         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31651         return tag_ptr(ret_conv, true);
31652 }
31653
31654 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
31655         void* e_ptr = untag_ptr(e);
31656         CHECK_ACCESS(e_ptr);
31657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31659         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31660         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31661         return tag_ptr(ret_conv, true);
31662 }
31663
31664 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
31665         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31666         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31667         return ret_conv;
31668 }
31669
31670 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
31671         if (!ptr_is_owned(_res)) return;
31672         void* _res_ptr = untag_ptr(_res);
31673         CHECK_ACCESS(_res_ptr);
31674         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31675         FREE(untag_ptr(_res));
31676         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31677 }
31678
31679 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31680         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31681         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31682         return tag_ptr(ret_conv, true);
31683 }
31684 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
31685         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31686         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31687         return ret_conv;
31688 }
31689
31690 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
31691         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31692         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31693         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31694         return tag_ptr(ret_conv, true);
31695 }
31696
31697 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
31698         LDKTrustedCommitmentTransaction o_conv;
31699         o_conv.inner = untag_ptr(o);
31700         o_conv.is_owned = ptr_is_owned(o);
31701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31702         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31703         
31704         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31705         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31706         return tag_ptr(ret_conv, true);
31707 }
31708
31709 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
31710         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31711         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
31712         return tag_ptr(ret_conv, true);
31713 }
31714
31715 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
31716         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
31717         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
31718         return ret_conv;
31719 }
31720
31721 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
31722         if (!ptr_is_owned(_res)) return;
31723         void* _res_ptr = untag_ptr(_res);
31724         CHECK_ACCESS(_res_ptr);
31725         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
31726         FREE(untag_ptr(_res));
31727         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
31728 }
31729
31730 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
31731         LDKCVec_ECDSASignatureZ o_constr;
31732         o_constr.datalen = o->arr_len;
31733         if (o_constr.datalen > 0)
31734                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
31735         else
31736                 o_constr.data = NULL;
31737         int8_tArray* o_vals = (void*) o->elems;
31738         for (size_t m = 0; m < o_constr.datalen; m++) {
31739                 int8_tArray o_conv_12 = o_vals[m];
31740                 LDKECDSASignature o_conv_12_ref;
31741                 CHECK(o_conv_12->arr_len == 64);
31742                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
31743                 o_constr.data[m] = o_conv_12_ref;
31744         }
31745         FREE(o);
31746         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31747         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
31748         return tag_ptr(ret_conv, true);
31749 }
31750
31751 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_err"))) TS_CResult_CVec_ECDSASignatureZNoneZ_err() {
31752         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31753         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
31754         return tag_ptr(ret_conv, true);
31755 }
31756
31757 jboolean  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok"))) TS_CResult_CVec_ECDSASignatureZNoneZ_is_ok(uint64_t o) {
31758         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
31759         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
31760         return ret_conv;
31761 }
31762
31763 void  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_free"))) TS_CResult_CVec_ECDSASignatureZNoneZ_free(uint64_t _res) {
31764         if (!ptr_is_owned(_res)) return;
31765         void* _res_ptr = untag_ptr(_res);
31766         CHECK_ACCESS(_res_ptr);
31767         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
31768         FREE(untag_ptr(_res));
31769         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
31770 }
31771
31772 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
31773         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31774         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
31775         return tag_ptr(ret_conv, true);
31776 }
31777 int64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(uint64_t arg) {
31778         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
31779         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
31780         return ret_conv;
31781 }
31782
31783 uint64_t  __attribute__((export_name("TS_CResult_CVec_ECDSASignatureZNoneZ_clone"))) TS_CResult_CVec_ECDSASignatureZNoneZ_clone(uint64_t orig) {
31784         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
31785         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31786         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
31787         return tag_ptr(ret_conv, true);
31788 }
31789
31790 uint64_t  __attribute__((export_name("TS_COption_usizeZ_some"))) TS_COption_usizeZ_some(uint32_t o) {
31791         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31792         *ret_copy = COption_usizeZ_some(o);
31793         uint64_t ret_ref = tag_ptr(ret_copy, true);
31794         return ret_ref;
31795 }
31796
31797 uint64_t  __attribute__((export_name("TS_COption_usizeZ_none"))) TS_COption_usizeZ_none() {
31798         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31799         *ret_copy = COption_usizeZ_none();
31800         uint64_t ret_ref = tag_ptr(ret_copy, true);
31801         return ret_ref;
31802 }
31803
31804 void  __attribute__((export_name("TS_COption_usizeZ_free"))) TS_COption_usizeZ_free(uint64_t _res) {
31805         if (!ptr_is_owned(_res)) return;
31806         void* _res_ptr = untag_ptr(_res);
31807         CHECK_ACCESS(_res_ptr);
31808         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
31809         FREE(untag_ptr(_res));
31810         COption_usizeZ_free(_res_conv);
31811 }
31812
31813 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
31814         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31815         *ret_copy = COption_usizeZ_clone(arg);
31816         uint64_t ret_ref = tag_ptr(ret_copy, true);
31817         return ret_ref;
31818 }
31819 int64_t  __attribute__((export_name("TS_COption_usizeZ_clone_ptr"))) TS_COption_usizeZ_clone_ptr(uint64_t arg) {
31820         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
31821         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
31822         return ret_conv;
31823 }
31824
31825 uint64_t  __attribute__((export_name("TS_COption_usizeZ_clone"))) TS_COption_usizeZ_clone(uint64_t orig) {
31826         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
31827         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31828         *ret_copy = COption_usizeZ_clone(orig_conv);
31829         uint64_t ret_ref = tag_ptr(ret_copy, true);
31830         return ret_ref;
31831 }
31832
31833 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
31834         LDKShutdownScript o_conv;
31835         o_conv.inner = untag_ptr(o);
31836         o_conv.is_owned = ptr_is_owned(o);
31837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31838         o_conv = ShutdownScript_clone(&o_conv);
31839         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31840         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
31841         return tag_ptr(ret_conv, true);
31842 }
31843
31844 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
31845         void* e_ptr = untag_ptr(e);
31846         CHECK_ACCESS(e_ptr);
31847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31849         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31850         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
31851         return tag_ptr(ret_conv, true);
31852 }
31853
31854 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
31855         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
31856         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
31857         return ret_conv;
31858 }
31859
31860 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
31861         if (!ptr_is_owned(_res)) return;
31862         void* _res_ptr = untag_ptr(_res);
31863         CHECK_ACCESS(_res_ptr);
31864         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
31865         FREE(untag_ptr(_res));
31866         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
31867 }
31868
31869 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
31870         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31871         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
31872         return tag_ptr(ret_conv, true);
31873 }
31874 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
31875         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
31876         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
31877         return ret_conv;
31878 }
31879
31880 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
31881         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
31882         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31883         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
31884         return tag_ptr(ret_conv, true);
31885 }
31886
31887 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
31888         LDKShutdownScript o_conv;
31889         o_conv.inner = untag_ptr(o);
31890         o_conv.is_owned = ptr_is_owned(o);
31891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31892         o_conv = ShutdownScript_clone(&o_conv);
31893         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31894         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
31895         return tag_ptr(ret_conv, true);
31896 }
31897
31898 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
31899         LDKInvalidShutdownScript e_conv;
31900         e_conv.inner = untag_ptr(e);
31901         e_conv.is_owned = ptr_is_owned(e);
31902         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
31903         e_conv = InvalidShutdownScript_clone(&e_conv);
31904         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31905         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
31906         return tag_ptr(ret_conv, true);
31907 }
31908
31909 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
31910         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
31911         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
31912         return ret_conv;
31913 }
31914
31915 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
31916         if (!ptr_is_owned(_res)) return;
31917         void* _res_ptr = untag_ptr(_res);
31918         CHECK_ACCESS(_res_ptr);
31919         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
31920         FREE(untag_ptr(_res));
31921         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
31922 }
31923
31924 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
31925         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31926         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
31927         return tag_ptr(ret_conv, true);
31928 }
31929 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
31930         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
31931         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
31932         return ret_conv;
31933 }
31934
31935 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
31936         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
31937         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31938         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
31939         return tag_ptr(ret_conv, true);
31940 }
31941
31942 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
31943         LDKCVec_TransactionZ _res_constr;
31944         _res_constr.datalen = _res->arr_len;
31945         if (_res_constr.datalen > 0)
31946                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
31947         else
31948                 _res_constr.data = NULL;
31949         int8_tArray* _res_vals = (void*) _res->elems;
31950         for (size_t m = 0; m < _res_constr.datalen; m++) {
31951                 int8_tArray _res_conv_12 = _res_vals[m];
31952                 LDKTransaction _res_conv_12_ref;
31953                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
31954                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
31955                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
31956                 _res_conv_12_ref.data_is_owned = true;
31957                 _res_constr.data[m] = _res_conv_12_ref;
31958         }
31959         FREE(_res);
31960         CVec_TransactionZ_free(_res_constr);
31961 }
31962
31963 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
31964         void* o_ptr = untag_ptr(o);
31965         CHECK_ACCESS(o_ptr);
31966         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
31967         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
31968         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31969         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
31970         return tag_ptr(ret_conv, true);
31971 }
31972
31973 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
31974         void* e_ptr = untag_ptr(e);
31975         CHECK_ACCESS(e_ptr);
31976         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31977         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31978         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31979         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
31980         return tag_ptr(ret_conv, true);
31981 }
31982
31983 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
31984         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
31985         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
31986         return ret_conv;
31987 }
31988
31989 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
31990         if (!ptr_is_owned(_res)) return;
31991         void* _res_ptr = untag_ptr(_res);
31992         CHECK_ACCESS(_res_ptr);
31993         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
31994         FREE(untag_ptr(_res));
31995         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
31996 }
31997
31998 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
31999         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32000         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
32001         return tag_ptr(ret_conv, true);
32002 }
32003 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
32004         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
32005         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
32006         return ret_conv;
32007 }
32008
32009 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
32010         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
32011         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32012         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
32013         return tag_ptr(ret_conv, true);
32014 }
32015
32016 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_ok(uint64_t o) {
32017         LDKClaimedHTLC o_conv;
32018         o_conv.inner = untag_ptr(o);
32019         o_conv.is_owned = ptr_is_owned(o);
32020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32021         o_conv = ClaimedHTLC_clone(&o_conv);
32022         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32023         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
32024         return tag_ptr(ret_conv, true);
32025 }
32026
32027 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_err"))) TS_CResult_ClaimedHTLCDecodeErrorZ_err(uint64_t e) {
32028         void* e_ptr = untag_ptr(e);
32029         CHECK_ACCESS(e_ptr);
32030         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32031         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32032         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32033         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
32034         return tag_ptr(ret_conv, true);
32035 }
32036
32037 jboolean  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok"))) TS_CResult_ClaimedHTLCDecodeErrorZ_is_ok(uint64_t o) {
32038         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
32039         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
32040         return ret_conv;
32041 }
32042
32043 void  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_free"))) TS_CResult_ClaimedHTLCDecodeErrorZ_free(uint64_t _res) {
32044         if (!ptr_is_owned(_res)) return;
32045         void* _res_ptr = untag_ptr(_res);
32046         CHECK_ACCESS(_res_ptr);
32047         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
32048         FREE(untag_ptr(_res));
32049         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
32050 }
32051
32052 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
32053         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32054         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
32055         return tag_ptr(ret_conv, true);
32056 }
32057 int64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
32058         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
32059         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
32060         return ret_conv;
32061 }
32062
32063 uint64_t  __attribute__((export_name("TS_CResult_ClaimedHTLCDecodeErrorZ_clone"))) TS_CResult_ClaimedHTLCDecodeErrorZ_clone(uint64_t orig) {
32064         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
32065         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32066         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
32067         return tag_ptr(ret_conv, true);
32068 }
32069
32070 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
32071         void* o_ptr = untag_ptr(o);
32072         CHECK_ACCESS(o_ptr);
32073         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
32074         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
32075         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32076         *ret_copy = COption_PathFailureZ_some(o_conv);
32077         uint64_t ret_ref = tag_ptr(ret_copy, true);
32078         return ret_ref;
32079 }
32080
32081 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
32082         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32083         *ret_copy = COption_PathFailureZ_none();
32084         uint64_t ret_ref = tag_ptr(ret_copy, true);
32085         return ret_ref;
32086 }
32087
32088 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
32089         if (!ptr_is_owned(_res)) return;
32090         void* _res_ptr = untag_ptr(_res);
32091         CHECK_ACCESS(_res_ptr);
32092         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
32093         FREE(untag_ptr(_res));
32094         COption_PathFailureZ_free(_res_conv);
32095 }
32096
32097 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
32098         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32099         *ret_copy = COption_PathFailureZ_clone(arg);
32100         uint64_t ret_ref = tag_ptr(ret_copy, true);
32101         return ret_ref;
32102 }
32103 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
32104         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
32105         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
32106         return ret_conv;
32107 }
32108
32109 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
32110         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
32111         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32112         *ret_copy = COption_PathFailureZ_clone(orig_conv);
32113         uint64_t ret_ref = tag_ptr(ret_copy, true);
32114         return ret_ref;
32115 }
32116
32117 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
32118         void* o_ptr = untag_ptr(o);
32119         CHECK_ACCESS(o_ptr);
32120         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
32121         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
32122         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32123         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
32124         return tag_ptr(ret_conv, true);
32125 }
32126
32127 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
32128         void* e_ptr = untag_ptr(e);
32129         CHECK_ACCESS(e_ptr);
32130         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32131         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32132         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32133         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
32134         return tag_ptr(ret_conv, true);
32135 }
32136
32137 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
32138         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
32139         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
32140         return ret_conv;
32141 }
32142
32143 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
32144         if (!ptr_is_owned(_res)) return;
32145         void* _res_ptr = untag_ptr(_res);
32146         CHECK_ACCESS(_res_ptr);
32147         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
32148         FREE(untag_ptr(_res));
32149         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
32150 }
32151
32152 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
32153         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32154         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
32155         return tag_ptr(ret_conv, true);
32156 }
32157 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
32158         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
32159         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
32160         return ret_conv;
32161 }
32162
32163 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
32164         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
32165         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32166         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
32167         return tag_ptr(ret_conv, true);
32168 }
32169
32170 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
32171         void* o_ptr = untag_ptr(o);
32172         CHECK_ACCESS(o_ptr);
32173         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
32174         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
32175         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32176         *ret_copy = COption_ClosureReasonZ_some(o_conv);
32177         uint64_t ret_ref = tag_ptr(ret_copy, true);
32178         return ret_ref;
32179 }
32180
32181 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
32182         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32183         *ret_copy = COption_ClosureReasonZ_none();
32184         uint64_t ret_ref = tag_ptr(ret_copy, true);
32185         return ret_ref;
32186 }
32187
32188 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
32189         if (!ptr_is_owned(_res)) return;
32190         void* _res_ptr = untag_ptr(_res);
32191         CHECK_ACCESS(_res_ptr);
32192         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
32193         FREE(untag_ptr(_res));
32194         COption_ClosureReasonZ_free(_res_conv);
32195 }
32196
32197 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
32198         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32199         *ret_copy = COption_ClosureReasonZ_clone(arg);
32200         uint64_t ret_ref = tag_ptr(ret_copy, true);
32201         return ret_ref;
32202 }
32203 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
32204         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
32205         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
32206         return ret_conv;
32207 }
32208
32209 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
32210         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
32211         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32212         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
32213         uint64_t ret_ref = tag_ptr(ret_copy, true);
32214         return ret_ref;
32215 }
32216
32217 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
32218         void* o_ptr = untag_ptr(o);
32219         CHECK_ACCESS(o_ptr);
32220         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
32221         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
32222         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32223         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
32224         return tag_ptr(ret_conv, true);
32225 }
32226
32227 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
32228         void* e_ptr = untag_ptr(e);
32229         CHECK_ACCESS(e_ptr);
32230         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32231         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32232         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32233         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32234         return tag_ptr(ret_conv, true);
32235 }
32236
32237 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
32238         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32239         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32240         return ret_conv;
32241 }
32242
32243 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
32244         if (!ptr_is_owned(_res)) return;
32245         void* _res_ptr = untag_ptr(_res);
32246         CHECK_ACCESS(_res_ptr);
32247         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32248         FREE(untag_ptr(_res));
32249         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32250 }
32251
32252 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32253         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32254         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32255         return tag_ptr(ret_conv, true);
32256 }
32257 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
32258         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32259         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32260         return ret_conv;
32261 }
32262
32263 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
32264         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32265         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32266         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32267         return tag_ptr(ret_conv, true);
32268 }
32269
32270 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
32271         void* o_ptr = untag_ptr(o);
32272         CHECK_ACCESS(o_ptr);
32273         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32274         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32275         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32276         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32277         uint64_t ret_ref = tag_ptr(ret_copy, true);
32278         return ret_ref;
32279 }
32280
32281 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
32282         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32283         *ret_copy = COption_HTLCDestinationZ_none();
32284         uint64_t ret_ref = tag_ptr(ret_copy, true);
32285         return ret_ref;
32286 }
32287
32288 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
32289         if (!ptr_is_owned(_res)) return;
32290         void* _res_ptr = untag_ptr(_res);
32291         CHECK_ACCESS(_res_ptr);
32292         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32293         FREE(untag_ptr(_res));
32294         COption_HTLCDestinationZ_free(_res_conv);
32295 }
32296
32297 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32298         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32299         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32300         uint64_t ret_ref = tag_ptr(ret_copy, true);
32301         return ret_ref;
32302 }
32303 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
32304         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32305         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32306         return ret_conv;
32307 }
32308
32309 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
32310         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32311         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32312         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32313         uint64_t ret_ref = tag_ptr(ret_copy, true);
32314         return ret_ref;
32315 }
32316
32317 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
32318         void* o_ptr = untag_ptr(o);
32319         CHECK_ACCESS(o_ptr);
32320         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32321         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32322         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32323         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32324         return tag_ptr(ret_conv, true);
32325 }
32326
32327 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
32328         void* e_ptr = untag_ptr(e);
32329         CHECK_ACCESS(e_ptr);
32330         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32331         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32332         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32333         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32334         return tag_ptr(ret_conv, true);
32335 }
32336
32337 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
32338         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32339         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32340         return ret_conv;
32341 }
32342
32343 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
32344         if (!ptr_is_owned(_res)) return;
32345         void* _res_ptr = untag_ptr(_res);
32346         CHECK_ACCESS(_res_ptr);
32347         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32348         FREE(untag_ptr(_res));
32349         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32350 }
32351
32352 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32353         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32354         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32355         return tag_ptr(ret_conv, true);
32356 }
32357 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
32358         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32359         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32360         return ret_conv;
32361 }
32362
32363 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
32364         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32365         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32366         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32367         return tag_ptr(ret_conv, true);
32368 }
32369
32370 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
32371         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
32372         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32373         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32374         return tag_ptr(ret_conv, true);
32375 }
32376
32377 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
32378         void* e_ptr = untag_ptr(e);
32379         CHECK_ACCESS(e_ptr);
32380         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32381         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32382         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32383         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32384         return tag_ptr(ret_conv, true);
32385 }
32386
32387 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
32388         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32389         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32390         return ret_conv;
32391 }
32392
32393 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
32394         if (!ptr_is_owned(_res)) return;
32395         void* _res_ptr = untag_ptr(_res);
32396         CHECK_ACCESS(_res_ptr);
32397         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32398         FREE(untag_ptr(_res));
32399         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32400 }
32401
32402 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32403         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32404         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32405         return tag_ptr(ret_conv, true);
32406 }
32407 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
32408         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32409         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32410         return ret_conv;
32411 }
32412
32413 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
32414         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32415         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32416         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32417         return tag_ptr(ret_conv, true);
32418 }
32419
32420 uint64_t  __attribute__((export_name("TS_COption_U128Z_some"))) TS_COption_U128Z_some(int8_tArray o) {
32421         LDKU128 o_ref;
32422         CHECK(o->arr_len == 16);
32423         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
32424         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32425         *ret_copy = COption_U128Z_some(o_ref);
32426         uint64_t ret_ref = tag_ptr(ret_copy, true);
32427         return ret_ref;
32428 }
32429
32430 uint64_t  __attribute__((export_name("TS_COption_U128Z_none"))) TS_COption_U128Z_none() {
32431         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32432         *ret_copy = COption_U128Z_none();
32433         uint64_t ret_ref = tag_ptr(ret_copy, true);
32434         return ret_ref;
32435 }
32436
32437 void  __attribute__((export_name("TS_COption_U128Z_free"))) TS_COption_U128Z_free(uint64_t _res) {
32438         if (!ptr_is_owned(_res)) return;
32439         void* _res_ptr = untag_ptr(_res);
32440         CHECK_ACCESS(_res_ptr);
32441         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32442         FREE(untag_ptr(_res));
32443         COption_U128Z_free(_res_conv);
32444 }
32445
32446 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32447         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32448         *ret_copy = COption_U128Z_clone(arg);
32449         uint64_t ret_ref = tag_ptr(ret_copy, true);
32450         return ret_ref;
32451 }
32452 int64_t  __attribute__((export_name("TS_COption_U128Z_clone_ptr"))) TS_COption_U128Z_clone_ptr(uint64_t arg) {
32453         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32454         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32455         return ret_conv;
32456 }
32457
32458 uint64_t  __attribute__((export_name("TS_COption_U128Z_clone"))) TS_COption_U128Z_clone(uint64_t orig) {
32459         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32460         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32461         *ret_copy = COption_U128Z_clone(orig_conv);
32462         uint64_t ret_ref = tag_ptr(ret_copy, true);
32463         return ret_ref;
32464 }
32465
32466 void  __attribute__((export_name("TS_CVec_ClaimedHTLCZ_free"))) TS_CVec_ClaimedHTLCZ_free(uint64_tArray _res) {
32467         LDKCVec_ClaimedHTLCZ _res_constr;
32468         _res_constr.datalen = _res->arr_len;
32469         if (_res_constr.datalen > 0)
32470                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32471         else
32472                 _res_constr.data = NULL;
32473         uint64_t* _res_vals = _res->elems;
32474         for (size_t n = 0; n < _res_constr.datalen; n++) {
32475                 uint64_t _res_conv_13 = _res_vals[n];
32476                 LDKClaimedHTLC _res_conv_13_conv;
32477                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32478                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32479                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32480                 _res_constr.data[n] = _res_conv_13_conv;
32481         }
32482         FREE(_res);
32483         CVec_ClaimedHTLCZ_free(_res_constr);
32484 }
32485
32486 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
32487         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
32488         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32489         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32490         uint64_t ret_ref = tag_ptr(ret_copy, true);
32491         return ret_ref;
32492 }
32493
32494 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
32495         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32496         *ret_copy = COption_PaymentFailureReasonZ_none();
32497         uint64_t ret_ref = tag_ptr(ret_copy, true);
32498         return ret_ref;
32499 }
32500
32501 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
32502         if (!ptr_is_owned(_res)) return;
32503         void* _res_ptr = untag_ptr(_res);
32504         CHECK_ACCESS(_res_ptr);
32505         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32506         FREE(untag_ptr(_res));
32507         COption_PaymentFailureReasonZ_free(_res_conv);
32508 }
32509
32510 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32511         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32512         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32513         uint64_t ret_ref = tag_ptr(ret_copy, true);
32514         return ret_ref;
32515 }
32516 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
32517         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32518         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32519         return ret_conv;
32520 }
32521
32522 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
32523         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32524         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32525         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32526         uint64_t ret_ref = tag_ptr(ret_copy, true);
32527         return ret_ref;
32528 }
32529
32530 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
32531         void* o_ptr = untag_ptr(o);
32532         CHECK_ACCESS(o_ptr);
32533         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32534         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32535         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32536         *ret_copy = COption_EventZ_some(o_conv);
32537         uint64_t ret_ref = tag_ptr(ret_copy, true);
32538         return ret_ref;
32539 }
32540
32541 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
32542         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32543         *ret_copy = COption_EventZ_none();
32544         uint64_t ret_ref = tag_ptr(ret_copy, true);
32545         return ret_ref;
32546 }
32547
32548 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
32549         if (!ptr_is_owned(_res)) return;
32550         void* _res_ptr = untag_ptr(_res);
32551         CHECK_ACCESS(_res_ptr);
32552         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32553         FREE(untag_ptr(_res));
32554         COption_EventZ_free(_res_conv);
32555 }
32556
32557 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32558         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32559         *ret_copy = COption_EventZ_clone(arg);
32560         uint64_t ret_ref = tag_ptr(ret_copy, true);
32561         return ret_ref;
32562 }
32563 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
32564         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32565         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32566         return ret_conv;
32567 }
32568
32569 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
32570         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32571         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32572         *ret_copy = COption_EventZ_clone(orig_conv);
32573         uint64_t ret_ref = tag_ptr(ret_copy, true);
32574         return ret_ref;
32575 }
32576
32577 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
32578         void* o_ptr = untag_ptr(o);
32579         CHECK_ACCESS(o_ptr);
32580         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32581         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32582         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32583         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32584         return tag_ptr(ret_conv, true);
32585 }
32586
32587 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
32588         void* e_ptr = untag_ptr(e);
32589         CHECK_ACCESS(e_ptr);
32590         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32591         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32592         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32593         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32594         return tag_ptr(ret_conv, true);
32595 }
32596
32597 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
32598         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32599         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32600         return ret_conv;
32601 }
32602
32603 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
32604         if (!ptr_is_owned(_res)) return;
32605         void* _res_ptr = untag_ptr(_res);
32606         CHECK_ACCESS(_res_ptr);
32607         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32608         FREE(untag_ptr(_res));
32609         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32610 }
32611
32612 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32613         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32614         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32615         return tag_ptr(ret_conv, true);
32616 }
32617 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
32618         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32619         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32620         return ret_conv;
32621 }
32622
32623 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
32624         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32625         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32626         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32627         return tag_ptr(ret_conv, true);
32628 }
32629
32630 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
32631         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
32632         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32633         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32634         return tag_ptr(ret_conv, true);
32635 }
32636
32637 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
32638         void* e_ptr = untag_ptr(e);
32639         CHECK_ACCESS(e_ptr);
32640         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32641         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32642         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32643         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32644         return tag_ptr(ret_conv, true);
32645 }
32646
32647 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
32648         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32649         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32650         return ret_conv;
32651 }
32652
32653 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
32654         if (!ptr_is_owned(_res)) return;
32655         void* _res_ptr = untag_ptr(_res);
32656         CHECK_ACCESS(_res_ptr);
32657         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32658         FREE(untag_ptr(_res));
32659         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32660 }
32661
32662 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32663         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32664         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32665         return tag_ptr(ret_conv, true);
32666 }
32667 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
32668         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32669         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32670         return ret_conv;
32671 }
32672
32673 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
32674         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32675         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32676         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32677         return tag_ptr(ret_conv, true);
32678 }
32679
32680 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
32681         LDKBolt11Invoice o_conv;
32682         o_conv.inner = untag_ptr(o);
32683         o_conv.is_owned = ptr_is_owned(o);
32684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32685         o_conv = Bolt11Invoice_clone(&o_conv);
32686         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32687         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32688         return tag_ptr(ret_conv, true);
32689 }
32690
32691 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
32692         void* e_ptr = untag_ptr(e);
32693         CHECK_ACCESS(e_ptr);
32694         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32695         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32696         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32697         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32698         return tag_ptr(ret_conv, true);
32699 }
32700
32701 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
32702         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32703         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32704         return ret_conv;
32705 }
32706
32707 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
32708         if (!ptr_is_owned(_res)) return;
32709         void* _res_ptr = untag_ptr(_res);
32710         CHECK_ACCESS(_res_ptr);
32711         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
32712         FREE(untag_ptr(_res));
32713         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
32714 }
32715
32716 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
32717         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32718         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
32719         return tag_ptr(ret_conv, true);
32720 }
32721 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
32722         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
32723         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
32724         return ret_conv;
32725 }
32726
32727 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
32728         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
32729         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32730         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
32731         return tag_ptr(ret_conv, true);
32732 }
32733
32734 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
32735         LDKSignedRawBolt11Invoice o_conv;
32736         o_conv.inner = untag_ptr(o);
32737         o_conv.is_owned = ptr_is_owned(o);
32738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32739         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
32740         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32741         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
32742         return tag_ptr(ret_conv, true);
32743 }
32744
32745 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
32746         void* e_ptr = untag_ptr(e);
32747         CHECK_ACCESS(e_ptr);
32748         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32749         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32750         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32751         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
32752         return tag_ptr(ret_conv, true);
32753 }
32754
32755 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
32756         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
32757         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
32758         return ret_conv;
32759 }
32760
32761 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
32762         if (!ptr_is_owned(_res)) return;
32763         void* _res_ptr = untag_ptr(_res);
32764         CHECK_ACCESS(_res_ptr);
32765         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
32766         FREE(untag_ptr(_res));
32767         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
32768 }
32769
32770 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
32771         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32772         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
32773         return tag_ptr(ret_conv, true);
32774 }
32775 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
32776         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
32777         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
32778         return ret_conv;
32779 }
32780
32781 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
32782         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
32783         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32784         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
32785         return tag_ptr(ret_conv, true);
32786 }
32787
32788 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
32789         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32790         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
32791         return tag_ptr(ret_conv, true);
32792 }
32793 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
32794         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
32795         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
32796         return ret_conv;
32797 }
32798
32799 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
32800         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
32801         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32802         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
32803         return tag_ptr(ret_conv, true);
32804 }
32805
32806 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
32807         LDKRawBolt11Invoice a_conv;
32808         a_conv.inner = untag_ptr(a);
32809         a_conv.is_owned = ptr_is_owned(a);
32810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32811         a_conv = RawBolt11Invoice_clone(&a_conv);
32812         LDKThirtyTwoBytes b_ref;
32813         CHECK(b->arr_len == 32);
32814         memcpy(b_ref.data, b->elems, 32); FREE(b);
32815         LDKBolt11InvoiceSignature c_conv;
32816         c_conv.inner = untag_ptr(c);
32817         c_conv.is_owned = ptr_is_owned(c);
32818         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32819         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
32820         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32821         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
32822         return tag_ptr(ret_conv, true);
32823 }
32824
32825 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
32826         if (!ptr_is_owned(_res)) return;
32827         void* _res_ptr = untag_ptr(_res);
32828         CHECK_ACCESS(_res_ptr);
32829         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
32830         FREE(untag_ptr(_res));
32831         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
32832 }
32833
32834 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_ok(uint64_t o) {
32835         LDKPayeePubKey o_conv;
32836         o_conv.inner = untag_ptr(o);
32837         o_conv.is_owned = ptr_is_owned(o);
32838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32839         o_conv = PayeePubKey_clone(&o_conv);
32840         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32841         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
32842         return tag_ptr(ret_conv, true);
32843 }
32844
32845 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_err"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_err(uint32_t e) {
32846         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
32847         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32848         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
32849         return tag_ptr(ret_conv, true);
32850 }
32851
32852 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(uint64_t o) {
32853         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
32854         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
32855         return ret_conv;
32856 }
32857
32858 void  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_free"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_free(uint64_t _res) {
32859         if (!ptr_is_owned(_res)) return;
32860         void* _res_ptr = untag_ptr(_res);
32861         CHECK_ACCESS(_res_ptr);
32862         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
32863         FREE(untag_ptr(_res));
32864         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
32865 }
32866
32867 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
32868         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32869         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
32870         return tag_ptr(ret_conv, true);
32871 }
32872 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(uint64_t arg) {
32873         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
32874         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
32875         return ret_conv;
32876 }
32877
32878 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeySecp256k1ErrorZ_clone"))) TS_CResult_PayeePubKeySecp256k1ErrorZ_clone(uint64_t orig) {
32879         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
32880         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32881         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
32882         return tag_ptr(ret_conv, true);
32883 }
32884
32885 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
32886         LDKCVec_PrivateRouteZ _res_constr;
32887         _res_constr.datalen = _res->arr_len;
32888         if (_res_constr.datalen > 0)
32889                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
32890         else
32891                 _res_constr.data = NULL;
32892         uint64_t* _res_vals = _res->elems;
32893         for (size_t o = 0; o < _res_constr.datalen; o++) {
32894                 uint64_t _res_conv_14 = _res_vals[o];
32895                 LDKPrivateRoute _res_conv_14_conv;
32896                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
32897                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
32898                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
32899                 _res_constr.data[o] = _res_conv_14_conv;
32900         }
32901         FREE(_res);
32902         CVec_PrivateRouteZ_free(_res_constr);
32903 }
32904
32905 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
32906         LDKPositiveTimestamp o_conv;
32907         o_conv.inner = untag_ptr(o);
32908         o_conv.is_owned = ptr_is_owned(o);
32909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32910         o_conv = PositiveTimestamp_clone(&o_conv);
32911         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32912         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
32913         return tag_ptr(ret_conv, true);
32914 }
32915
32916 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
32917         LDKCreationError e_conv = LDKCreationError_from_js(e);
32918         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32919         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
32920         return tag_ptr(ret_conv, true);
32921 }
32922
32923 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
32924         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
32925         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
32926         return ret_conv;
32927 }
32928
32929 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
32930         if (!ptr_is_owned(_res)) return;
32931         void* _res_ptr = untag_ptr(_res);
32932         CHECK_ACCESS(_res_ptr);
32933         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
32934         FREE(untag_ptr(_res));
32935         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
32936 }
32937
32938 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
32939         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32940         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
32941         return tag_ptr(ret_conv, true);
32942 }
32943 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
32944         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
32945         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
32946         return ret_conv;
32947 }
32948
32949 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
32950         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
32951         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32952         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
32953         return tag_ptr(ret_conv, true);
32954 }
32955
32956 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
32957         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32958         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
32959         return tag_ptr(ret_conv, true);
32960 }
32961
32962 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
32963         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
32964         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32965         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
32966         return tag_ptr(ret_conv, true);
32967 }
32968
32969 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
32970         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
32971         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
32972         return ret_conv;
32973 }
32974
32975 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
32976         if (!ptr_is_owned(_res)) return;
32977         void* _res_ptr = untag_ptr(_res);
32978         CHECK_ACCESS(_res_ptr);
32979         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
32980         FREE(untag_ptr(_res));
32981         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
32982 }
32983
32984 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
32985         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32986         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
32987         return tag_ptr(ret_conv, true);
32988 }
32989 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
32990         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
32991         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
32992         return ret_conv;
32993 }
32994
32995 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
32996         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
32997         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32998         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
32999         return tag_ptr(ret_conv, true);
33000 }
33001
33002 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
33003         LDKBolt11Invoice o_conv;
33004         o_conv.inner = untag_ptr(o);
33005         o_conv.is_owned = ptr_is_owned(o);
33006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33007         o_conv = Bolt11Invoice_clone(&o_conv);
33008         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33009         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
33010         return tag_ptr(ret_conv, true);
33011 }
33012
33013 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
33014         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
33015         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33016         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
33017         return tag_ptr(ret_conv, true);
33018 }
33019
33020 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
33021         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
33022         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
33023         return ret_conv;
33024 }
33025
33026 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
33027         if (!ptr_is_owned(_res)) return;
33028         void* _res_ptr = untag_ptr(_res);
33029         CHECK_ACCESS(_res_ptr);
33030         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
33031         FREE(untag_ptr(_res));
33032         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
33033 }
33034
33035 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
33036         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33037         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
33038         return tag_ptr(ret_conv, true);
33039 }
33040 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
33041         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
33042         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
33043         return ret_conv;
33044 }
33045
33046 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
33047         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
33048         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33049         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
33050         return tag_ptr(ret_conv, true);
33051 }
33052
33053 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
33054         LDKDescription o_conv;
33055         o_conv.inner = untag_ptr(o);
33056         o_conv.is_owned = ptr_is_owned(o);
33057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33058         o_conv = Description_clone(&o_conv);
33059         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33060         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
33061         return tag_ptr(ret_conv, true);
33062 }
33063
33064 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
33065         LDKCreationError e_conv = LDKCreationError_from_js(e);
33066         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33067         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
33068         return tag_ptr(ret_conv, true);
33069 }
33070
33071 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
33072         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
33073         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
33074         return ret_conv;
33075 }
33076
33077 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
33078         if (!ptr_is_owned(_res)) return;
33079         void* _res_ptr = untag_ptr(_res);
33080         CHECK_ACCESS(_res_ptr);
33081         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
33082         FREE(untag_ptr(_res));
33083         CResult_DescriptionCreationErrorZ_free(_res_conv);
33084 }
33085
33086 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
33087         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33088         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
33089         return tag_ptr(ret_conv, true);
33090 }
33091 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
33092         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
33093         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
33094         return ret_conv;
33095 }
33096
33097 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
33098         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
33099         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33100         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
33101         return tag_ptr(ret_conv, true);
33102 }
33103
33104 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
33105         LDKPrivateRoute o_conv;
33106         o_conv.inner = untag_ptr(o);
33107         o_conv.is_owned = ptr_is_owned(o);
33108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33109         o_conv = PrivateRoute_clone(&o_conv);
33110         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33111         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
33112         return tag_ptr(ret_conv, true);
33113 }
33114
33115 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
33116         LDKCreationError e_conv = LDKCreationError_from_js(e);
33117         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33118         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
33119         return tag_ptr(ret_conv, true);
33120 }
33121
33122 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
33123         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
33124         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
33125         return ret_conv;
33126 }
33127
33128 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
33129         if (!ptr_is_owned(_res)) return;
33130         void* _res_ptr = untag_ptr(_res);
33131         CHECK_ACCESS(_res_ptr);
33132         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
33133         FREE(untag_ptr(_res));
33134         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
33135 }
33136
33137 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
33138         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33139         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
33140         return tag_ptr(ret_conv, true);
33141 }
33142 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
33143         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
33144         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
33145         return ret_conv;
33146 }
33147
33148 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
33149         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
33150         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33151         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
33152         return tag_ptr(ret_conv, true);
33153 }
33154
33155 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
33156         LDKOutPoint o_conv;
33157         o_conv.inner = untag_ptr(o);
33158         o_conv.is_owned = ptr_is_owned(o);
33159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33160         o_conv = OutPoint_clone(&o_conv);
33161         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33162         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
33163         return tag_ptr(ret_conv, true);
33164 }
33165
33166 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
33167         void* e_ptr = untag_ptr(e);
33168         CHECK_ACCESS(e_ptr);
33169         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33170         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33171         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33172         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
33173         return tag_ptr(ret_conv, true);
33174 }
33175
33176 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
33177         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
33178         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
33179         return ret_conv;
33180 }
33181
33182 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
33183         if (!ptr_is_owned(_res)) return;
33184         void* _res_ptr = untag_ptr(_res);
33185         CHECK_ACCESS(_res_ptr);
33186         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
33187         FREE(untag_ptr(_res));
33188         CResult_OutPointDecodeErrorZ_free(_res_conv);
33189 }
33190
33191 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
33192         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33193         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
33194         return tag_ptr(ret_conv, true);
33195 }
33196 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
33197         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
33198         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
33199         return ret_conv;
33200 }
33201
33202 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
33203         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
33204         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33205         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
33206         return tag_ptr(ret_conv, true);
33207 }
33208
33209 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
33210         LDKBigSize o_conv;
33211         o_conv.inner = untag_ptr(o);
33212         o_conv.is_owned = ptr_is_owned(o);
33213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33214         o_conv = BigSize_clone(&o_conv);
33215         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33216         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
33217         return tag_ptr(ret_conv, true);
33218 }
33219
33220 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
33221         void* e_ptr = untag_ptr(e);
33222         CHECK_ACCESS(e_ptr);
33223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33225         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33226         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
33227         return tag_ptr(ret_conv, true);
33228 }
33229
33230 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
33231         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33232         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33233         return ret_conv;
33234 }
33235
33236 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
33237         if (!ptr_is_owned(_res)) return;
33238         void* _res_ptr = untag_ptr(_res);
33239         CHECK_ACCESS(_res_ptr);
33240         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33241         FREE(untag_ptr(_res));
33242         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33243 }
33244
33245 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33246         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33247         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33248         return tag_ptr(ret_conv, true);
33249 }
33250 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
33251         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33252         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33253         return ret_conv;
33254 }
33255
33256 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
33257         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33258         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33259         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33260         return tag_ptr(ret_conv, true);
33261 }
33262
33263 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
33264         LDKHostname o_conv;
33265         o_conv.inner = untag_ptr(o);
33266         o_conv.is_owned = ptr_is_owned(o);
33267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33268         o_conv = Hostname_clone(&o_conv);
33269         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33270         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33271         return tag_ptr(ret_conv, true);
33272 }
33273
33274 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
33275         void* e_ptr = untag_ptr(e);
33276         CHECK_ACCESS(e_ptr);
33277         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33278         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33279         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33280         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33281         return tag_ptr(ret_conv, true);
33282 }
33283
33284 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
33285         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33286         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33287         return ret_conv;
33288 }
33289
33290 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
33291         if (!ptr_is_owned(_res)) return;
33292         void* _res_ptr = untag_ptr(_res);
33293         CHECK_ACCESS(_res_ptr);
33294         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33295         FREE(untag_ptr(_res));
33296         CResult_HostnameDecodeErrorZ_free(_res_conv);
33297 }
33298
33299 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33300         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33301         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33302         return tag_ptr(ret_conv, true);
33303 }
33304 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
33305         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33306         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33307         return ret_conv;
33308 }
33309
33310 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
33311         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33312         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33313         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33314         return tag_ptr(ret_conv, true);
33315 }
33316
33317 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
33318         LDKTransactionU16LenLimited o_conv;
33319         o_conv.inner = untag_ptr(o);
33320         o_conv.is_owned = ptr_is_owned(o);
33321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33322         o_conv = TransactionU16LenLimited_clone(&o_conv);
33323         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33324         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33325         return tag_ptr(ret_conv, true);
33326 }
33327
33328 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
33329         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33330         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33331         return tag_ptr(ret_conv, true);
33332 }
33333
33334 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
33335         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33336         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33337         return ret_conv;
33338 }
33339
33340 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
33341         if (!ptr_is_owned(_res)) return;
33342         void* _res_ptr = untag_ptr(_res);
33343         CHECK_ACCESS(_res_ptr);
33344         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33345         FREE(untag_ptr(_res));
33346         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33347 }
33348
33349 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33350         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33351         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33352         return tag_ptr(ret_conv, true);
33353 }
33354 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
33355         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33356         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33357         return ret_conv;
33358 }
33359
33360 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
33361         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33362         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33363         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33364         return tag_ptr(ret_conv, true);
33365 }
33366
33367 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
33368         LDKTransactionU16LenLimited o_conv;
33369         o_conv.inner = untag_ptr(o);
33370         o_conv.is_owned = ptr_is_owned(o);
33371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33372         o_conv = TransactionU16LenLimited_clone(&o_conv);
33373         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33374         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33375         return tag_ptr(ret_conv, true);
33376 }
33377
33378 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
33379         void* e_ptr = untag_ptr(e);
33380         CHECK_ACCESS(e_ptr);
33381         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33382         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33383         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33384         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33385         return tag_ptr(ret_conv, true);
33386 }
33387
33388 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
33389         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33390         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33391         return ret_conv;
33392 }
33393
33394 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
33395         if (!ptr_is_owned(_res)) return;
33396         void* _res_ptr = untag_ptr(_res);
33397         CHECK_ACCESS(_res_ptr);
33398         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33399         FREE(untag_ptr(_res));
33400         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33401 }
33402
33403 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33404         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33405         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33406         return tag_ptr(ret_conv, true);
33407 }
33408 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
33409         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33410         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33411         return ret_conv;
33412 }
33413
33414 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
33415         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33416         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33417         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33418         return tag_ptr(ret_conv, true);
33419 }
33420
33421 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
33422         LDKUntrustedString o_conv;
33423         o_conv.inner = untag_ptr(o);
33424         o_conv.is_owned = ptr_is_owned(o);
33425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33426         o_conv = UntrustedString_clone(&o_conv);
33427         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33428         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33429         return tag_ptr(ret_conv, true);
33430 }
33431
33432 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
33433         void* e_ptr = untag_ptr(e);
33434         CHECK_ACCESS(e_ptr);
33435         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33436         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33437         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33438         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33439         return tag_ptr(ret_conv, true);
33440 }
33441
33442 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
33443         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33444         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33445         return ret_conv;
33446 }
33447
33448 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
33449         if (!ptr_is_owned(_res)) return;
33450         void* _res_ptr = untag_ptr(_res);
33451         CHECK_ACCESS(_res_ptr);
33452         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33453         FREE(untag_ptr(_res));
33454         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33455 }
33456
33457 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33458         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33459         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33460         return tag_ptr(ret_conv, true);
33461 }
33462 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
33463         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33464         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33465         return ret_conv;
33466 }
33467
33468 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
33469         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33470         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33471         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33472         return tag_ptr(ret_conv, true);
33473 }
33474
33475 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_ok"))) TS_CResult_ChannelIdDecodeErrorZ_ok(uint64_t o) {
33476         LDKChannelId o_conv;
33477         o_conv.inner = untag_ptr(o);
33478         o_conv.is_owned = ptr_is_owned(o);
33479         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33480         o_conv = ChannelId_clone(&o_conv);
33481         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33482         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
33483         return tag_ptr(ret_conv, true);
33484 }
33485
33486 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_err"))) TS_CResult_ChannelIdDecodeErrorZ_err(uint64_t e) {
33487         void* e_ptr = untag_ptr(e);
33488         CHECK_ACCESS(e_ptr);
33489         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33490         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33491         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33492         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
33493         return tag_ptr(ret_conv, true);
33494 }
33495
33496 jboolean  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_is_ok"))) TS_CResult_ChannelIdDecodeErrorZ_is_ok(uint64_t o) {
33497         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
33498         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
33499         return ret_conv;
33500 }
33501
33502 void  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_free"))) TS_CResult_ChannelIdDecodeErrorZ_free(uint64_t _res) {
33503         if (!ptr_is_owned(_res)) return;
33504         void* _res_ptr = untag_ptr(_res);
33505         CHECK_ACCESS(_res_ptr);
33506         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
33507         FREE(untag_ptr(_res));
33508         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
33509 }
33510
33511 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
33512         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33513         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
33514         return tag_ptr(ret_conv, true);
33515 }
33516 int64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelIdDecodeErrorZ_clone_ptr(uint64_t arg) {
33517         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
33518         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
33519         return ret_conv;
33520 }
33521
33522 uint64_t  __attribute__((export_name("TS_CResult_ChannelIdDecodeErrorZ_clone"))) TS_CResult_ChannelIdDecodeErrorZ_clone(uint64_t orig) {
33523         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
33524         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33525         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
33526         return tag_ptr(ret_conv, true);
33527 }
33528
33529 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
33530         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33531         *ret_conv = C2Tuple__u832u16Z_clone(arg);
33532         return tag_ptr(ret_conv, true);
33533 }
33534 int64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone_ptr"))) TS_C2Tuple__u832u16Z_clone_ptr(uint64_t arg) {
33535         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
33536         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
33537         return ret_conv;
33538 }
33539
33540 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_clone"))) TS_C2Tuple__u832u16Z_clone(uint64_t orig) {
33541         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
33542         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33543         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
33544         return tag_ptr(ret_conv, true);
33545 }
33546
33547 uint64_t  __attribute__((export_name("TS_C2Tuple__u832u16Z_new"))) TS_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
33548         LDKThirtyTwoBytes a_ref;
33549         CHECK(a->arr_len == 32);
33550         memcpy(a_ref.data, a->elems, 32); FREE(a);
33551         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33552         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
33553         return tag_ptr(ret_conv, true);
33554 }
33555
33556 void  __attribute__((export_name("TS_C2Tuple__u832u16Z_free"))) TS_C2Tuple__u832u16Z_free(uint64_t _res) {
33557         if (!ptr_is_owned(_res)) return;
33558         void* _res_ptr = untag_ptr(_res);
33559         CHECK_ACCESS(_res_ptr);
33560         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
33561         FREE(untag_ptr(_res));
33562         C2Tuple__u832u16Z_free(_res_conv);
33563 }
33564
33565 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_ok(uint64_t o) {
33566         LDKPaymentRelay o_conv;
33567         o_conv.inner = untag_ptr(o);
33568         o_conv.is_owned = ptr_is_owned(o);
33569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33570         o_conv = PaymentRelay_clone(&o_conv);
33571         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33572         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33573         return tag_ptr(ret_conv, true);
33574 }
33575
33576 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_err"))) TS_CResult_PaymentRelayDecodeErrorZ_err(uint64_t e) {
33577         void* e_ptr = untag_ptr(e);
33578         CHECK_ACCESS(e_ptr);
33579         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33580         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33581         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33582         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33583         return tag_ptr(ret_conv, true);
33584 }
33585
33586 jboolean  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_is_ok"))) TS_CResult_PaymentRelayDecodeErrorZ_is_ok(uint64_t o) {
33587         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33588         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33589         return ret_conv;
33590 }
33591
33592 void  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_free"))) TS_CResult_PaymentRelayDecodeErrorZ_free(uint64_t _res) {
33593         if (!ptr_is_owned(_res)) return;
33594         void* _res_ptr = untag_ptr(_res);
33595         CHECK_ACCESS(_res_ptr);
33596         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33597         FREE(untag_ptr(_res));
33598         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33599 }
33600
33601 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33602         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33603         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33604         return tag_ptr(ret_conv, true);
33605 }
33606 int64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentRelayDecodeErrorZ_clone_ptr(uint64_t arg) {
33607         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33608         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33609         return ret_conv;
33610 }
33611
33612 uint64_t  __attribute__((export_name("TS_CResult_PaymentRelayDecodeErrorZ_clone"))) TS_CResult_PaymentRelayDecodeErrorZ_clone(uint64_t orig) {
33613         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33614         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33615         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33616         return tag_ptr(ret_conv, true);
33617 }
33618
33619 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_ok(uint64_t o) {
33620         LDKPaymentConstraints o_conv;
33621         o_conv.inner = untag_ptr(o);
33622         o_conv.is_owned = ptr_is_owned(o);
33623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33624         o_conv = PaymentConstraints_clone(&o_conv);
33625         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33626         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33627         return tag_ptr(ret_conv, true);
33628 }
33629
33630 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_err"))) TS_CResult_PaymentConstraintsDecodeErrorZ_err(uint64_t e) {
33631         void* e_ptr = untag_ptr(e);
33632         CHECK_ACCESS(e_ptr);
33633         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33634         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33635         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33636         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33637         return tag_ptr(ret_conv, true);
33638 }
33639
33640 jboolean  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok"))) TS_CResult_PaymentConstraintsDecodeErrorZ_is_ok(uint64_t o) {
33641         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33642         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33643         return ret_conv;
33644 }
33645
33646 void  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_free"))) TS_CResult_PaymentConstraintsDecodeErrorZ_free(uint64_t _res) {
33647         if (!ptr_is_owned(_res)) return;
33648         void* _res_ptr = untag_ptr(_res);
33649         CHECK_ACCESS(_res_ptr);
33650         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33651         FREE(untag_ptr(_res));
33652         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33653 }
33654
33655 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33656         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33657         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33658         return tag_ptr(ret_conv, true);
33659 }
33660 int64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(uint64_t arg) {
33661         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33662         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33663         return ret_conv;
33664 }
33665
33666 uint64_t  __attribute__((export_name("TS_CResult_PaymentConstraintsDecodeErrorZ_clone"))) TS_CResult_PaymentConstraintsDecodeErrorZ_clone(uint64_t orig) {
33667         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33668         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33669         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33670         return tag_ptr(ret_conv, true);
33671 }
33672
33673 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_ok"))) TS_CResult_PaymentContextDecodeErrorZ_ok(uint64_t o) {
33674         void* o_ptr = untag_ptr(o);
33675         CHECK_ACCESS(o_ptr);
33676         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
33677         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
33678         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33679         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
33680         return tag_ptr(ret_conv, true);
33681 }
33682
33683 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_err"))) TS_CResult_PaymentContextDecodeErrorZ_err(uint64_t e) {
33684         void* e_ptr = untag_ptr(e);
33685         CHECK_ACCESS(e_ptr);
33686         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33687         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33688         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33689         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
33690         return tag_ptr(ret_conv, true);
33691 }
33692
33693 jboolean  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_is_ok"))) TS_CResult_PaymentContextDecodeErrorZ_is_ok(uint64_t o) {
33694         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
33695         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
33696         return ret_conv;
33697 }
33698
33699 void  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_free"))) TS_CResult_PaymentContextDecodeErrorZ_free(uint64_t _res) {
33700         if (!ptr_is_owned(_res)) return;
33701         void* _res_ptr = untag_ptr(_res);
33702         CHECK_ACCESS(_res_ptr);
33703         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
33704         FREE(untag_ptr(_res));
33705         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
33706 }
33707
33708 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33709         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33710         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
33711         return tag_ptr(ret_conv, true);
33712 }
33713 int64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33714         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
33715         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33716         return ret_conv;
33717 }
33718
33719 uint64_t  __attribute__((export_name("TS_CResult_PaymentContextDecodeErrorZ_clone"))) TS_CResult_PaymentContextDecodeErrorZ_clone(uint64_t orig) {
33720         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
33721         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33722         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
33723         return tag_ptr(ret_conv, true);
33724 }
33725
33726 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_ok(uint64_t o) {
33727         LDKUnknownPaymentContext o_conv;
33728         o_conv.inner = untag_ptr(o);
33729         o_conv.is_owned = ptr_is_owned(o);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33731         o_conv = UnknownPaymentContext_clone(&o_conv);
33732         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33733         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
33734         return tag_ptr(ret_conv, true);
33735 }
33736
33737 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_err"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_err(uint64_t e) {
33738         void* e_ptr = untag_ptr(e);
33739         CHECK_ACCESS(e_ptr);
33740         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33741         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33742         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33743         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
33744         return tag_ptr(ret_conv, true);
33745 }
33746
33747 jboolean  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_is_ok"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_is_ok(uint64_t o) {
33748         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
33749         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
33750         return ret_conv;
33751 }
33752
33753 void  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_free"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_free(uint64_t _res) {
33754         if (!ptr_is_owned(_res)) return;
33755         void* _res_ptr = untag_ptr(_res);
33756         CHECK_ACCESS(_res_ptr);
33757         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
33758         FREE(untag_ptr(_res));
33759         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
33760 }
33761
33762 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33763         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33764         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
33765         return tag_ptr(ret_conv, true);
33766 }
33767 int64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33768         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
33769         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33770         return ret_conv;
33771 }
33772
33773 uint64_t  __attribute__((export_name("TS_CResult_UnknownPaymentContextDecodeErrorZ_clone"))) TS_CResult_UnknownPaymentContextDecodeErrorZ_clone(uint64_t orig) {
33774         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
33775         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33776         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
33777         return tag_ptr(ret_conv, true);
33778 }
33779
33780 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_ok(uint64_t o) {
33781         LDKBolt12OfferContext o_conv;
33782         o_conv.inner = untag_ptr(o);
33783         o_conv.is_owned = ptr_is_owned(o);
33784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33785         o_conv = Bolt12OfferContext_clone(&o_conv);
33786         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33787         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
33788         return tag_ptr(ret_conv, true);
33789 }
33790
33791 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_err"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_err(uint64_t e) {
33792         void* e_ptr = untag_ptr(e);
33793         CHECK_ACCESS(e_ptr);
33794         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33795         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33796         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33797         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
33798         return tag_ptr(ret_conv, true);
33799 }
33800
33801 jboolean  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_is_ok"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_is_ok(uint64_t o) {
33802         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
33803         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
33804         return ret_conv;
33805 }
33806
33807 void  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_free"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_free(uint64_t _res) {
33808         if (!ptr_is_owned(_res)) return;
33809         void* _res_ptr = untag_ptr(_res);
33810         CHECK_ACCESS(_res_ptr);
33811         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
33812         FREE(untag_ptr(_res));
33813         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
33814 }
33815
33816 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
33817         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33818         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
33819         return tag_ptr(ret_conv, true);
33820 }
33821 int64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33822         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
33823         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
33824         return ret_conv;
33825 }
33826
33827 uint64_t  __attribute__((export_name("TS_CResult_Bolt12OfferContextDecodeErrorZ_clone"))) TS_CResult_Bolt12OfferContextDecodeErrorZ_clone(uint64_t orig) {
33828         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
33829         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33830         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
33831         return tag_ptr(ret_conv, true);
33832 }
33833
33834 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_ok(uint64_t o) {
33835         LDKBolt12RefundContext o_conv;
33836         o_conv.inner = untag_ptr(o);
33837         o_conv.is_owned = ptr_is_owned(o);
33838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33839         o_conv = Bolt12RefundContext_clone(&o_conv);
33840         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33841         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
33842         return tag_ptr(ret_conv, true);
33843 }
33844
33845 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_err"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_err(uint64_t e) {
33846         void* e_ptr = untag_ptr(e);
33847         CHECK_ACCESS(e_ptr);
33848         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33849         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33850         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33851         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
33852         return tag_ptr(ret_conv, true);
33853 }
33854
33855 jboolean  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_is_ok"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_is_ok(uint64_t o) {
33856         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
33857         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
33858         return ret_conv;
33859 }
33860
33861 void  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_free"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_free(uint64_t _res) {
33862         if (!ptr_is_owned(_res)) return;
33863         void* _res_ptr = untag_ptr(_res);
33864         CHECK_ACCESS(_res_ptr);
33865         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
33866         FREE(untag_ptr(_res));
33867         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
33868 }
33869
33870 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
33871         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33872         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
33873         return tag_ptr(ret_conv, true);
33874 }
33875 int64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(uint64_t arg) {
33876         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
33877         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
33878         return ret_conv;
33879 }
33880
33881 uint64_t  __attribute__((export_name("TS_CResult_Bolt12RefundContextDecodeErrorZ_clone"))) TS_CResult_Bolt12RefundContextDecodeErrorZ_clone(uint64_t orig) {
33882         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
33883         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33884         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
33885         return tag_ptr(ret_conv, true);
33886 }
33887
33888 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_ok"))) TS_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
33889         LDKStr o_conv = str_ref_to_owned_c(o);
33890         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33891         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
33892         return tag_ptr(ret_conv, true);
33893 }
33894
33895 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_err"))) TS_CResult_StrSecp256k1ErrorZ_err(uint32_t e) {
33896         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
33897         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33898         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
33899         return tag_ptr(ret_conv, true);
33900 }
33901
33902 jboolean  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_is_ok"))) TS_CResult_StrSecp256k1ErrorZ_is_ok(uint64_t o) {
33903         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
33904         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
33905         return ret_conv;
33906 }
33907
33908 void  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_free"))) TS_CResult_StrSecp256k1ErrorZ_free(uint64_t _res) {
33909         if (!ptr_is_owned(_res)) return;
33910         void* _res_ptr = untag_ptr(_res);
33911         CHECK_ACCESS(_res_ptr);
33912         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
33913         FREE(untag_ptr(_res));
33914         CResult_StrSecp256k1ErrorZ_free(_res_conv);
33915 }
33916
33917 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
33918         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33919         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
33920         return tag_ptr(ret_conv, true);
33921 }
33922 int64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone_ptr"))) TS_CResult_StrSecp256k1ErrorZ_clone_ptr(uint64_t arg) {
33923         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
33924         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
33925         return ret_conv;
33926 }
33927
33928 uint64_t  __attribute__((export_name("TS_CResult_StrSecp256k1ErrorZ_clone"))) TS_CResult_StrSecp256k1ErrorZ_clone(uint64_t orig) {
33929         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
33930         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33931         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
33932         return tag_ptr(ret_conv, true);
33933 }
33934
33935 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
33936         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33937         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
33938         return tag_ptr(ret_conv, true);
33939 }
33940 int64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(uint64_t arg) {
33941         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
33942         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
33943         return ret_conv;
33944 }
33945
33946 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(uint64_t orig) {
33947         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
33948         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33949         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
33950         return tag_ptr(ret_conv, true);
33951 }
33952
33953 uint64_t  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, uint64_t b, uint64_t c) {
33954         LDKThirtyTwoBytes a_ref;
33955         CHECK(a->arr_len == 32);
33956         memcpy(a_ref.data, a->elems, 32); FREE(a);
33957         LDKRecipientOnionFields b_conv;
33958         b_conv.inner = untag_ptr(b);
33959         b_conv.is_owned = ptr_is_owned(b);
33960         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33961         b_conv = RecipientOnionFields_clone(&b_conv);
33962         LDKRouteParameters c_conv;
33963         c_conv.inner = untag_ptr(c);
33964         c_conv.is_owned = ptr_is_owned(c);
33965         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33966         c_conv = RouteParameters_clone(&c_conv);
33967         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33968         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
33969         return tag_ptr(ret_conv, true);
33970 }
33971
33972 void  __attribute__((export_name("TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free"))) TS_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(uint64_t _res) {
33973         if (!ptr_is_owned(_res)) return;
33974         void* _res_ptr = untag_ptr(_res);
33975         CHECK_ACCESS(_res_ptr);
33976         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
33977         FREE(untag_ptr(_res));
33978         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
33979 }
33980
33981 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(uint64_t o) {
33982         void* o_ptr = untag_ptr(o);
33983         CHECK_ACCESS(o_ptr);
33984         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
33985         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
33986         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33987         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
33988         return tag_ptr(ret_conv, true);
33989 }
33990
33991 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
33992         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33993         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
33994         return tag_ptr(ret_conv, true);
33995 }
33996
33997 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(uint64_t o) {
33998         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
33999         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
34000         return ret_conv;
34001 }
34002
34003 void  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(uint64_t _res) {
34004         if (!ptr_is_owned(_res)) return;
34005         void* _res_ptr = untag_ptr(_res);
34006         CHECK_ACCESS(_res_ptr);
34007         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
34008         FREE(untag_ptr(_res));
34009         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
34010 }
34011
34012 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
34013         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
34014         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
34015         return tag_ptr(ret_conv, true);
34016 }
34017 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(uint64_t arg) {
34018         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
34019         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
34020         return ret_conv;
34021 }
34022
34023 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone"))) TS_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(uint64_t orig) {
34024         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
34025         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
34026         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
34027         return tag_ptr(ret_conv, true);
34028 }
34029
34030 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
34031         void* o_ptr = untag_ptr(o);
34032         CHECK_ACCESS(o_ptr);
34033         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
34034         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
34035         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34036         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
34037         return tag_ptr(ret_conv, true);
34038 }
34039
34040 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
34041         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
34042         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34043         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
34044         return tag_ptr(ret_conv, true);
34045 }
34046
34047 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
34048         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
34049         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
34050         return ret_conv;
34051 }
34052
34053 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
34054         if (!ptr_is_owned(_res)) return;
34055         void* _res_ptr = untag_ptr(_res);
34056         CHECK_ACCESS(_res_ptr);
34057         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
34058         FREE(untag_ptr(_res));
34059         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
34060 }
34061
34062 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
34063         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34064         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
34065         return tag_ptr(ret_conv, true);
34066 }
34067 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
34068         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
34069         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
34070         return ret_conv;
34071 }
34072
34073 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
34074         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
34075         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34076         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
34077         return tag_ptr(ret_conv, true);
34078 }
34079
34080 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
34081         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
34082         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
34083         return tag_ptr(ret_conv, true);
34084 }
34085 int64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(uint64_t arg) {
34086         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
34087         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
34088         return ret_conv;
34089 }
34090
34091 uint64_t  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(uint64_t orig) {
34092         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
34093         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
34094         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
34095         return tag_ptr(ret_conv, true);
34096 }
34097
34098 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) {
34099         LDKPublicKey a_ref;
34100         CHECK(a->arr_len == 33);
34101         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
34102         LDKOnionMessage b_conv;
34103         b_conv.inner = untag_ptr(b);
34104         b_conv.is_owned = ptr_is_owned(b);
34105         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34106         b_conv = OnionMessage_clone(&b_conv);
34107         void* c_ptr = untag_ptr(c);
34108         CHECK_ACCESS(c_ptr);
34109         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
34110         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
34111         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
34112         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
34113         return tag_ptr(ret_conv, true);
34114 }
34115
34116 void  __attribute__((export_name("TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free"))) TS_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(uint64_t _res) {
34117         if (!ptr_is_owned(_res)) return;
34118         void* _res_ptr = untag_ptr(_res);
34119         CHECK_ACCESS(_res_ptr);
34120         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
34121         FREE(untag_ptr(_res));
34122         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
34123 }
34124
34125 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(uint64_t o) {
34126         void* o_ptr = untag_ptr(o);
34127         CHECK_ACCESS(o_ptr);
34128         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
34129         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
34130         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34131         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
34132         return tag_ptr(ret_conv, true);
34133 }
34134
34135 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(uint64_t e) {
34136         void* e_ptr = untag_ptr(e);
34137         CHECK_ACCESS(e_ptr);
34138         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34139         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34140         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34141         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
34142         return tag_ptr(ret_conv, true);
34143 }
34144
34145 jboolean  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(uint64_t o) {
34146         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
34147         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
34148         return ret_conv;
34149 }
34150
34151 void  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(uint64_t _res) {
34152         if (!ptr_is_owned(_res)) return;
34153         void* _res_ptr = untag_ptr(_res);
34154         CHECK_ACCESS(_res_ptr);
34155         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
34156         FREE(untag_ptr(_res));
34157         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
34158 }
34159
34160 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
34161         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34162         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
34163         return tag_ptr(ret_conv, true);
34164 }
34165 int64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(uint64_t arg) {
34166         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
34167         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
34168         return ret_conv;
34169 }
34170
34171 uint64_t  __attribute__((export_name("TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone"))) TS_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(uint64_t orig) {
34172         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
34173         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34174         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
34175         return tag_ptr(ret_conv, true);
34176 }
34177
34178 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_ok"))) TS_CResult_PeeledOnionNoneZ_ok(uint64_t o) {
34179         void* o_ptr = untag_ptr(o);
34180         CHECK_ACCESS(o_ptr);
34181         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
34182         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
34183         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34184         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
34185         return tag_ptr(ret_conv, true);
34186 }
34187
34188 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_err"))) TS_CResult_PeeledOnionNoneZ_err() {
34189         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34190         *ret_conv = CResult_PeeledOnionNoneZ_err();
34191         return tag_ptr(ret_conv, true);
34192 }
34193
34194 jboolean  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_is_ok"))) TS_CResult_PeeledOnionNoneZ_is_ok(uint64_t o) {
34195         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
34196         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
34197         return ret_conv;
34198 }
34199
34200 void  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_free"))) TS_CResult_PeeledOnionNoneZ_free(uint64_t _res) {
34201         if (!ptr_is_owned(_res)) return;
34202         void* _res_ptr = untag_ptr(_res);
34203         CHECK_ACCESS(_res_ptr);
34204         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
34205         FREE(untag_ptr(_res));
34206         CResult_PeeledOnionNoneZ_free(_res_conv);
34207 }
34208
34209 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
34210         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34211         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
34212         return tag_ptr(ret_conv, true);
34213 }
34214 int64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_clone_ptr"))) TS_CResult_PeeledOnionNoneZ_clone_ptr(uint64_t arg) {
34215         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
34216         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
34217         return ret_conv;
34218 }
34219
34220 uint64_t  __attribute__((export_name("TS_CResult_PeeledOnionNoneZ_clone"))) TS_CResult_PeeledOnionNoneZ_clone(uint64_t orig) {
34221         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
34222         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34223         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
34224         return tag_ptr(ret_conv, true);
34225 }
34226
34227 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_ok"))) TS_CResult_SendSuccessSendErrorZ_ok(uint64_t o) {
34228         void* o_ptr = untag_ptr(o);
34229         CHECK_ACCESS(o_ptr);
34230         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
34231         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
34232         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34233         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
34234         return tag_ptr(ret_conv, true);
34235 }
34236
34237 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_err"))) TS_CResult_SendSuccessSendErrorZ_err(uint64_t e) {
34238         void* e_ptr = untag_ptr(e);
34239         CHECK_ACCESS(e_ptr);
34240         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34241         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34242         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34243         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
34244         return tag_ptr(ret_conv, true);
34245 }
34246
34247 jboolean  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_is_ok"))) TS_CResult_SendSuccessSendErrorZ_is_ok(uint64_t o) {
34248         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
34249         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
34250         return ret_conv;
34251 }
34252
34253 void  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_free"))) TS_CResult_SendSuccessSendErrorZ_free(uint64_t _res) {
34254         if (!ptr_is_owned(_res)) return;
34255         void* _res_ptr = untag_ptr(_res);
34256         CHECK_ACCESS(_res_ptr);
34257         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
34258         FREE(untag_ptr(_res));
34259         CResult_SendSuccessSendErrorZ_free(_res_conv);
34260 }
34261
34262 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
34263         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34264         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
34265         return tag_ptr(ret_conv, true);
34266 }
34267 int64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_clone_ptr"))) TS_CResult_SendSuccessSendErrorZ_clone_ptr(uint64_t arg) {
34268         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
34269         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
34270         return ret_conv;
34271 }
34272
34273 uint64_t  __attribute__((export_name("TS_CResult_SendSuccessSendErrorZ_clone"))) TS_CResult_SendSuccessSendErrorZ_clone(uint64_t orig) {
34274         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
34275         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34276         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
34277         return tag_ptr(ret_conv, true);
34278 }
34279
34280 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
34281         LDKBlindedPath o_conv;
34282         o_conv.inner = untag_ptr(o);
34283         o_conv.is_owned = ptr_is_owned(o);
34284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34285         o_conv = BlindedPath_clone(&o_conv);
34286         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34287         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
34288         return tag_ptr(ret_conv, true);
34289 }
34290
34291 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
34292         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34293         *ret_conv = CResult_BlindedPathNoneZ_err();
34294         return tag_ptr(ret_conv, true);
34295 }
34296
34297 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
34298         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
34299         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
34300         return ret_conv;
34301 }
34302
34303 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
34304         if (!ptr_is_owned(_res)) return;
34305         void* _res_ptr = untag_ptr(_res);
34306         CHECK_ACCESS(_res_ptr);
34307         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
34308         FREE(untag_ptr(_res));
34309         CResult_BlindedPathNoneZ_free(_res_conv);
34310 }
34311
34312 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
34313         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34314         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
34315         return tag_ptr(ret_conv, true);
34316 }
34317 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
34318         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
34319         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
34320         return ret_conv;
34321 }
34322
34323 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
34324         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
34325         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34326         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
34327         return tag_ptr(ret_conv, true);
34328 }
34329
34330 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(uint64_t o) {
34331         void* o_ptr = untag_ptr(o);
34332         CHECK_ACCESS(o_ptr);
34333         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
34334         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
34335         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34336         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
34337         return tag_ptr(ret_conv, true);
34338 }
34339
34340 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
34341         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34342         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
34343         return tag_ptr(ret_conv, true);
34344 }
34345
34346 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(uint64_t o) {
34347         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
34348         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
34349         return ret_conv;
34350 }
34351
34352 void  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(uint64_t _res) {
34353         if (!ptr_is_owned(_res)) return;
34354         void* _res_ptr = untag_ptr(_res);
34355         CHECK_ACCESS(_res_ptr);
34356         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34357         FREE(untag_ptr(_res));
34358         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34359 }
34360
34361 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34362         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34363         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34364         return tag_ptr(ret_conv, true);
34365 }
34366 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(uint64_t arg) {
34367         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34368         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34369         return ret_conv;
34370 }
34371
34372 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone"))) TS_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(uint64_t orig) {
34373         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34374         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34375         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34376         return tag_ptr(ret_conv, true);
34377 }
34378
34379 void  __attribute__((export_name("TS_CVec_ForwardNodeZ_free"))) TS_CVec_ForwardNodeZ_free(uint64_tArray _res) {
34380         LDKCVec_ForwardNodeZ _res_constr;
34381         _res_constr.datalen = _res->arr_len;
34382         if (_res_constr.datalen > 0)
34383                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
34384         else
34385                 _res_constr.data = NULL;
34386         uint64_t* _res_vals = _res->elems;
34387         for (size_t n = 0; n < _res_constr.datalen; n++) {
34388                 uint64_t _res_conv_13 = _res_vals[n];
34389                 LDKForwardNode _res_conv_13_conv;
34390                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
34391                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
34392                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
34393                 _res_constr.data[n] = _res_conv_13_conv;
34394         }
34395         FREE(_res);
34396         CVec_ForwardNodeZ_free(_res_constr);
34397 }
34398
34399 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
34400         LDKBlindedPath o_conv;
34401         o_conv.inner = untag_ptr(o);
34402         o_conv.is_owned = ptr_is_owned(o);
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34404         o_conv = BlindedPath_clone(&o_conv);
34405         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34406         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34407         return tag_ptr(ret_conv, true);
34408 }
34409
34410 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
34411         void* e_ptr = untag_ptr(e);
34412         CHECK_ACCESS(e_ptr);
34413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34415         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34416         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34417         return tag_ptr(ret_conv, true);
34418 }
34419
34420 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
34421         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34422         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34423         return ret_conv;
34424 }
34425
34426 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
34427         if (!ptr_is_owned(_res)) return;
34428         void* _res_ptr = untag_ptr(_res);
34429         CHECK_ACCESS(_res_ptr);
34430         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34431         FREE(untag_ptr(_res));
34432         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34433 }
34434
34435 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34436         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34437         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34438         return tag_ptr(ret_conv, true);
34439 }
34440 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
34441         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34442         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34443         return ret_conv;
34444 }
34445
34446 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
34447         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34448         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34449         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34450         return tag_ptr(ret_conv, true);
34451 }
34452
34453 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
34454         LDKBlindedHop o_conv;
34455         o_conv.inner = untag_ptr(o);
34456         o_conv.is_owned = ptr_is_owned(o);
34457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34458         o_conv = BlindedHop_clone(&o_conv);
34459         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34460         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34461         return tag_ptr(ret_conv, true);
34462 }
34463
34464 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
34465         void* e_ptr = untag_ptr(e);
34466         CHECK_ACCESS(e_ptr);
34467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34469         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34470         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34471         return tag_ptr(ret_conv, true);
34472 }
34473
34474 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
34475         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34476         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34477         return ret_conv;
34478 }
34479
34480 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
34481         if (!ptr_is_owned(_res)) return;
34482         void* _res_ptr = untag_ptr(_res);
34483         CHECK_ACCESS(_res_ptr);
34484         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34485         FREE(untag_ptr(_res));
34486         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34487 }
34488
34489 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34490         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34491         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34492         return tag_ptr(ret_conv, true);
34493 }
34494 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
34495         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34496         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34497         return ret_conv;
34498 }
34499
34500 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
34501         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34502         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34503         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34504         return tag_ptr(ret_conv, true);
34505 }
34506
34507 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
34508         LDKInvoiceError o_conv;
34509         o_conv.inner = untag_ptr(o);
34510         o_conv.is_owned = ptr_is_owned(o);
34511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34512         o_conv = InvoiceError_clone(&o_conv);
34513         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34514         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34515         return tag_ptr(ret_conv, true);
34516 }
34517
34518 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
34519         void* e_ptr = untag_ptr(e);
34520         CHECK_ACCESS(e_ptr);
34521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34523         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34524         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34525         return tag_ptr(ret_conv, true);
34526 }
34527
34528 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
34529         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34530         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34531         return ret_conv;
34532 }
34533
34534 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
34535         if (!ptr_is_owned(_res)) return;
34536         void* _res_ptr = untag_ptr(_res);
34537         CHECK_ACCESS(_res_ptr);
34538         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34539         FREE(untag_ptr(_res));
34540         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34541 }
34542
34543 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34544         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34545         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34546         return tag_ptr(ret_conv, true);
34547 }
34548 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
34549         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34550         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34551         return ret_conv;
34552 }
34553
34554 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
34555         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34556         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34557         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34558         return tag_ptr(ret_conv, true);
34559 }
34560
34561 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_ok(uint64_t o) {
34562         LDKTrackedSpendableOutput o_conv;
34563         o_conv.inner = untag_ptr(o);
34564         o_conv.is_owned = ptr_is_owned(o);
34565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34566         o_conv = TrackedSpendableOutput_clone(&o_conv);
34567         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34568         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
34569         return tag_ptr(ret_conv, true);
34570 }
34571
34572 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_err"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_err(uint64_t e) {
34573         void* e_ptr = untag_ptr(e);
34574         CHECK_ACCESS(e_ptr);
34575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34577         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34578         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
34579         return tag_ptr(ret_conv, true);
34580 }
34581
34582 jboolean  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(uint64_t o) {
34583         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
34584         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
34585         return ret_conv;
34586 }
34587
34588 void  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_free"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_free(uint64_t _res) {
34589         if (!ptr_is_owned(_res)) return;
34590         void* _res_ptr = untag_ptr(_res);
34591         CHECK_ACCESS(_res_ptr);
34592         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
34593         FREE(untag_ptr(_res));
34594         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
34595 }
34596
34597 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
34598         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34599         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
34600         return tag_ptr(ret_conv, true);
34601 }
34602 int64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
34603         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
34604         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
34605         return ret_conv;
34606 }
34607
34608 uint64_t  __attribute__((export_name("TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone"))) TS_CResult_TrackedSpendableOutputDecodeErrorZ_clone(uint64_t orig) {
34609         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
34610         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34611         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
34612         return tag_ptr(ret_conv, true);
34613 }
34614
34615 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_ok(uint64_t o) {
34616         void* o_ptr = untag_ptr(o);
34617         CHECK_ACCESS(o_ptr);
34618         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
34619         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
34620         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34621         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
34622         return tag_ptr(ret_conv, true);
34623 }
34624
34625 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_err"))) TS_CResult_OutputSpendStatusDecodeErrorZ_err(uint64_t e) {
34626         void* e_ptr = untag_ptr(e);
34627         CHECK_ACCESS(e_ptr);
34628         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34629         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34630         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34631         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
34632         return tag_ptr(ret_conv, true);
34633 }
34634
34635 jboolean  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_is_ok"))) TS_CResult_OutputSpendStatusDecodeErrorZ_is_ok(uint64_t o) {
34636         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
34637         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
34638         return ret_conv;
34639 }
34640
34641 void  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_free"))) TS_CResult_OutputSpendStatusDecodeErrorZ_free(uint64_t _res) {
34642         if (!ptr_is_owned(_res)) return;
34643         void* _res_ptr = untag_ptr(_res);
34644         CHECK_ACCESS(_res_ptr);
34645         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
34646         FREE(untag_ptr(_res));
34647         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
34648 }
34649
34650 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
34651         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34652         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
34653         return tag_ptr(ret_conv, true);
34654 }
34655 int64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr"))) TS_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(uint64_t arg) {
34656         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
34657         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
34658         return ret_conv;
34659 }
34660
34661 uint64_t  __attribute__((export_name("TS_CResult_OutputSpendStatusDecodeErrorZ_clone"))) TS_CResult_OutputSpendStatusDecodeErrorZ_clone(uint64_t orig) {
34662         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
34663         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34664         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
34665         return tag_ptr(ret_conv, true);
34666 }
34667
34668 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
34669         void* o_ptr = untag_ptr(o);
34670         CHECK_ACCESS(o_ptr);
34671         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34672         if (o_conv.free == LDKFilter_JCalls_free) {
34673                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34674                 LDKFilter_JCalls_cloned(&o_conv);
34675         }
34676         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34677         *ret_copy = COption_FilterZ_some(o_conv);
34678         uint64_t ret_ref = tag_ptr(ret_copy, true);
34679         return ret_ref;
34680 }
34681
34682 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
34683         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34684         *ret_copy = COption_FilterZ_none();
34685         uint64_t ret_ref = tag_ptr(ret_copy, true);
34686         return ret_ref;
34687 }
34688
34689 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
34690         if (!ptr_is_owned(_res)) return;
34691         void* _res_ptr = untag_ptr(_res);
34692         CHECK_ACCESS(_res_ptr);
34693         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34694         FREE(untag_ptr(_res));
34695         COption_FilterZ_free(_res_conv);
34696 }
34697
34698 void  __attribute__((export_name("TS_CVec_TrackedSpendableOutputZ_free"))) TS_CVec_TrackedSpendableOutputZ_free(uint64_tArray _res) {
34699         LDKCVec_TrackedSpendableOutputZ _res_constr;
34700         _res_constr.datalen = _res->arr_len;
34701         if (_res_constr.datalen > 0)
34702                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
34703         else
34704                 _res_constr.data = NULL;
34705         uint64_t* _res_vals = _res->elems;
34706         for (size_t y = 0; y < _res_constr.datalen; y++) {
34707                 uint64_t _res_conv_24 = _res_vals[y];
34708                 LDKTrackedSpendableOutput _res_conv_24_conv;
34709                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
34710                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
34711                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
34712                 _res_constr.data[y] = _res_conv_24_conv;
34713         }
34714         FREE(_res);
34715         CVec_TrackedSpendableOutputZ_free(_res_constr);
34716 }
34717
34718 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_ok(uint64_t o) {
34719         LDKOutputSweeper o_conv;
34720         o_conv.inner = untag_ptr(o);
34721         o_conv.is_owned = ptr_is_owned(o);
34722         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34723         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34724         
34725         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34726         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
34727         return tag_ptr(ret_conv, true);
34728 }
34729
34730 uint64_t  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_err"))) TS_CResult_OutputSweeperDecodeErrorZ_err(uint64_t e) {
34731         void* e_ptr = untag_ptr(e);
34732         CHECK_ACCESS(e_ptr);
34733         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34734         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34735         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34736         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
34737         return tag_ptr(ret_conv, true);
34738 }
34739
34740 jboolean  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_is_ok"))) TS_CResult_OutputSweeperDecodeErrorZ_is_ok(uint64_t o) {
34741         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
34742         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
34743         return ret_conv;
34744 }
34745
34746 void  __attribute__((export_name("TS_CResult_OutputSweeperDecodeErrorZ_free"))) TS_CResult_OutputSweeperDecodeErrorZ_free(uint64_t _res) {
34747         if (!ptr_is_owned(_res)) return;
34748         void* _res_ptr = untag_ptr(_res);
34749         CHECK_ACCESS(_res_ptr);
34750         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
34751         FREE(untag_ptr(_res));
34752         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
34753 }
34754
34755 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_new"))) TS_C2Tuple_BestBlockOutputSweeperZ_new(uint64_t a, uint64_t b) {
34756         LDKBestBlock a_conv;
34757         a_conv.inner = untag_ptr(a);
34758         a_conv.is_owned = ptr_is_owned(a);
34759         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34760         a_conv = BestBlock_clone(&a_conv);
34761         LDKOutputSweeper b_conv;
34762         b_conv.inner = untag_ptr(b);
34763         b_conv.is_owned = ptr_is_owned(b);
34764         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34765         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34766         
34767         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
34768         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
34769         return tag_ptr(ret_conv, true);
34770 }
34771
34772 void  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_free"))) TS_C2Tuple_BestBlockOutputSweeperZ_free(uint64_t _res) {
34773         if (!ptr_is_owned(_res)) return;
34774         void* _res_ptr = untag_ptr(_res);
34775         CHECK_ACCESS(_res_ptr);
34776         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
34777         FREE(untag_ptr(_res));
34778         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
34779 }
34780
34781 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(uint64_t o) {
34782         void* o_ptr = untag_ptr(o);
34783         CHECK_ACCESS(o_ptr);
34784         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
34785         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
34786         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34787         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
34788         return tag_ptr(ret_conv, true);
34789 }
34790
34791 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(uint64_t e) {
34792         void* e_ptr = untag_ptr(e);
34793         CHECK_ACCESS(e_ptr);
34794         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34795         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34796         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34797         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
34798         return tag_ptr(ret_conv, true);
34799 }
34800
34801 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(uint64_t o) {
34802         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
34803         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
34804         return ret_conv;
34805 }
34806
34807 void  __attribute__((export_name("TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(uint64_t _res) {
34808         if (!ptr_is_owned(_res)) return;
34809         void* _res_ptr = untag_ptr(_res);
34810         CHECK_ACCESS(_res_ptr);
34811         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
34812         FREE(untag_ptr(_res));
34813         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
34814 }
34815
34816 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(uint64_t o) {
34817         LDKDelayedPaymentBasepoint o_conv;
34818         o_conv.inner = untag_ptr(o);
34819         o_conv.is_owned = ptr_is_owned(o);
34820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34821         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
34822         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34823         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
34824         return tag_ptr(ret_conv, true);
34825 }
34826
34827 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_err(uint64_t e) {
34828         void* e_ptr = untag_ptr(e);
34829         CHECK_ACCESS(e_ptr);
34830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34832         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34833         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
34834         return tag_ptr(ret_conv, true);
34835 }
34836
34837 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(uint64_t o) {
34838         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
34839         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
34840         return ret_conv;
34841 }
34842
34843 void  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_free(uint64_t _res) {
34844         if (!ptr_is_owned(_res)) return;
34845         void* _res_ptr = untag_ptr(_res);
34846         CHECK_ACCESS(_res_ptr);
34847         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
34848         FREE(untag_ptr(_res));
34849         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
34850 }
34851
34852 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
34853         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34854         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
34855         return tag_ptr(ret_conv, true);
34856 }
34857 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34858         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
34859         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
34860         return ret_conv;
34861 }
34862
34863 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(uint64_t orig) {
34864         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
34865         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34866         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
34867         return tag_ptr(ret_conv, true);
34868 }
34869
34870 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_ok(uint64_t o) {
34871         LDKDelayedPaymentKey o_conv;
34872         o_conv.inner = untag_ptr(o);
34873         o_conv.is_owned = ptr_is_owned(o);
34874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34875         o_conv = DelayedPaymentKey_clone(&o_conv);
34876         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34877         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
34878         return tag_ptr(ret_conv, true);
34879 }
34880
34881 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_err"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_err(uint64_t e) {
34882         void* e_ptr = untag_ptr(e);
34883         CHECK_ACCESS(e_ptr);
34884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34886         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34887         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
34888         return tag_ptr(ret_conv, true);
34889 }
34890
34891 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(uint64_t o) {
34892         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
34893         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
34894         return ret_conv;
34895 }
34896
34897 void  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_free"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_free(uint64_t _res) {
34898         if (!ptr_is_owned(_res)) return;
34899         void* _res_ptr = untag_ptr(_res);
34900         CHECK_ACCESS(_res_ptr);
34901         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
34902         FREE(untag_ptr(_res));
34903         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
34904 }
34905
34906 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
34907         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34908         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
34909         return tag_ptr(ret_conv, true);
34910 }
34911 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
34912         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
34913         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
34914         return ret_conv;
34915 }
34916
34917 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentKeyDecodeErrorZ_clone(uint64_t orig) {
34918         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
34919         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34920         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
34921         return tag_ptr(ret_conv, true);
34922 }
34923
34924 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_ok(uint64_t o) {
34925         LDKHtlcBasepoint o_conv;
34926         o_conv.inner = untag_ptr(o);
34927         o_conv.is_owned = ptr_is_owned(o);
34928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34929         o_conv = HtlcBasepoint_clone(&o_conv);
34930         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34931         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
34932         return tag_ptr(ret_conv, true);
34933 }
34934
34935 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_err"))) TS_CResult_HtlcBasepointDecodeErrorZ_err(uint64_t e) {
34936         void* e_ptr = untag_ptr(e);
34937         CHECK_ACCESS(e_ptr);
34938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34940         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34941         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
34942         return tag_ptr(ret_conv, true);
34943 }
34944
34945 jboolean  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_is_ok"))) TS_CResult_HtlcBasepointDecodeErrorZ_is_ok(uint64_t o) {
34946         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
34947         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
34948         return ret_conv;
34949 }
34950
34951 void  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_free"))) TS_CResult_HtlcBasepointDecodeErrorZ_free(uint64_t _res) {
34952         if (!ptr_is_owned(_res)) return;
34953         void* _res_ptr = untag_ptr(_res);
34954         CHECK_ACCESS(_res_ptr);
34955         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
34956         FREE(untag_ptr(_res));
34957         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
34958 }
34959
34960 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
34961         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34962         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
34963         return tag_ptr(ret_conv, true);
34964 }
34965 int64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
34966         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
34967         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
34968         return ret_conv;
34969 }
34970
34971 uint64_t  __attribute__((export_name("TS_CResult_HtlcBasepointDecodeErrorZ_clone"))) TS_CResult_HtlcBasepointDecodeErrorZ_clone(uint64_t orig) {
34972         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
34973         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34974         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
34975         return tag_ptr(ret_conv, true);
34976 }
34977
34978 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_ok(uint64_t o) {
34979         LDKHtlcKey o_conv;
34980         o_conv.inner = untag_ptr(o);
34981         o_conv.is_owned = ptr_is_owned(o);
34982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34983         o_conv = HtlcKey_clone(&o_conv);
34984         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34985         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
34986         return tag_ptr(ret_conv, true);
34987 }
34988
34989 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_err"))) TS_CResult_HtlcKeyDecodeErrorZ_err(uint64_t e) {
34990         void* e_ptr = untag_ptr(e);
34991         CHECK_ACCESS(e_ptr);
34992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34994         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34995         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
34996         return tag_ptr(ret_conv, true);
34997 }
34998
34999 jboolean  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_is_ok"))) TS_CResult_HtlcKeyDecodeErrorZ_is_ok(uint64_t o) {
35000         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
35001         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
35002         return ret_conv;
35003 }
35004
35005 void  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_free"))) TS_CResult_HtlcKeyDecodeErrorZ_free(uint64_t _res) {
35006         if (!ptr_is_owned(_res)) return;
35007         void* _res_ptr = untag_ptr(_res);
35008         CHECK_ACCESS(_res_ptr);
35009         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
35010         FREE(untag_ptr(_res));
35011         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
35012 }
35013
35014 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
35015         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
35016         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
35017         return tag_ptr(ret_conv, true);
35018 }
35019 int64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr"))) TS_CResult_HtlcKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
35020         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
35021         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
35022         return ret_conv;
35023 }
35024
35025 uint64_t  __attribute__((export_name("TS_CResult_HtlcKeyDecodeErrorZ_clone"))) TS_CResult_HtlcKeyDecodeErrorZ_clone(uint64_t orig) {
35026         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
35027         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
35028         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
35029         return tag_ptr(ret_conv, true);
35030 }
35031
35032 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_ok(uint64_t o) {
35033         LDKRevocationBasepoint o_conv;
35034         o_conv.inner = untag_ptr(o);
35035         o_conv.is_owned = ptr_is_owned(o);
35036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35037         o_conv = RevocationBasepoint_clone(&o_conv);
35038         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35039         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
35040         return tag_ptr(ret_conv, true);
35041 }
35042
35043 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_err"))) TS_CResult_RevocationBasepointDecodeErrorZ_err(uint64_t e) {
35044         void* e_ptr = untag_ptr(e);
35045         CHECK_ACCESS(e_ptr);
35046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35048         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35049         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
35050         return tag_ptr(ret_conv, true);
35051 }
35052
35053 jboolean  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_is_ok"))) TS_CResult_RevocationBasepointDecodeErrorZ_is_ok(uint64_t o) {
35054         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
35055         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
35056         return ret_conv;
35057 }
35058
35059 void  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_free"))) TS_CResult_RevocationBasepointDecodeErrorZ_free(uint64_t _res) {
35060         if (!ptr_is_owned(_res)) return;
35061         void* _res_ptr = untag_ptr(_res);
35062         CHECK_ACCESS(_res_ptr);
35063         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
35064         FREE(untag_ptr(_res));
35065         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
35066 }
35067
35068 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
35069         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35070         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
35071         return tag_ptr(ret_conv, true);
35072 }
35073 int64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(uint64_t arg) {
35074         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
35075         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
35076         return ret_conv;
35077 }
35078
35079 uint64_t  __attribute__((export_name("TS_CResult_RevocationBasepointDecodeErrorZ_clone"))) TS_CResult_RevocationBasepointDecodeErrorZ_clone(uint64_t orig) {
35080         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
35081         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35082         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
35083         return tag_ptr(ret_conv, true);
35084 }
35085
35086 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_ok(uint64_t o) {
35087         LDKRevocationKey o_conv;
35088         o_conv.inner = untag_ptr(o);
35089         o_conv.is_owned = ptr_is_owned(o);
35090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35091         o_conv = RevocationKey_clone(&o_conv);
35092         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35093         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
35094         return tag_ptr(ret_conv, true);
35095 }
35096
35097 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_err"))) TS_CResult_RevocationKeyDecodeErrorZ_err(uint64_t e) {
35098         void* e_ptr = untag_ptr(e);
35099         CHECK_ACCESS(e_ptr);
35100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35102         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35103         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
35104         return tag_ptr(ret_conv, true);
35105 }
35106
35107 jboolean  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_is_ok"))) TS_CResult_RevocationKeyDecodeErrorZ_is_ok(uint64_t o) {
35108         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
35109         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
35110         return ret_conv;
35111 }
35112
35113 void  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_free"))) TS_CResult_RevocationKeyDecodeErrorZ_free(uint64_t _res) {
35114         if (!ptr_is_owned(_res)) return;
35115         void* _res_ptr = untag_ptr(_res);
35116         CHECK_ACCESS(_res_ptr);
35117         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
35118         FREE(untag_ptr(_res));
35119         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
35120 }
35121
35122 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
35123         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35124         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
35125         return tag_ptr(ret_conv, true);
35126 }
35127 int64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr"))) TS_CResult_RevocationKeyDecodeErrorZ_clone_ptr(uint64_t arg) {
35128         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
35129         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
35130         return ret_conv;
35131 }
35132
35133 uint64_t  __attribute__((export_name("TS_CResult_RevocationKeyDecodeErrorZ_clone"))) TS_CResult_RevocationKeyDecodeErrorZ_clone(uint64_t orig) {
35134         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
35135         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35136         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
35137         return tag_ptr(ret_conv, true);
35138 }
35139
35140 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
35141         LDKLockedChannelMonitor o_conv;
35142         o_conv.inner = untag_ptr(o);
35143         o_conv.is_owned = ptr_is_owned(o);
35144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35145         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
35146         
35147         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35148         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
35149         return tag_ptr(ret_conv, true);
35150 }
35151
35152 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
35153         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35154         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
35155         return tag_ptr(ret_conv, true);
35156 }
35157
35158 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
35159         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
35160         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
35161         return ret_conv;
35162 }
35163
35164 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
35165         if (!ptr_is_owned(_res)) return;
35166         void* _res_ptr = untag_ptr(_res);
35167         CHECK_ACCESS(_res_ptr);
35168         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
35169         FREE(untag_ptr(_res));
35170         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
35171 }
35172
35173 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
35174         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
35175         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
35176         return tag_ptr(ret_conv, true);
35177 }
35178 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_clone_ptr"))) TS_C2Tuple_OutPointChannelIdZ_clone_ptr(uint64_t arg) {
35179         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
35180         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
35181         return ret_conv;
35182 }
35183
35184 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_clone"))) TS_C2Tuple_OutPointChannelIdZ_clone(uint64_t orig) {
35185         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
35186         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
35187         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
35188         return tag_ptr(ret_conv, true);
35189 }
35190
35191 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_new"))) TS_C2Tuple_OutPointChannelIdZ_new(uint64_t a, uint64_t b) {
35192         LDKOutPoint a_conv;
35193         a_conv.inner = untag_ptr(a);
35194         a_conv.is_owned = ptr_is_owned(a);
35195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35196         a_conv = OutPoint_clone(&a_conv);
35197         LDKChannelId b_conv;
35198         b_conv.inner = untag_ptr(b);
35199         b_conv.is_owned = ptr_is_owned(b);
35200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35201         b_conv = ChannelId_clone(&b_conv);
35202         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
35203         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
35204         return tag_ptr(ret_conv, true);
35205 }
35206
35207 void  __attribute__((export_name("TS_C2Tuple_OutPointChannelIdZ_free"))) TS_C2Tuple_OutPointChannelIdZ_free(uint64_t _res) {
35208         if (!ptr_is_owned(_res)) return;
35209         void* _res_ptr = untag_ptr(_res);
35210         CHECK_ACCESS(_res_ptr);
35211         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
35212         FREE(untag_ptr(_res));
35213         C2Tuple_OutPointChannelIdZ_free(_res_conv);
35214 }
35215
35216 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointChannelIdZZ_free"))) TS_CVec_C2Tuple_OutPointChannelIdZZ_free(uint64_tArray _res) {
35217         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
35218         _res_constr.datalen = _res->arr_len;
35219         if (_res_constr.datalen > 0)
35220                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
35221         else
35222                 _res_constr.data = NULL;
35223         uint64_t* _res_vals = _res->elems;
35224         for (size_t d = 0; d < _res_constr.datalen; d++) {
35225                 uint64_t _res_conv_29 = _res_vals[d];
35226                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
35227                 CHECK_ACCESS(_res_conv_29_ptr);
35228                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
35229                 FREE(untag_ptr(_res_conv_29));
35230                 _res_constr.data[d] = _res_conv_29_conv;
35231         }
35232         FREE(_res);
35233         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
35234 }
35235
35236 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
35237         LDKCVec_MonitorUpdateIdZ _res_constr;
35238         _res_constr.datalen = _res->arr_len;
35239         if (_res_constr.datalen > 0)
35240                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
35241         else
35242                 _res_constr.data = NULL;
35243         uint64_t* _res_vals = _res->elems;
35244         for (size_t r = 0; r < _res_constr.datalen; r++) {
35245                 uint64_t _res_conv_17 = _res_vals[r];
35246                 LDKMonitorUpdateId _res_conv_17_conv;
35247                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
35248                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
35249                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
35250                 _res_constr.data[r] = _res_conv_17_conv;
35251         }
35252         FREE(_res);
35253         CVec_MonitorUpdateIdZ_free(_res_constr);
35254 }
35255
35256 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
35257         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35258         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
35259         return tag_ptr(ret_conv, true);
35260 }
35261 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
35262         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
35263         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
35264         return ret_conv;
35265 }
35266
35267 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
35268         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
35269         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35270         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
35271         return tag_ptr(ret_conv, true);
35272 }
35273
35274 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
35275         LDKOutPoint a_conv;
35276         a_conv.inner = untag_ptr(a);
35277         a_conv.is_owned = ptr_is_owned(a);
35278         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35279         a_conv = OutPoint_clone(&a_conv);
35280         LDKCVec_MonitorUpdateIdZ b_constr;
35281         b_constr.datalen = b->arr_len;
35282         if (b_constr.datalen > 0)
35283                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
35284         else
35285                 b_constr.data = NULL;
35286         uint64_t* b_vals = b->elems;
35287         for (size_t r = 0; r < b_constr.datalen; r++) {
35288                 uint64_t b_conv_17 = b_vals[r];
35289                 LDKMonitorUpdateId b_conv_17_conv;
35290                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
35291                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
35292                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
35293                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
35294                 b_constr.data[r] = b_conv_17_conv;
35295         }
35296         FREE(b);
35297         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35298         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
35299         return tag_ptr(ret_conv, true);
35300 }
35301
35302 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
35303         if (!ptr_is_owned(_res)) return;
35304         void* _res_ptr = untag_ptr(_res);
35305         CHECK_ACCESS(_res_ptr);
35306         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
35307         FREE(untag_ptr(_res));
35308         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
35309 }
35310
35311 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
35312         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
35313         _res_constr.datalen = _res->arr_len;
35314         if (_res_constr.datalen > 0)
35315                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
35316         else
35317                 _res_constr.data = NULL;
35318         uint64_t* _res_vals = _res->elems;
35319         for (size_t p = 0; p < _res_constr.datalen; p++) {
35320                 uint64_t _res_conv_41 = _res_vals[p];
35321                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
35322                 CHECK_ACCESS(_res_conv_41_ptr);
35323                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
35324                 FREE(untag_ptr(_res_conv_41));
35325                 _res_constr.data[p] = _res_conv_41_conv;
35326         }
35327         FREE(_res);
35328         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
35329 }
35330
35331 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
35332         if (!ptr_is_owned(this_ptr)) return;
35333         void* this_ptr_ptr = untag_ptr(this_ptr);
35334         CHECK_ACCESS(this_ptr_ptr);
35335         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
35336         FREE(untag_ptr(this_ptr));
35337         APIError_free(this_ptr_conv);
35338 }
35339
35340 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
35341         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35342         *ret_copy = APIError_clone(arg);
35343         uint64_t ret_ref = tag_ptr(ret_copy, true);
35344         return ret_ref;
35345 }
35346 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
35347         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
35348         int64_t ret_conv = APIError_clone_ptr(arg_conv);
35349         return ret_conv;
35350 }
35351
35352 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
35353         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
35354         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35355         *ret_copy = APIError_clone(orig_conv);
35356         uint64_t ret_ref = tag_ptr(ret_copy, true);
35357         return ret_ref;
35358 }
35359
35360 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
35361         LDKStr err_conv = str_ref_to_owned_c(err);
35362         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35363         *ret_copy = APIError_apimisuse_error(err_conv);
35364         uint64_t ret_ref = tag_ptr(ret_copy, true);
35365         return ret_ref;
35366 }
35367
35368 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
35369         LDKStr err_conv = str_ref_to_owned_c(err);
35370         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35371         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
35372         uint64_t ret_ref = tag_ptr(ret_copy, true);
35373         return ret_ref;
35374 }
35375
35376 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
35377         LDKStr err_conv = str_ref_to_owned_c(err);
35378         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35379         *ret_copy = APIError_invalid_route(err_conv);
35380         uint64_t ret_ref = tag_ptr(ret_copy, true);
35381         return ret_ref;
35382 }
35383
35384 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
35385         LDKStr err_conv = str_ref_to_owned_c(err);
35386         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35387         *ret_copy = APIError_channel_unavailable(err_conv);
35388         uint64_t ret_ref = tag_ptr(ret_copy, true);
35389         return ret_ref;
35390 }
35391
35392 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
35393         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35394         *ret_copy = APIError_monitor_update_in_progress();
35395         uint64_t ret_ref = tag_ptr(ret_copy, true);
35396         return ret_ref;
35397 }
35398
35399 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
35400         LDKShutdownScript script_conv;
35401         script_conv.inner = untag_ptr(script);
35402         script_conv.is_owned = ptr_is_owned(script);
35403         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
35404         script_conv = ShutdownScript_clone(&script_conv);
35405         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35406         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
35407         uint64_t ret_ref = tag_ptr(ret_copy, true);
35408         return ret_ref;
35409 }
35410
35411 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
35412         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
35413         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
35414         jboolean ret_conv = APIError_eq(a_conv, b_conv);
35415         return ret_conv;
35416 }
35417
35418 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
35419         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
35420         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
35421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35423         CVec_u8Z_free(ret_var);
35424         return ret_arr;
35425 }
35426
35427 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
35428         LDKu8slice ser_ref;
35429         ser_ref.datalen = ser->arr_len;
35430         ser_ref.data = ser->elems;
35431         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
35432         *ret_conv = APIError_read(ser_ref);
35433         FREE(ser);
35434         return tag_ptr(ret_conv, true);
35435 }
35436
35437 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
35438         LDKBigSize this_obj_conv;
35439         this_obj_conv.inner = untag_ptr(this_obj);
35440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35442         BigSize_free(this_obj_conv);
35443 }
35444
35445 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
35446         LDKBigSize this_ptr_conv;
35447         this_ptr_conv.inner = untag_ptr(this_ptr);
35448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35450         this_ptr_conv.is_owned = false;
35451         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
35452         return ret_conv;
35453 }
35454
35455 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
35456         LDKBigSize this_ptr_conv;
35457         this_ptr_conv.inner = untag_ptr(this_ptr);
35458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35460         this_ptr_conv.is_owned = false;
35461         BigSize_set_a(&this_ptr_conv, val);
35462 }
35463
35464 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
35465         LDKBigSize ret_var = BigSize_new(a_arg);
35466         uint64_t ret_ref = 0;
35467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35469         return ret_ref;
35470 }
35471
35472 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
35473         LDKBigSize ret_var = BigSize_clone(arg);
35474         uint64_t ret_ref = 0;
35475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35477         return ret_ref;
35478 }
35479 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
35480         LDKBigSize arg_conv;
35481         arg_conv.inner = untag_ptr(arg);
35482         arg_conv.is_owned = ptr_is_owned(arg);
35483         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35484         arg_conv.is_owned = false;
35485         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
35486         return ret_conv;
35487 }
35488
35489 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
35490         LDKBigSize orig_conv;
35491         orig_conv.inner = untag_ptr(orig);
35492         orig_conv.is_owned = ptr_is_owned(orig);
35493         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35494         orig_conv.is_owned = false;
35495         LDKBigSize ret_var = BigSize_clone(&orig_conv);
35496         uint64_t ret_ref = 0;
35497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35499         return ret_ref;
35500 }
35501
35502 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
35503         LDKBigSize o_conv;
35504         o_conv.inner = untag_ptr(o);
35505         o_conv.is_owned = ptr_is_owned(o);
35506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35507         o_conv.is_owned = false;
35508         int64_t ret_conv = BigSize_hash(&o_conv);
35509         return ret_conv;
35510 }
35511
35512 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
35513         LDKBigSize a_conv;
35514         a_conv.inner = untag_ptr(a);
35515         a_conv.is_owned = ptr_is_owned(a);
35516         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35517         a_conv.is_owned = false;
35518         LDKBigSize b_conv;
35519         b_conv.inner = untag_ptr(b);
35520         b_conv.is_owned = ptr_is_owned(b);
35521         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35522         b_conv.is_owned = false;
35523         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35524         return ret_conv;
35525 }
35526
35527 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
35528         LDKBigSize obj_conv;
35529         obj_conv.inner = untag_ptr(obj);
35530         obj_conv.is_owned = ptr_is_owned(obj);
35531         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35532         obj_conv.is_owned = false;
35533         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35534         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35535         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35536         CVec_u8Z_free(ret_var);
35537         return ret_arr;
35538 }
35539
35540 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
35541         LDKu8slice ser_ref;
35542         ser_ref.datalen = ser->arr_len;
35543         ser_ref.data = ser->elems;
35544         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35545         *ret_conv = BigSize_read(ser_ref);
35546         FREE(ser);
35547         return tag_ptr(ret_conv, true);
35548 }
35549
35550 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
35551         LDKHostname this_obj_conv;
35552         this_obj_conv.inner = untag_ptr(this_obj);
35553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35555         Hostname_free(this_obj_conv);
35556 }
35557
35558 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35559         LDKHostname ret_var = Hostname_clone(arg);
35560         uint64_t ret_ref = 0;
35561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35563         return ret_ref;
35564 }
35565 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
35566         LDKHostname arg_conv;
35567         arg_conv.inner = untag_ptr(arg);
35568         arg_conv.is_owned = ptr_is_owned(arg);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35570         arg_conv.is_owned = false;
35571         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35572         return ret_conv;
35573 }
35574
35575 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
35576         LDKHostname orig_conv;
35577         orig_conv.inner = untag_ptr(orig);
35578         orig_conv.is_owned = ptr_is_owned(orig);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35580         orig_conv.is_owned = false;
35581         LDKHostname ret_var = Hostname_clone(&orig_conv);
35582         uint64_t ret_ref = 0;
35583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35585         return ret_ref;
35586 }
35587
35588 int64_t  __attribute__((export_name("TS_Hostname_hash"))) TS_Hostname_hash(uint64_t o) {
35589         LDKHostname o_conv;
35590         o_conv.inner = untag_ptr(o);
35591         o_conv.is_owned = ptr_is_owned(o);
35592         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35593         o_conv.is_owned = false;
35594         int64_t ret_conv = Hostname_hash(&o_conv);
35595         return ret_conv;
35596 }
35597
35598 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
35599         LDKHostname a_conv;
35600         a_conv.inner = untag_ptr(a);
35601         a_conv.is_owned = ptr_is_owned(a);
35602         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35603         a_conv.is_owned = false;
35604         LDKHostname b_conv;
35605         b_conv.inner = untag_ptr(b);
35606         b_conv.is_owned = ptr_is_owned(b);
35607         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35608         b_conv.is_owned = false;
35609         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35610         return ret_conv;
35611 }
35612
35613 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
35614         LDKHostname this_arg_conv;
35615         this_arg_conv.inner = untag_ptr(this_arg);
35616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35618         this_arg_conv.is_owned = false;
35619         int8_t ret_conv = Hostname_len(&this_arg_conv);
35620         return ret_conv;
35621 }
35622
35623 jstring  __attribute__((export_name("TS_Hostname_to_str"))) TS_Hostname_to_str(uint64_t o) {
35624         LDKHostname o_conv;
35625         o_conv.inner = untag_ptr(o);
35626         o_conv.is_owned = ptr_is_owned(o);
35627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35628         o_conv.is_owned = false;
35629         LDKStr ret_str = Hostname_to_str(&o_conv);
35630         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35631         Str_free(ret_str);
35632         return ret_conv;
35633 }
35634
35635 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
35636         LDKHostname obj_conv;
35637         obj_conv.inner = untag_ptr(obj);
35638         obj_conv.is_owned = ptr_is_owned(obj);
35639         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35640         obj_conv.is_owned = false;
35641         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35644         CVec_u8Z_free(ret_var);
35645         return ret_arr;
35646 }
35647
35648 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
35649         LDKu8slice ser_ref;
35650         ser_ref.datalen = ser->arr_len;
35651         ser_ref.data = ser->elems;
35652         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35653         *ret_conv = Hostname_read(ser_ref);
35654         FREE(ser);
35655         return tag_ptr(ret_conv, true);
35656 }
35657
35658 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
35659         LDKTransactionU16LenLimited this_obj_conv;
35660         this_obj_conv.inner = untag_ptr(this_obj);
35661         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35663         TransactionU16LenLimited_free(this_obj_conv);
35664 }
35665
35666 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35667         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35668         uint64_t ret_ref = 0;
35669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35671         return ret_ref;
35672 }
35673 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
35674         LDKTransactionU16LenLimited arg_conv;
35675         arg_conv.inner = untag_ptr(arg);
35676         arg_conv.is_owned = ptr_is_owned(arg);
35677         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35678         arg_conv.is_owned = false;
35679         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35680         return ret_conv;
35681 }
35682
35683 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
35684         LDKTransactionU16LenLimited orig_conv;
35685         orig_conv.inner = untag_ptr(orig);
35686         orig_conv.is_owned = ptr_is_owned(orig);
35687         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35688         orig_conv.is_owned = false;
35689         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35690         uint64_t ret_ref = 0;
35691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35693         return ret_ref;
35694 }
35695
35696 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_hash"))) TS_TransactionU16LenLimited_hash(uint64_t o) {
35697         LDKTransactionU16LenLimited o_conv;
35698         o_conv.inner = untag_ptr(o);
35699         o_conv.is_owned = ptr_is_owned(o);
35700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35701         o_conv.is_owned = false;
35702         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
35703         return ret_conv;
35704 }
35705
35706 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
35707         LDKTransactionU16LenLimited a_conv;
35708         a_conv.inner = untag_ptr(a);
35709         a_conv.is_owned = ptr_is_owned(a);
35710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35711         a_conv.is_owned = false;
35712         LDKTransactionU16LenLimited b_conv;
35713         b_conv.inner = untag_ptr(b);
35714         b_conv.is_owned = ptr_is_owned(b);
35715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35716         b_conv.is_owned = false;
35717         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
35718         return ret_conv;
35719 }
35720
35721 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
35722         LDKTransaction transaction_ref;
35723         transaction_ref.datalen = transaction->arr_len;
35724         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
35725         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
35726         transaction_ref.data_is_owned = true;
35727         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35728         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
35729         return tag_ptr(ret_conv, true);
35730 }
35731
35732 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
35733         LDKTransactionU16LenLimited this_arg_conv;
35734         this_arg_conv.inner = untag_ptr(this_arg);
35735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35737         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
35738         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
35739         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35740         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35741         Transaction_free(ret_var);
35742         return ret_arr;
35743 }
35744
35745 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_as_transaction"))) TS_TransactionU16LenLimited_as_transaction(uint64_t this_arg) {
35746         LDKTransactionU16LenLimited this_arg_conv;
35747         this_arg_conv.inner = untag_ptr(this_arg);
35748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35750         this_arg_conv.is_owned = false;
35751         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
35752         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35753         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35754         Transaction_free(ret_var);
35755         return ret_arr;
35756 }
35757
35758 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
35759         LDKTransactionU16LenLimited obj_conv;
35760         obj_conv.inner = untag_ptr(obj);
35761         obj_conv.is_owned = ptr_is_owned(obj);
35762         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35763         obj_conv.is_owned = false;
35764         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
35765         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35766         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35767         CVec_u8Z_free(ret_var);
35768         return ret_arr;
35769 }
35770
35771 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
35772         LDKu8slice ser_ref;
35773         ser_ref.datalen = ser->arr_len;
35774         ser_ref.data = ser->elems;
35775         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35776         *ret_conv = TransactionU16LenLimited_read(ser_ref);
35777         FREE(ser);
35778         return tag_ptr(ret_conv, true);
35779 }
35780
35781 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
35782         LDKu8slice msg_ref;
35783         msg_ref.datalen = msg->arr_len;
35784         msg_ref.data = msg->elems;
35785         uint8_t sk_arr[32];
35786         CHECK(sk->arr_len == 32);
35787         memcpy(sk_arr, sk->elems, 32); FREE(sk);
35788         uint8_t (*sk_ref)[32] = &sk_arr;
35789         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
35790         *ret_conv = sign(msg_ref, sk_ref);
35791         FREE(msg);
35792         return tag_ptr(ret_conv, true);
35793 }
35794
35795 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
35796         LDKu8slice msg_ref;
35797         msg_ref.datalen = msg->arr_len;
35798         msg_ref.data = msg->elems;
35799         LDKStr sig_conv = str_ref_to_owned_c(sig);
35800         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
35801         *ret_conv = recover_pk(msg_ref, sig_conv);
35802         FREE(msg);
35803         return tag_ptr(ret_conv, true);
35804 }
35805
35806 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
35807         LDKu8slice msg_ref;
35808         msg_ref.datalen = msg->arr_len;
35809         msg_ref.data = msg->elems;
35810         LDKStr sig_conv = str_ref_to_owned_c(sig);
35811         LDKPublicKey pk_ref;
35812         CHECK(pk->arr_len == 33);
35813         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
35814         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
35815         FREE(msg);
35816         return ret_conv;
35817 }
35818
35819 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
35820         LDKu8slice hrp_bytes_ref;
35821         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
35822         hrp_bytes_ref.data = hrp_bytes->elems;
35823         LDKCVec_U5Z data_without_signature_constr;
35824         data_without_signature_constr.datalen = data_without_signature->arr_len;
35825         if (data_without_signature_constr.datalen > 0)
35826                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
35827         else
35828                 data_without_signature_constr.data = NULL;
35829         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
35830         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
35831                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
35832                 
35833                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
35834         }
35835         FREE(data_without_signature);
35836         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
35837         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35838         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35839         CVec_u8Z_free(ret_var);
35840         FREE(hrp_bytes);
35841         return ret_arr;
35842 }
35843
35844 void  __attribute__((export_name("TS_KVStore_free"))) TS_KVStore_free(uint64_t this_ptr) {
35845         if (!ptr_is_owned(this_ptr)) return;
35846         void* this_ptr_ptr = untag_ptr(this_ptr);
35847         CHECK_ACCESS(this_ptr_ptr);
35848         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
35849         FREE(untag_ptr(this_ptr));
35850         KVStore_free(this_ptr_conv);
35851 }
35852
35853 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
35854         if (!ptr_is_owned(this_ptr)) return;
35855         void* this_ptr_ptr = untag_ptr(this_ptr);
35856         CHECK_ACCESS(this_ptr_ptr);
35857         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
35858         FREE(untag_ptr(this_ptr));
35859         Persister_free(this_ptr_conv);
35860 }
35861
35862 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) {
35863         void* kv_store_ptr = untag_ptr(kv_store);
35864         CHECK_ACCESS(kv_store_ptr);
35865         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35866         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35868                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35869         }
35870         void* entropy_source_ptr = untag_ptr(entropy_source);
35871         CHECK_ACCESS(entropy_source_ptr);
35872         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35873         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35874                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35875                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35876         }
35877         void* signer_provider_ptr = untag_ptr(signer_provider);
35878         CHECK_ACCESS(signer_provider_ptr);
35879         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35880         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35881                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35882                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35883         }
35884         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35885         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
35886         return tag_ptr(ret_conv, true);
35887 }
35888
35889 void  __attribute__((export_name("TS_MonitorUpdatingPersister_free"))) TS_MonitorUpdatingPersister_free(uint64_t this_obj) {
35890         LDKMonitorUpdatingPersister this_obj_conv;
35891         this_obj_conv.inner = untag_ptr(this_obj);
35892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35894         MonitorUpdatingPersister_free(this_obj_conv);
35895 }
35896
35897 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) {
35898         void* kv_store_ptr = untag_ptr(kv_store);
35899         CHECK_ACCESS(kv_store_ptr);
35900         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35901         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35903                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35904         }
35905         void* logger_ptr = untag_ptr(logger);
35906         CHECK_ACCESS(logger_ptr);
35907         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35908         if (logger_conv.free == LDKLogger_JCalls_free) {
35909                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35910                 LDKLogger_JCalls_cloned(&logger_conv);
35911         }
35912         void* entropy_source_ptr = untag_ptr(entropy_source);
35913         CHECK_ACCESS(entropy_source_ptr);
35914         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35915         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35916                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35917                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35918         }
35919         void* signer_provider_ptr = untag_ptr(signer_provider);
35920         CHECK_ACCESS(signer_provider_ptr);
35921         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35922         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35923                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35924                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35925         }
35926         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
35927         uint64_t ret_ref = 0;
35928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35930         return ret_ref;
35931 }
35932
35933 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) {
35934         LDKMonitorUpdatingPersister this_arg_conv;
35935         this_arg_conv.inner = untag_ptr(this_arg);
35936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35938         this_arg_conv.is_owned = false;
35939         void* broadcaster_ptr = untag_ptr(broadcaster);
35940         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35941         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35942         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35943         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35944         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35945         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35946         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
35947         return tag_ptr(ret_conv, true);
35948 }
35949
35950 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) {
35951         LDKMonitorUpdatingPersister this_arg_conv;
35952         this_arg_conv.inner = untag_ptr(this_arg);
35953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35955         this_arg_conv.is_owned = false;
35956         void* broadcaster_ptr = untag_ptr(broadcaster);
35957         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35958         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35959         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35960         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35961         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35962         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
35963         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
35964         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
35965         return tag_ptr(ret_conv, true);
35966 }
35967
35968 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_cleanup_stale_updates"))) TS_MonitorUpdatingPersister_cleanup_stale_updates(uint64_t this_arg, jboolean lazy) {
35969         LDKMonitorUpdatingPersister this_arg_conv;
35970         this_arg_conv.inner = untag_ptr(this_arg);
35971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35973         this_arg_conv.is_owned = false;
35974         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
35975         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
35976         return tag_ptr(ret_conv, true);
35977 }
35978
35979 uint64_t  __attribute__((export_name("TS_MonitorUpdatingPersister_as_Persist"))) TS_MonitorUpdatingPersister_as_Persist(uint64_t this_arg) {
35980         LDKMonitorUpdatingPersister this_arg_conv;
35981         this_arg_conv.inner = untag_ptr(this_arg);
35982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35984         this_arg_conv.is_owned = false;
35985         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35986         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
35987         return tag_ptr(ret_ret, true);
35988 }
35989
35990 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_clone"))) TS_ShortChannelIdError_clone(uint64_t orig) {
35991         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
35992         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_clone(orig_conv));
35993         return ret_conv;
35994 }
35995
35996 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_block_overflow"))) TS_ShortChannelIdError_block_overflow() {
35997         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_block_overflow());
35998         return ret_conv;
35999 }
36000
36001 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_tx_index_overflow"))) TS_ShortChannelIdError_tx_index_overflow() {
36002         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_tx_index_overflow());
36003         return ret_conv;
36004 }
36005
36006 uint32_t  __attribute__((export_name("TS_ShortChannelIdError_vout_index_overflow"))) TS_ShortChannelIdError_vout_index_overflow() {
36007         uint32_t ret_conv = LDKShortChannelIdError_to_js(ShortChannelIdError_vout_index_overflow());
36008         return ret_conv;
36009 }
36010
36011 jboolean  __attribute__((export_name("TS_ShortChannelIdError_eq"))) TS_ShortChannelIdError_eq(uint64_t a, uint64_t b) {
36012         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
36013         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
36014         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
36015         return ret_conv;
36016 }
36017
36018 int32_t  __attribute__((export_name("TS_block_from_scid"))) TS_block_from_scid(int64_t short_channel_id) {
36019         int32_t ret_conv = block_from_scid(short_channel_id);
36020         return ret_conv;
36021 }
36022
36023 int32_t  __attribute__((export_name("TS_tx_index_from_scid"))) TS_tx_index_from_scid(int64_t short_channel_id) {
36024         int32_t ret_conv = tx_index_from_scid(short_channel_id);
36025         return ret_conv;
36026 }
36027
36028 int16_t  __attribute__((export_name("TS_vout_from_scid"))) TS_vout_from_scid(int64_t short_channel_id) {
36029         int16_t ret_conv = vout_from_scid(short_channel_id);
36030         return ret_conv;
36031 }
36032
36033 uint64_t  __attribute__((export_name("TS_scid_from_parts"))) TS_scid_from_parts(int64_t block, int64_t tx_index, int64_t vout_index) {
36034         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
36035         *ret_conv = scid_from_parts(block, tx_index, vout_index);
36036         return tag_ptr(ret_conv, true);
36037 }
36038
36039 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
36040         LDKUntrustedString this_obj_conv;
36041         this_obj_conv.inner = untag_ptr(this_obj);
36042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36044         UntrustedString_free(this_obj_conv);
36045 }
36046
36047 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
36048         LDKUntrustedString this_ptr_conv;
36049         this_ptr_conv.inner = untag_ptr(this_ptr);
36050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36052         this_ptr_conv.is_owned = false;
36053         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
36054         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36055         Str_free(ret_str);
36056         return ret_conv;
36057 }
36058
36059 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
36060         LDKUntrustedString this_ptr_conv;
36061         this_ptr_conv.inner = untag_ptr(this_ptr);
36062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36064         this_ptr_conv.is_owned = false;
36065         LDKStr val_conv = str_ref_to_owned_c(val);
36066         UntrustedString_set_a(&this_ptr_conv, val_conv);
36067 }
36068
36069 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
36070         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
36071         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
36072         uint64_t ret_ref = 0;
36073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36075         return ret_ref;
36076 }
36077
36078 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
36079         LDKUntrustedString ret_var = UntrustedString_clone(arg);
36080         uint64_t ret_ref = 0;
36081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36083         return ret_ref;
36084 }
36085 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
36086         LDKUntrustedString arg_conv;
36087         arg_conv.inner = untag_ptr(arg);
36088         arg_conv.is_owned = ptr_is_owned(arg);
36089         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36090         arg_conv.is_owned = false;
36091         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
36092         return ret_conv;
36093 }
36094
36095 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
36096         LDKUntrustedString orig_conv;
36097         orig_conv.inner = untag_ptr(orig);
36098         orig_conv.is_owned = ptr_is_owned(orig);
36099         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36100         orig_conv.is_owned = false;
36101         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
36102         uint64_t ret_ref = 0;
36103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36105         return ret_ref;
36106 }
36107
36108 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
36109         LDKUntrustedString a_conv;
36110         a_conv.inner = untag_ptr(a);
36111         a_conv.is_owned = ptr_is_owned(a);
36112         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36113         a_conv.is_owned = false;
36114         LDKUntrustedString b_conv;
36115         b_conv.inner = untag_ptr(b);
36116         b_conv.is_owned = ptr_is_owned(b);
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36118         b_conv.is_owned = false;
36119         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
36120         return ret_conv;
36121 }
36122
36123 int64_t  __attribute__((export_name("TS_UntrustedString_hash"))) TS_UntrustedString_hash(uint64_t o) {
36124         LDKUntrustedString o_conv;
36125         o_conv.inner = untag_ptr(o);
36126         o_conv.is_owned = ptr_is_owned(o);
36127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36128         o_conv.is_owned = false;
36129         int64_t ret_conv = UntrustedString_hash(&o_conv);
36130         return ret_conv;
36131 }
36132
36133 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
36134         LDKUntrustedString obj_conv;
36135         obj_conv.inner = untag_ptr(obj);
36136         obj_conv.is_owned = ptr_is_owned(obj);
36137         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36138         obj_conv.is_owned = false;
36139         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
36140         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36141         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36142         CVec_u8Z_free(ret_var);
36143         return ret_arr;
36144 }
36145
36146 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
36147         LDKu8slice ser_ref;
36148         ser_ref.datalen = ser->arr_len;
36149         ser_ref.data = ser->elems;
36150         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
36151         *ret_conv = UntrustedString_read(ser_ref);
36152         FREE(ser);
36153         return tag_ptr(ret_conv, true);
36154 }
36155
36156 jstring  __attribute__((export_name("TS_UntrustedString_to_str"))) TS_UntrustedString_to_str(uint64_t o) {
36157         LDKUntrustedString o_conv;
36158         o_conv.inner = untag_ptr(o);
36159         o_conv.is_owned = ptr_is_owned(o);
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36161         o_conv.is_owned = false;
36162         LDKStr ret_str = UntrustedString_to_str(&o_conv);
36163         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36164         Str_free(ret_str);
36165         return ret_conv;
36166 }
36167
36168 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
36169         LDKPrintableString this_obj_conv;
36170         this_obj_conv.inner = untag_ptr(this_obj);
36171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36173         PrintableString_free(this_obj_conv);
36174 }
36175
36176 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
36177         LDKPrintableString this_ptr_conv;
36178         this_ptr_conv.inner = untag_ptr(this_ptr);
36179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36181         this_ptr_conv.is_owned = false;
36182         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
36183         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36184         Str_free(ret_str);
36185         return ret_conv;
36186 }
36187
36188 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
36189         LDKPrintableString this_ptr_conv;
36190         this_ptr_conv.inner = untag_ptr(this_ptr);
36191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36193         this_ptr_conv.is_owned = false;
36194         LDKStr val_conv = str_ref_to_owned_c(val);
36195         PrintableString_set_a(&this_ptr_conv, val_conv);
36196 }
36197
36198 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
36199         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
36200         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
36201         uint64_t ret_ref = 0;
36202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36204         return ret_ref;
36205 }
36206
36207 jstring  __attribute__((export_name("TS_PrintableString_to_str"))) TS_PrintableString_to_str(uint64_t o) {
36208         LDKPrintableString o_conv;
36209         o_conv.inner = untag_ptr(o);
36210         o_conv.is_owned = ptr_is_owned(o);
36211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36212         o_conv.is_owned = false;
36213         LDKStr ret_str = PrintableString_to_str(&o_conv);
36214         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36215         Str_free(ret_str);
36216         return ret_conv;
36217 }
36218
36219 void  __attribute__((export_name("TS_TrackedSpendableOutput_free"))) TS_TrackedSpendableOutput_free(uint64_t this_obj) {
36220         LDKTrackedSpendableOutput this_obj_conv;
36221         this_obj_conv.inner = untag_ptr(this_obj);
36222         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36224         TrackedSpendableOutput_free(this_obj_conv);
36225 }
36226
36227 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_descriptor"))) TS_TrackedSpendableOutput_get_descriptor(uint64_t this_ptr) {
36228         LDKTrackedSpendableOutput this_ptr_conv;
36229         this_ptr_conv.inner = untag_ptr(this_ptr);
36230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36232         this_ptr_conv.is_owned = false;
36233         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
36234         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
36235         uint64_t ret_ref = tag_ptr(ret_copy, true);
36236         return ret_ref;
36237 }
36238
36239 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_descriptor"))) TS_TrackedSpendableOutput_set_descriptor(uint64_t this_ptr, uint64_t val) {
36240         LDKTrackedSpendableOutput this_ptr_conv;
36241         this_ptr_conv.inner = untag_ptr(this_ptr);
36242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36244         this_ptr_conv.is_owned = false;
36245         void* val_ptr = untag_ptr(val);
36246         CHECK_ACCESS(val_ptr);
36247         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
36248         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
36249         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
36250 }
36251
36252 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_channel_id"))) TS_TrackedSpendableOutput_get_channel_id(uint64_t this_ptr) {
36253         LDKTrackedSpendableOutput this_ptr_conv;
36254         this_ptr_conv.inner = untag_ptr(this_ptr);
36255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36257         this_ptr_conv.is_owned = false;
36258         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
36259         uint64_t ret_ref = 0;
36260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36262         return ret_ref;
36263 }
36264
36265 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_channel_id"))) TS_TrackedSpendableOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
36266         LDKTrackedSpendableOutput this_ptr_conv;
36267         this_ptr_conv.inner = untag_ptr(this_ptr);
36268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36270         this_ptr_conv.is_owned = false;
36271         LDKChannelId val_conv;
36272         val_conv.inner = untag_ptr(val);
36273         val_conv.is_owned = ptr_is_owned(val);
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36275         val_conv = ChannelId_clone(&val_conv);
36276         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
36277 }
36278
36279 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_get_status"))) TS_TrackedSpendableOutput_get_status(uint64_t this_ptr) {
36280         LDKTrackedSpendableOutput this_ptr_conv;
36281         this_ptr_conv.inner = untag_ptr(this_ptr);
36282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36284         this_ptr_conv.is_owned = false;
36285         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36286         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
36287         uint64_t ret_ref = tag_ptr(ret_copy, true);
36288         return ret_ref;
36289 }
36290
36291 void  __attribute__((export_name("TS_TrackedSpendableOutput_set_status"))) TS_TrackedSpendableOutput_set_status(uint64_t this_ptr, uint64_t val) {
36292         LDKTrackedSpendableOutput this_ptr_conv;
36293         this_ptr_conv.inner = untag_ptr(this_ptr);
36294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36296         this_ptr_conv.is_owned = false;
36297         void* val_ptr = untag_ptr(val);
36298         CHECK_ACCESS(val_ptr);
36299         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
36300         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
36301         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
36302 }
36303
36304 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_new"))) TS_TrackedSpendableOutput_new(uint64_t descriptor_arg, uint64_t channel_id_arg, uint64_t status_arg) {
36305         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
36306         CHECK_ACCESS(descriptor_arg_ptr);
36307         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
36308         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
36309         LDKChannelId channel_id_arg_conv;
36310         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
36311         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
36312         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
36313         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
36314         void* status_arg_ptr = untag_ptr(status_arg);
36315         CHECK_ACCESS(status_arg_ptr);
36316         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
36317         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
36318         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
36319         uint64_t ret_ref = 0;
36320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36322         return ret_ref;
36323 }
36324
36325 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
36326         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
36327         uint64_t ret_ref = 0;
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36330         return ret_ref;
36331 }
36332 int64_t  __attribute__((export_name("TS_TrackedSpendableOutput_clone_ptr"))) TS_TrackedSpendableOutput_clone_ptr(uint64_t arg) {
36333         LDKTrackedSpendableOutput arg_conv;
36334         arg_conv.inner = untag_ptr(arg);
36335         arg_conv.is_owned = ptr_is_owned(arg);
36336         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36337         arg_conv.is_owned = false;
36338         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
36339         return ret_conv;
36340 }
36341
36342 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_clone"))) TS_TrackedSpendableOutput_clone(uint64_t orig) {
36343         LDKTrackedSpendableOutput orig_conv;
36344         orig_conv.inner = untag_ptr(orig);
36345         orig_conv.is_owned = ptr_is_owned(orig);
36346         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36347         orig_conv.is_owned = false;
36348         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
36349         uint64_t ret_ref = 0;
36350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36352         return ret_ref;
36353 }
36354
36355 jboolean  __attribute__((export_name("TS_TrackedSpendableOutput_eq"))) TS_TrackedSpendableOutput_eq(uint64_t a, uint64_t b) {
36356         LDKTrackedSpendableOutput a_conv;
36357         a_conv.inner = untag_ptr(a);
36358         a_conv.is_owned = ptr_is_owned(a);
36359         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36360         a_conv.is_owned = false;
36361         LDKTrackedSpendableOutput b_conv;
36362         b_conv.inner = untag_ptr(b);
36363         b_conv.is_owned = ptr_is_owned(b);
36364         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36365         b_conv.is_owned = false;
36366         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
36367         return ret_conv;
36368 }
36369
36370 jboolean  __attribute__((export_name("TS_TrackedSpendableOutput_is_spent_in"))) TS_TrackedSpendableOutput_is_spent_in(uint64_t this_arg, int8_tArray tx) {
36371         LDKTrackedSpendableOutput this_arg_conv;
36372         this_arg_conv.inner = untag_ptr(this_arg);
36373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36375         this_arg_conv.is_owned = false;
36376         LDKTransaction tx_ref;
36377         tx_ref.datalen = tx->arr_len;
36378         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
36379         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
36380         tx_ref.data_is_owned = true;
36381         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
36382         return ret_conv;
36383 }
36384
36385 int8_tArray  __attribute__((export_name("TS_TrackedSpendableOutput_write"))) TS_TrackedSpendableOutput_write(uint64_t obj) {
36386         LDKTrackedSpendableOutput obj_conv;
36387         obj_conv.inner = untag_ptr(obj);
36388         obj_conv.is_owned = ptr_is_owned(obj);
36389         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36390         obj_conv.is_owned = false;
36391         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
36392         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36393         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36394         CVec_u8Z_free(ret_var);
36395         return ret_arr;
36396 }
36397
36398 uint64_t  __attribute__((export_name("TS_TrackedSpendableOutput_read"))) TS_TrackedSpendableOutput_read(int8_tArray ser) {
36399         LDKu8slice ser_ref;
36400         ser_ref.datalen = ser->arr_len;
36401         ser_ref.data = ser->elems;
36402         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
36403         *ret_conv = TrackedSpendableOutput_read(ser_ref);
36404         FREE(ser);
36405         return tag_ptr(ret_conv, true);
36406 }
36407
36408 void  __attribute__((export_name("TS_OutputSpendStatus_free"))) TS_OutputSpendStatus_free(uint64_t this_ptr) {
36409         if (!ptr_is_owned(this_ptr)) return;
36410         void* this_ptr_ptr = untag_ptr(this_ptr);
36411         CHECK_ACCESS(this_ptr_ptr);
36412         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
36413         FREE(untag_ptr(this_ptr));
36414         OutputSpendStatus_free(this_ptr_conv);
36415 }
36416
36417 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
36418         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36419         *ret_copy = OutputSpendStatus_clone(arg);
36420         uint64_t ret_ref = tag_ptr(ret_copy, true);
36421         return ret_ref;
36422 }
36423 int64_t  __attribute__((export_name("TS_OutputSpendStatus_clone_ptr"))) TS_OutputSpendStatus_clone_ptr(uint64_t arg) {
36424         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
36425         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
36426         return ret_conv;
36427 }
36428
36429 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_clone"))) TS_OutputSpendStatus_clone(uint64_t orig) {
36430         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
36431         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36432         *ret_copy = OutputSpendStatus_clone(orig_conv);
36433         uint64_t ret_ref = tag_ptr(ret_copy, true);
36434         return ret_ref;
36435 }
36436
36437 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_pending_initial_broadcast"))) TS_OutputSpendStatus_pending_initial_broadcast(uint64_t delayed_until_height) {
36438         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
36439         CHECK_ACCESS(delayed_until_height_ptr);
36440         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
36441         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
36442         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36443         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
36444         uint64_t ret_ref = tag_ptr(ret_copy, true);
36445         return ret_ref;
36446 }
36447
36448 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_pending_first_confirmation"))) TS_OutputSpendStatus_pending_first_confirmation(int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx) {
36449         LDKThirtyTwoBytes first_broadcast_hash_ref;
36450         CHECK(first_broadcast_hash->arr_len == 32);
36451         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
36452         LDKTransaction latest_spending_tx_ref;
36453         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
36454         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
36455         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
36456         latest_spending_tx_ref.data_is_owned = true;
36457         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36458         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
36459         uint64_t ret_ref = tag_ptr(ret_copy, true);
36460         return ret_ref;
36461 }
36462
36463 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_pending_threshold_confirmations"))) TS_OutputSpendStatus_pending_threshold_confirmations(int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx, int32_t confirmation_height, int8_tArray confirmation_hash) {
36464         LDKThirtyTwoBytes first_broadcast_hash_ref;
36465         CHECK(first_broadcast_hash->arr_len == 32);
36466         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
36467         LDKTransaction latest_spending_tx_ref;
36468         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
36469         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
36470         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
36471         latest_spending_tx_ref.data_is_owned = true;
36472         LDKThirtyTwoBytes confirmation_hash_ref;
36473         CHECK(confirmation_hash->arr_len == 32);
36474         memcpy(confirmation_hash_ref.data, confirmation_hash->elems, 32); FREE(confirmation_hash);
36475         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36476         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
36477         uint64_t ret_ref = tag_ptr(ret_copy, true);
36478         return ret_ref;
36479 }
36480
36481 jboolean  __attribute__((export_name("TS_OutputSpendStatus_eq"))) TS_OutputSpendStatus_eq(uint64_t a, uint64_t b) {
36482         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
36483         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
36484         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
36485         return ret_conv;
36486 }
36487
36488 int8_tArray  __attribute__((export_name("TS_OutputSpendStatus_write"))) TS_OutputSpendStatus_write(uint64_t obj) {
36489         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
36490         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
36491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36493         CVec_u8Z_free(ret_var);
36494         return ret_arr;
36495 }
36496
36497 uint64_t  __attribute__((export_name("TS_OutputSpendStatus_read"))) TS_OutputSpendStatus_read(int8_tArray ser) {
36498         LDKu8slice ser_ref;
36499         ser_ref.datalen = ser->arr_len;
36500         ser_ref.data = ser->elems;
36501         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
36502         *ret_conv = OutputSpendStatus_read(ser_ref);
36503         FREE(ser);
36504         return tag_ptr(ret_conv, true);
36505 }
36506
36507 void  __attribute__((export_name("TS_OutputSweeper_free"))) TS_OutputSweeper_free(uint64_t this_obj) {
36508         LDKOutputSweeper this_obj_conv;
36509         this_obj_conv.inner = untag_ptr(this_obj);
36510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36512         OutputSweeper_free(this_obj_conv);
36513 }
36514
36515 uint64_t  __attribute__((export_name("TS_OutputSweeper_new"))) TS_OutputSweeper_new(uint64_t best_block, uint64_t broadcaster, uint64_t fee_estimator, uint64_t chain_data_source, uint64_t output_spender, uint64_t change_destination_source, uint64_t kv_store, uint64_t logger) {
36516         LDKBestBlock best_block_conv;
36517         best_block_conv.inner = untag_ptr(best_block);
36518         best_block_conv.is_owned = ptr_is_owned(best_block);
36519         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
36520         best_block_conv = BestBlock_clone(&best_block_conv);
36521         void* broadcaster_ptr = untag_ptr(broadcaster);
36522         CHECK_ACCESS(broadcaster_ptr);
36523         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36524         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36525                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36526                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36527         }
36528         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36529         CHECK_ACCESS(fee_estimator_ptr);
36530         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36531         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36532                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36533                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36534         }
36535         void* chain_data_source_ptr = untag_ptr(chain_data_source);
36536         CHECK_ACCESS(chain_data_source_ptr);
36537         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
36538         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36539         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
36540                 // Manually implement clone for Java trait instances
36541                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
36542                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36543                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
36544                 }
36545         }
36546         void* output_spender_ptr = untag_ptr(output_spender);
36547         CHECK_ACCESS(output_spender_ptr);
36548         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
36549         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
36550                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36551                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
36552         }
36553         void* change_destination_source_ptr = untag_ptr(change_destination_source);
36554         CHECK_ACCESS(change_destination_source_ptr);
36555         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
36556         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
36557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36558                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
36559         }
36560         void* kv_store_ptr = untag_ptr(kv_store);
36561         CHECK_ACCESS(kv_store_ptr);
36562         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36563         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36565                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36566         }
36567         void* logger_ptr = untag_ptr(logger);
36568         CHECK_ACCESS(logger_ptr);
36569         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36570         if (logger_conv.free == LDKLogger_JCalls_free) {
36571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36572                 LDKLogger_JCalls_cloned(&logger_conv);
36573         }
36574         LDKOutputSweeper ret_var = OutputSweeper_new(best_block_conv, broadcaster_conv, fee_estimator_conv, chain_data_source_conv, output_spender_conv, change_destination_source_conv, kv_store_conv, logger_conv);
36575         uint64_t ret_ref = 0;
36576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36578         return ret_ref;
36579 }
36580
36581 uint64_t  __attribute__((export_name("TS_OutputSweeper_track_spendable_outputs"))) TS_OutputSweeper_track_spendable_outputs(uint64_t this_arg, uint64_tArray output_descriptors, uint64_t channel_id, jboolean exclude_static_outputs, uint64_t delay_until_height) {
36582         LDKOutputSweeper this_arg_conv;
36583         this_arg_conv.inner = untag_ptr(this_arg);
36584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36586         this_arg_conv.is_owned = false;
36587         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
36588         output_descriptors_constr.datalen = output_descriptors->arr_len;
36589         if (output_descriptors_constr.datalen > 0)
36590                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
36591         else
36592                 output_descriptors_constr.data = NULL;
36593         uint64_t* output_descriptors_vals = output_descriptors->elems;
36594         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
36595                 uint64_t output_descriptors_conv_27 = output_descriptors_vals[b];
36596                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
36597                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
36598                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
36599                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
36600                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
36601         }
36602         FREE(output_descriptors);
36603         LDKChannelId channel_id_conv;
36604         channel_id_conv.inner = untag_ptr(channel_id);
36605         channel_id_conv.is_owned = ptr_is_owned(channel_id);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
36607         channel_id_conv = ChannelId_clone(&channel_id_conv);
36608         void* delay_until_height_ptr = untag_ptr(delay_until_height);
36609         CHECK_ACCESS(delay_until_height_ptr);
36610         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
36611         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
36612         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36613         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
36614         return tag_ptr(ret_conv, true);
36615 }
36616
36617 uint64_tArray  __attribute__((export_name("TS_OutputSweeper_tracked_spendable_outputs"))) TS_OutputSweeper_tracked_spendable_outputs(uint64_t this_arg) {
36618         LDKOutputSweeper this_arg_conv;
36619         this_arg_conv.inner = untag_ptr(this_arg);
36620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36622         this_arg_conv.is_owned = false;
36623         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
36624         uint64_tArray ret_arr = NULL;
36625         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
36626         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
36627         for (size_t y = 0; y < ret_var.datalen; y++) {
36628                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
36629                 uint64_t ret_conv_24_ref = 0;
36630                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
36631                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
36632                 ret_arr_ptr[y] = ret_conv_24_ref;
36633         }
36634         
36635         FREE(ret_var.data);
36636         return ret_arr;
36637 }
36638
36639 uint64_t  __attribute__((export_name("TS_OutputSweeper_current_best_block"))) TS_OutputSweeper_current_best_block(uint64_t this_arg) {
36640         LDKOutputSweeper this_arg_conv;
36641         this_arg_conv.inner = untag_ptr(this_arg);
36642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36644         this_arg_conv.is_owned = false;
36645         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
36646         uint64_t ret_ref = 0;
36647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36649         return ret_ref;
36650 }
36651
36652 uint64_t  __attribute__((export_name("TS_OutputSweeper_as_Listen"))) TS_OutputSweeper_as_Listen(uint64_t this_arg) {
36653         LDKOutputSweeper this_arg_conv;
36654         this_arg_conv.inner = untag_ptr(this_arg);
36655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36657         this_arg_conv.is_owned = false;
36658         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36659         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
36660         return tag_ptr(ret_ret, true);
36661 }
36662
36663 uint64_t  __attribute__((export_name("TS_OutputSweeper_as_Confirm"))) TS_OutputSweeper_as_Confirm(uint64_t this_arg) {
36664         LDKOutputSweeper this_arg_conv;
36665         this_arg_conv.inner = untag_ptr(this_arg);
36666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36668         this_arg_conv.is_owned = false;
36669         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36670         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
36671         return tag_ptr(ret_ret, true);
36672 }
36673
36674 void  __attribute__((export_name("TS_SpendingDelay_free"))) TS_SpendingDelay_free(uint64_t this_ptr) {
36675         if (!ptr_is_owned(this_ptr)) return;
36676         void* this_ptr_ptr = untag_ptr(this_ptr);
36677         CHECK_ACCESS(this_ptr_ptr);
36678         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
36679         FREE(untag_ptr(this_ptr));
36680         SpendingDelay_free(this_ptr_conv);
36681 }
36682
36683 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
36684         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36685         *ret_copy = SpendingDelay_clone(arg);
36686         uint64_t ret_ref = tag_ptr(ret_copy, true);
36687         return ret_ref;
36688 }
36689 int64_t  __attribute__((export_name("TS_SpendingDelay_clone_ptr"))) TS_SpendingDelay_clone_ptr(uint64_t arg) {
36690         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
36691         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
36692         return ret_conv;
36693 }
36694
36695 uint64_t  __attribute__((export_name("TS_SpendingDelay_clone"))) TS_SpendingDelay_clone(uint64_t orig) {
36696         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
36697         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36698         *ret_copy = SpendingDelay_clone(orig_conv);
36699         uint64_t ret_ref = tag_ptr(ret_copy, true);
36700         return ret_ref;
36701 }
36702
36703 uint64_t  __attribute__((export_name("TS_SpendingDelay_relative"))) TS_SpendingDelay_relative(int32_t num_blocks) {
36704         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36705         *ret_copy = SpendingDelay_relative(num_blocks);
36706         uint64_t ret_ref = tag_ptr(ret_copy, true);
36707         return ret_ref;
36708 }
36709
36710 uint64_t  __attribute__((export_name("TS_SpendingDelay_absolute"))) TS_SpendingDelay_absolute(int32_t height) {
36711         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36712         *ret_copy = SpendingDelay_absolute(height);
36713         uint64_t ret_ref = tag_ptr(ret_copy, true);
36714         return ret_ref;
36715 }
36716
36717 uint64_t  __attribute__((export_name("TS_OutputSweeper_read"))) TS_OutputSweeper_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b, uint64_t arg_c, uint64_t arg_d, uint64_t arg_e, uint64_t arg_f, uint64_t arg_g) {
36718         LDKu8slice ser_ref;
36719         ser_ref.datalen = ser->arr_len;
36720         ser_ref.data = ser->elems;
36721         void* arg_a_ptr = untag_ptr(arg_a);
36722         CHECK_ACCESS(arg_a_ptr);
36723         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36724         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36725                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36726                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36727         }
36728         void* arg_b_ptr = untag_ptr(arg_b);
36729         CHECK_ACCESS(arg_b_ptr);
36730         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36731         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36732                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36733                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36734         }
36735         void* arg_c_ptr = untag_ptr(arg_c);
36736         CHECK_ACCESS(arg_c_ptr);
36737         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36738         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36739         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36740                 // Manually implement clone for Java trait instances
36741                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36742                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36743                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36744                 }
36745         }
36746         void* arg_d_ptr = untag_ptr(arg_d);
36747         CHECK_ACCESS(arg_d_ptr);
36748         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36749         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36750                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36751                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36752         }
36753         void* arg_e_ptr = untag_ptr(arg_e);
36754         CHECK_ACCESS(arg_e_ptr);
36755         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36756         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36757                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36758                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36759         }
36760         void* arg_f_ptr = untag_ptr(arg_f);
36761         CHECK_ACCESS(arg_f_ptr);
36762         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36763         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36764                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36765                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36766         }
36767         void* arg_g_ptr = untag_ptr(arg_g);
36768         CHECK_ACCESS(arg_g_ptr);
36769         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36770         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36771                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36772                 LDKLogger_JCalls_cloned(&arg_g_conv);
36773         }
36774         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
36775         *ret_conv = OutputSweeper_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
36776         FREE(ser);
36777         return tag_ptr(ret_conv, true);
36778 }
36779
36780 uint64_t  __attribute__((export_name("TS_C2Tuple_BestBlockOutputSweeperZ_read"))) TS_C2Tuple_BestBlockOutputSweeperZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b, uint64_t arg_c, uint64_t arg_d, uint64_t arg_e, uint64_t arg_f, uint64_t arg_g) {
36781         LDKu8slice ser_ref;
36782         ser_ref.datalen = ser->arr_len;
36783         ser_ref.data = ser->elems;
36784         void* arg_a_ptr = untag_ptr(arg_a);
36785         CHECK_ACCESS(arg_a_ptr);
36786         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36787         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36788                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36789                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36790         }
36791         void* arg_b_ptr = untag_ptr(arg_b);
36792         CHECK_ACCESS(arg_b_ptr);
36793         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36794         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36795                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36796                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36797         }
36798         void* arg_c_ptr = untag_ptr(arg_c);
36799         CHECK_ACCESS(arg_c_ptr);
36800         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36801         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36802         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36803                 // Manually implement clone for Java trait instances
36804                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36805                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36806                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36807                 }
36808         }
36809         void* arg_d_ptr = untag_ptr(arg_d);
36810         CHECK_ACCESS(arg_d_ptr);
36811         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36812         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36814                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36815         }
36816         void* arg_e_ptr = untag_ptr(arg_e);
36817         CHECK_ACCESS(arg_e_ptr);
36818         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36819         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36820                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36821                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36822         }
36823         void* arg_f_ptr = untag_ptr(arg_f);
36824         CHECK_ACCESS(arg_f_ptr);
36825         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36826         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36828                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36829         }
36830         void* arg_g_ptr = untag_ptr(arg_g);
36831         CHECK_ACCESS(arg_g_ptr);
36832         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36833         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36835                 LDKLogger_JCalls_cloned(&arg_g_conv);
36836         }
36837         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
36838         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
36839         FREE(ser);
36840         return tag_ptr(ret_conv, true);
36841 }
36842
36843 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
36844         if (!ptr_is_owned(this_ptr)) return;
36845         void* this_ptr_ptr = untag_ptr(this_ptr);
36846         CHECK_ACCESS(this_ptr_ptr);
36847         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
36848         FREE(untag_ptr(this_ptr));
36849         FutureCallback_free(this_ptr_conv);
36850 }
36851
36852 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
36853         LDKFuture this_obj_conv;
36854         this_obj_conv.inner = untag_ptr(this_obj);
36855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36857         Future_free(this_obj_conv);
36858 }
36859
36860 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
36861         LDKFuture this_arg_conv;
36862         this_arg_conv.inner = untag_ptr(this_arg);
36863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36865         this_arg_conv.is_owned = false;
36866         void* callback_ptr = untag_ptr(callback);
36867         CHECK_ACCESS(callback_ptr);
36868         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
36869         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
36870                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36871                 LDKFutureCallback_JCalls_cloned(&callback_conv);
36872         }
36873         Future_register_callback_fn(&this_arg_conv, callback_conv);
36874 }
36875
36876 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
36877         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
36878         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
36879         return ret_conv;
36880 }
36881
36882 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
36883         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
36884         return ret_conv;
36885 }
36886
36887 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
36888         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
36889         return ret_conv;
36890 }
36891
36892 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
36893         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
36894         return ret_conv;
36895 }
36896
36897 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
36898         uint32_t ret_conv = LDKLevel_to_js(Level_info());
36899         return ret_conv;
36900 }
36901
36902 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
36903         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
36904         return ret_conv;
36905 }
36906
36907 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
36908         uint32_t ret_conv = LDKLevel_to_js(Level_error());
36909         return ret_conv;
36910 }
36911
36912 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
36913         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
36914         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
36915         jboolean ret_conv = Level_eq(a_conv, b_conv);
36916         return ret_conv;
36917 }
36918
36919 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
36920         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
36921         int64_t ret_conv = Level_hash(o_conv);
36922         return ret_conv;
36923 }
36924
36925 jstring  __attribute__((export_name("TS_Level_to_str"))) TS_Level_to_str(uint64_t o) {
36926         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
36927         LDKStr ret_str = Level_to_str(o_conv);
36928         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
36929         Str_free(ret_str);
36930         return ret_conv;
36931 }
36932
36933 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
36934         uint32_t ret_conv = LDKLevel_to_js(Level_max());
36935         return ret_conv;
36936 }
36937
36938 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
36939         LDKRecord this_obj_conv;
36940         this_obj_conv.inner = untag_ptr(this_obj);
36941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36943         Record_free(this_obj_conv);
36944 }
36945
36946 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
36947         LDKRecord this_ptr_conv;
36948         this_ptr_conv.inner = untag_ptr(this_ptr);
36949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36951         this_ptr_conv.is_owned = false;
36952         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
36953         return ret_conv;
36954 }
36955
36956 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
36957         LDKRecord this_ptr_conv;
36958         this_ptr_conv.inner = untag_ptr(this_ptr);
36959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36961         this_ptr_conv.is_owned = false;
36962         LDKLevel val_conv = LDKLevel_from_js(val);
36963         Record_set_level(&this_ptr_conv, val_conv);
36964 }
36965
36966 int8_tArray  __attribute__((export_name("TS_Record_get_peer_id"))) TS_Record_get_peer_id(uint64_t this_ptr) {
36967         LDKRecord this_ptr_conv;
36968         this_ptr_conv.inner = untag_ptr(this_ptr);
36969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36971         this_ptr_conv.is_owned = false;
36972         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36973         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
36974         return ret_arr;
36975 }
36976
36977 void  __attribute__((export_name("TS_Record_set_peer_id"))) TS_Record_set_peer_id(uint64_t this_ptr, int8_tArray val) {
36978         LDKRecord this_ptr_conv;
36979         this_ptr_conv.inner = untag_ptr(this_ptr);
36980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36982         this_ptr_conv.is_owned = false;
36983         LDKPublicKey val_ref;
36984         CHECK(val->arr_len == 33);
36985         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36986         Record_set_peer_id(&this_ptr_conv, val_ref);
36987 }
36988
36989 uint64_t  __attribute__((export_name("TS_Record_get_channel_id"))) TS_Record_get_channel_id(uint64_t this_ptr) {
36990         LDKRecord this_ptr_conv;
36991         this_ptr_conv.inner = untag_ptr(this_ptr);
36992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36994         this_ptr_conv.is_owned = false;
36995         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
36996         uint64_t ret_ref = 0;
36997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36999         return ret_ref;
37000 }
37001
37002 void  __attribute__((export_name("TS_Record_set_channel_id"))) TS_Record_set_channel_id(uint64_t this_ptr, uint64_t val) {
37003         LDKRecord this_ptr_conv;
37004         this_ptr_conv.inner = untag_ptr(this_ptr);
37005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37007         this_ptr_conv.is_owned = false;
37008         LDKChannelId val_conv;
37009         val_conv.inner = untag_ptr(val);
37010         val_conv.is_owned = ptr_is_owned(val);
37011         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37012         val_conv = ChannelId_clone(&val_conv);
37013         Record_set_channel_id(&this_ptr_conv, val_conv);
37014 }
37015
37016 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
37017         LDKRecord this_ptr_conv;
37018         this_ptr_conv.inner = untag_ptr(this_ptr);
37019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37021         this_ptr_conv.is_owned = false;
37022         LDKStr ret_str = Record_get_args(&this_ptr_conv);
37023         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37024         Str_free(ret_str);
37025         return ret_conv;
37026 }
37027
37028 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
37029         LDKRecord this_ptr_conv;
37030         this_ptr_conv.inner = untag_ptr(this_ptr);
37031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37033         this_ptr_conv.is_owned = false;
37034         LDKStr val_conv = str_ref_to_owned_c(val);
37035         Record_set_args(&this_ptr_conv, val_conv);
37036 }
37037
37038 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
37039         LDKRecord this_ptr_conv;
37040         this_ptr_conv.inner = untag_ptr(this_ptr);
37041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37043         this_ptr_conv.is_owned = false;
37044         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
37045         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37046         Str_free(ret_str);
37047         return ret_conv;
37048 }
37049
37050 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
37051         LDKRecord this_ptr_conv;
37052         this_ptr_conv.inner = untag_ptr(this_ptr);
37053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37055         this_ptr_conv.is_owned = false;
37056         LDKStr val_conv = str_ref_to_owned_c(val);
37057         Record_set_module_path(&this_ptr_conv, val_conv);
37058 }
37059
37060 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
37061         LDKRecord this_ptr_conv;
37062         this_ptr_conv.inner = untag_ptr(this_ptr);
37063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37065         this_ptr_conv.is_owned = false;
37066         LDKStr ret_str = Record_get_file(&this_ptr_conv);
37067         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
37068         Str_free(ret_str);
37069         return ret_conv;
37070 }
37071
37072 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
37073         LDKRecord this_ptr_conv;
37074         this_ptr_conv.inner = untag_ptr(this_ptr);
37075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37077         this_ptr_conv.is_owned = false;
37078         LDKStr val_conv = str_ref_to_owned_c(val);
37079         Record_set_file(&this_ptr_conv, val_conv);
37080 }
37081
37082 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
37083         LDKRecord this_ptr_conv;
37084         this_ptr_conv.inner = untag_ptr(this_ptr);
37085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37087         this_ptr_conv.is_owned = false;
37088         int32_t ret_conv = Record_get_line(&this_ptr_conv);
37089         return ret_conv;
37090 }
37091
37092 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
37093         LDKRecord this_ptr_conv;
37094         this_ptr_conv.inner = untag_ptr(this_ptr);
37095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37097         this_ptr_conv.is_owned = false;
37098         Record_set_line(&this_ptr_conv, val);
37099 }
37100
37101 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) {
37102         LDKLevel level_arg_conv = LDKLevel_from_js(level_arg);
37103         LDKPublicKey peer_id_arg_ref;
37104         CHECK(peer_id_arg->arr_len == 33);
37105         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
37106         LDKChannelId channel_id_arg_conv;
37107         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
37108         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
37109         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
37110         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
37111         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
37112         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
37113         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
37114         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);
37115         uint64_t ret_ref = 0;
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37118         return ret_ref;
37119 }
37120
37121 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
37122         LDKRecord ret_var = Record_clone(arg);
37123         uint64_t ret_ref = 0;
37124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37126         return ret_ref;
37127 }
37128 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
37129         LDKRecord arg_conv;
37130         arg_conv.inner = untag_ptr(arg);
37131         arg_conv.is_owned = ptr_is_owned(arg);
37132         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37133         arg_conv.is_owned = false;
37134         int64_t ret_conv = Record_clone_ptr(&arg_conv);
37135         return ret_conv;
37136 }
37137
37138 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
37139         LDKRecord orig_conv;
37140         orig_conv.inner = untag_ptr(orig);
37141         orig_conv.is_owned = ptr_is_owned(orig);
37142         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37143         orig_conv.is_owned = false;
37144         LDKRecord ret_var = Record_clone(&orig_conv);
37145         uint64_t ret_ref = 0;
37146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37148         return ret_ref;
37149 }
37150
37151 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
37152         if (!ptr_is_owned(this_ptr)) return;
37153         void* this_ptr_ptr = untag_ptr(this_ptr);
37154         CHECK_ACCESS(this_ptr_ptr);
37155         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
37156         FREE(untag_ptr(this_ptr));
37157         Logger_free(this_ptr_conv);
37158 }
37159
37160 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
37161         LDKChannelHandshakeConfig this_obj_conv;
37162         this_obj_conv.inner = untag_ptr(this_obj);
37163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37165         ChannelHandshakeConfig_free(this_obj_conv);
37166 }
37167
37168 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
37169         LDKChannelHandshakeConfig 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         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
37175         return ret_conv;
37176 }
37177
37178 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
37179         LDKChannelHandshakeConfig this_ptr_conv;
37180         this_ptr_conv.inner = untag_ptr(this_ptr);
37181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37183         this_ptr_conv.is_owned = false;
37184         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
37185 }
37186
37187 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
37188         LDKChannelHandshakeConfig this_ptr_conv;
37189         this_ptr_conv.inner = untag_ptr(this_ptr);
37190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37192         this_ptr_conv.is_owned = false;
37193         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
37194         return ret_conv;
37195 }
37196
37197 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) {
37198         LDKChannelHandshakeConfig this_ptr_conv;
37199         this_ptr_conv.inner = untag_ptr(this_ptr);
37200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37202         this_ptr_conv.is_owned = false;
37203         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
37204 }
37205
37206 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
37207         LDKChannelHandshakeConfig this_ptr_conv;
37208         this_ptr_conv.inner = untag_ptr(this_ptr);
37209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37211         this_ptr_conv.is_owned = false;
37212         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
37213         return ret_conv;
37214 }
37215
37216 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) {
37217         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
37223 }
37224
37225 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) {
37226         LDKChannelHandshakeConfig this_ptr_conv;
37227         this_ptr_conv.inner = untag_ptr(this_ptr);
37228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37230         this_ptr_conv.is_owned = false;
37231         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
37232         return ret_conv;
37233 }
37234
37235 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) {
37236         LDKChannelHandshakeConfig this_ptr_conv;
37237         this_ptr_conv.inner = untag_ptr(this_ptr);
37238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37240         this_ptr_conv.is_owned = false;
37241         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
37242 }
37243
37244 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
37245         LDKChannelHandshakeConfig this_ptr_conv;
37246         this_ptr_conv.inner = untag_ptr(this_ptr);
37247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37249         this_ptr_conv.is_owned = false;
37250         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
37251         return ret_conv;
37252 }
37253
37254 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
37255         LDKChannelHandshakeConfig this_ptr_conv;
37256         this_ptr_conv.inner = untag_ptr(this_ptr);
37257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37259         this_ptr_conv.is_owned = false;
37260         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
37261 }
37262
37263 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
37264         LDKChannelHandshakeConfig this_ptr_conv;
37265         this_ptr_conv.inner = untag_ptr(this_ptr);
37266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37268         this_ptr_conv.is_owned = false;
37269         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
37270         return ret_conv;
37271 }
37272
37273 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
37274         LDKChannelHandshakeConfig this_ptr_conv;
37275         this_ptr_conv.inner = untag_ptr(this_ptr);
37276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37278         this_ptr_conv.is_owned = false;
37279         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
37280 }
37281
37282 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
37283         LDKChannelHandshakeConfig this_ptr_conv;
37284         this_ptr_conv.inner = untag_ptr(this_ptr);
37285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37287         this_ptr_conv.is_owned = false;
37288         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
37289         return ret_conv;
37290 }
37291
37292 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
37293         LDKChannelHandshakeConfig this_ptr_conv;
37294         this_ptr_conv.inner = untag_ptr(this_ptr);
37295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37297         this_ptr_conv.is_owned = false;
37298         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
37299 }
37300
37301 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) {
37302         LDKChannelHandshakeConfig this_ptr_conv;
37303         this_ptr_conv.inner = untag_ptr(this_ptr);
37304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37306         this_ptr_conv.is_owned = false;
37307         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
37308         return ret_conv;
37309 }
37310
37311 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) {
37312         LDKChannelHandshakeConfig this_ptr_conv;
37313         this_ptr_conv.inner = untag_ptr(this_ptr);
37314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37316         this_ptr_conv.is_owned = false;
37317         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
37318 }
37319
37320 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) {
37321         LDKChannelHandshakeConfig this_ptr_conv;
37322         this_ptr_conv.inner = untag_ptr(this_ptr);
37323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37325         this_ptr_conv.is_owned = false;
37326         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
37327         return ret_conv;
37328 }
37329
37330 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) {
37331         LDKChannelHandshakeConfig this_ptr_conv;
37332         this_ptr_conv.inner = untag_ptr(this_ptr);
37333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37335         this_ptr_conv.is_owned = false;
37336         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
37337 }
37338
37339 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
37340         LDKChannelHandshakeConfig this_ptr_conv;
37341         this_ptr_conv.inner = untag_ptr(this_ptr);
37342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37344         this_ptr_conv.is_owned = false;
37345         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
37346         return ret_conv;
37347 }
37348
37349 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) {
37350         LDKChannelHandshakeConfig 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         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
37356 }
37357
37358 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) {
37359         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);
37360         uint64_t ret_ref = 0;
37361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37363         return ret_ref;
37364 }
37365
37366 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
37367         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
37368         uint64_t ret_ref = 0;
37369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37371         return ret_ref;
37372 }
37373 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
37374         LDKChannelHandshakeConfig arg_conv;
37375         arg_conv.inner = untag_ptr(arg);
37376         arg_conv.is_owned = ptr_is_owned(arg);
37377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37378         arg_conv.is_owned = false;
37379         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
37380         return ret_conv;
37381 }
37382
37383 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
37384         LDKChannelHandshakeConfig orig_conv;
37385         orig_conv.inner = untag_ptr(orig);
37386         orig_conv.is_owned = ptr_is_owned(orig);
37387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37388         orig_conv.is_owned = false;
37389         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
37390         uint64_t ret_ref = 0;
37391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37393         return ret_ref;
37394 }
37395
37396 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
37397         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
37398         uint64_t ret_ref = 0;
37399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37401         return ret_ref;
37402 }
37403
37404 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
37405         LDKChannelHandshakeLimits this_obj_conv;
37406         this_obj_conv.inner = untag_ptr(this_obj);
37407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37409         ChannelHandshakeLimits_free(this_obj_conv);
37410 }
37411
37412 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
37413         LDKChannelHandshakeLimits this_ptr_conv;
37414         this_ptr_conv.inner = untag_ptr(this_ptr);
37415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37417         this_ptr_conv.is_owned = false;
37418         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
37419         return ret_conv;
37420 }
37421
37422 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
37423         LDKChannelHandshakeLimits this_ptr_conv;
37424         this_ptr_conv.inner = untag_ptr(this_ptr);
37425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37427         this_ptr_conv.is_owned = false;
37428         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
37429 }
37430
37431 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
37432         LDKChannelHandshakeLimits this_ptr_conv;
37433         this_ptr_conv.inner = untag_ptr(this_ptr);
37434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37436         this_ptr_conv.is_owned = false;
37437         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
37438         return ret_conv;
37439 }
37440
37441 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
37442         LDKChannelHandshakeLimits this_ptr_conv;
37443         this_ptr_conv.inner = untag_ptr(this_ptr);
37444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37446         this_ptr_conv.is_owned = false;
37447         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
37448 }
37449
37450 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
37451         LDKChannelHandshakeLimits this_ptr_conv;
37452         this_ptr_conv.inner = untag_ptr(this_ptr);
37453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37455         this_ptr_conv.is_owned = false;
37456         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
37457         return ret_conv;
37458 }
37459
37460 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) {
37461         LDKChannelHandshakeLimits this_ptr_conv;
37462         this_ptr_conv.inner = untag_ptr(this_ptr);
37463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37465         this_ptr_conv.is_owned = false;
37466         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
37467 }
37468
37469 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) {
37470         LDKChannelHandshakeLimits this_ptr_conv;
37471         this_ptr_conv.inner = untag_ptr(this_ptr);
37472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37474         this_ptr_conv.is_owned = false;
37475         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
37476         return ret_conv;
37477 }
37478
37479 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) {
37480         LDKChannelHandshakeLimits this_ptr_conv;
37481         this_ptr_conv.inner = untag_ptr(this_ptr);
37482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37484         this_ptr_conv.is_owned = false;
37485         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37486 }
37487
37488 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
37489         LDKChannelHandshakeLimits this_ptr_conv;
37490         this_ptr_conv.inner = untag_ptr(this_ptr);
37491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37493         this_ptr_conv.is_owned = false;
37494         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
37495         return ret_conv;
37496 }
37497
37498 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) {
37499         LDKChannelHandshakeLimits this_ptr_conv;
37500         this_ptr_conv.inner = untag_ptr(this_ptr);
37501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37503         this_ptr_conv.is_owned = false;
37504         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
37505 }
37506
37507 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
37508         LDKChannelHandshakeLimits this_ptr_conv;
37509         this_ptr_conv.inner = untag_ptr(this_ptr);
37510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37512         this_ptr_conv.is_owned = false;
37513         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
37514         return ret_conv;
37515 }
37516
37517 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) {
37518         LDKChannelHandshakeLimits this_ptr_conv;
37519         this_ptr_conv.inner = untag_ptr(this_ptr);
37520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37522         this_ptr_conv.is_owned = false;
37523         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
37524 }
37525
37526 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
37527         LDKChannelHandshakeLimits this_ptr_conv;
37528         this_ptr_conv.inner = untag_ptr(this_ptr);
37529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37531         this_ptr_conv.is_owned = false;
37532         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
37533         return ret_conv;
37534 }
37535
37536 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
37537         LDKChannelHandshakeLimits this_ptr_conv;
37538         this_ptr_conv.inner = untag_ptr(this_ptr);
37539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37541         this_ptr_conv.is_owned = false;
37542         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
37543 }
37544
37545 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
37546         LDKChannelHandshakeLimits this_ptr_conv;
37547         this_ptr_conv.inner = untag_ptr(this_ptr);
37548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37550         this_ptr_conv.is_owned = false;
37551         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
37552         return ret_conv;
37553 }
37554
37555 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
37556         LDKChannelHandshakeLimits this_ptr_conv;
37557         this_ptr_conv.inner = untag_ptr(this_ptr);
37558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37560         this_ptr_conv.is_owned = false;
37561         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
37562 }
37563
37564 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
37565         LDKChannelHandshakeLimits this_ptr_conv;
37566         this_ptr_conv.inner = untag_ptr(this_ptr);
37567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37569         this_ptr_conv.is_owned = false;
37570         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
37571         return ret_conv;
37572 }
37573
37574 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
37575         LDKChannelHandshakeLimits this_ptr_conv;
37576         this_ptr_conv.inner = untag_ptr(this_ptr);
37577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37579         this_ptr_conv.is_owned = false;
37580         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
37581 }
37582
37583 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
37584         LDKChannelHandshakeLimits this_ptr_conv;
37585         this_ptr_conv.inner = untag_ptr(this_ptr);
37586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37588         this_ptr_conv.is_owned = false;
37589         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
37590         return ret_conv;
37591 }
37592
37593 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) {
37594         LDKChannelHandshakeLimits this_ptr_conv;
37595         this_ptr_conv.inner = untag_ptr(this_ptr);
37596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37598         this_ptr_conv.is_owned = false;
37599         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
37600 }
37601
37602 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) {
37603         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);
37604         uint64_t ret_ref = 0;
37605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37607         return ret_ref;
37608 }
37609
37610 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
37611         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
37612         uint64_t ret_ref = 0;
37613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37615         return ret_ref;
37616 }
37617 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
37618         LDKChannelHandshakeLimits arg_conv;
37619         arg_conv.inner = untag_ptr(arg);
37620         arg_conv.is_owned = ptr_is_owned(arg);
37621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37622         arg_conv.is_owned = false;
37623         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
37624         return ret_conv;
37625 }
37626
37627 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
37628         LDKChannelHandshakeLimits orig_conv;
37629         orig_conv.inner = untag_ptr(orig);
37630         orig_conv.is_owned = ptr_is_owned(orig);
37631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37632         orig_conv.is_owned = false;
37633         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
37634         uint64_t ret_ref = 0;
37635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37637         return ret_ref;
37638 }
37639
37640 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
37641         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
37642         uint64_t ret_ref = 0;
37643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37645         return ret_ref;
37646 }
37647
37648 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
37649         if (!ptr_is_owned(this_ptr)) return;
37650         void* this_ptr_ptr = untag_ptr(this_ptr);
37651         CHECK_ACCESS(this_ptr_ptr);
37652         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
37653         FREE(untag_ptr(this_ptr));
37654         MaxDustHTLCExposure_free(this_ptr_conv);
37655 }
37656
37657 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
37658         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37659         *ret_copy = MaxDustHTLCExposure_clone(arg);
37660         uint64_t ret_ref = tag_ptr(ret_copy, true);
37661         return ret_ref;
37662 }
37663 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
37664         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
37665         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
37666         return ret_conv;
37667 }
37668
37669 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
37670         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
37671         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37672         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
37673         uint64_t ret_ref = tag_ptr(ret_copy, true);
37674         return ret_ref;
37675 }
37676
37677 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
37678         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37679         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
37680         uint64_t ret_ref = tag_ptr(ret_copy, true);
37681         return ret_ref;
37682 }
37683
37684 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
37685         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37686         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
37687         uint64_t ret_ref = tag_ptr(ret_copy, true);
37688         return ret_ref;
37689 }
37690
37691 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
37692         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
37693         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
37694         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
37695         return ret_conv;
37696 }
37697
37698 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
37699         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
37700         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
37701         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37702         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37703         CVec_u8Z_free(ret_var);
37704         return ret_arr;
37705 }
37706
37707 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
37708         LDKu8slice ser_ref;
37709         ser_ref.datalen = ser->arr_len;
37710         ser_ref.data = ser->elems;
37711         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
37712         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
37713         FREE(ser);
37714         return tag_ptr(ret_conv, true);
37715 }
37716
37717 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
37718         LDKChannelConfig this_obj_conv;
37719         this_obj_conv.inner = untag_ptr(this_obj);
37720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37722         ChannelConfig_free(this_obj_conv);
37723 }
37724
37725 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
37726         LDKChannelConfig this_ptr_conv;
37727         this_ptr_conv.inner = untag_ptr(this_ptr);
37728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37730         this_ptr_conv.is_owned = false;
37731         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37732         return ret_conv;
37733 }
37734
37735 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) {
37736         LDKChannelConfig this_ptr_conv;
37737         this_ptr_conv.inner = untag_ptr(this_ptr);
37738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37740         this_ptr_conv.is_owned = false;
37741         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
37742 }
37743
37744 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
37745         LDKChannelConfig this_ptr_conv;
37746         this_ptr_conv.inner = untag_ptr(this_ptr);
37747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37749         this_ptr_conv.is_owned = false;
37750         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
37751         return ret_conv;
37752 }
37753
37754 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) {
37755         LDKChannelConfig this_ptr_conv;
37756         this_ptr_conv.inner = untag_ptr(this_ptr);
37757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37759         this_ptr_conv.is_owned = false;
37760         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
37761 }
37762
37763 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
37764         LDKChannelConfig this_ptr_conv;
37765         this_ptr_conv.inner = untag_ptr(this_ptr);
37766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37768         this_ptr_conv.is_owned = false;
37769         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
37770         return ret_conv;
37771 }
37772
37773 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
37774         LDKChannelConfig this_ptr_conv;
37775         this_ptr_conv.inner = untag_ptr(this_ptr);
37776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37778         this_ptr_conv.is_owned = false;
37779         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
37780 }
37781
37782 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
37783         LDKChannelConfig this_ptr_conv;
37784         this_ptr_conv.inner = untag_ptr(this_ptr);
37785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37787         this_ptr_conv.is_owned = false;
37788         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37789         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
37790         uint64_t ret_ref = tag_ptr(ret_copy, true);
37791         return ret_ref;
37792 }
37793
37794 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) {
37795         LDKChannelConfig this_ptr_conv;
37796         this_ptr_conv.inner = untag_ptr(this_ptr);
37797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37799         this_ptr_conv.is_owned = false;
37800         void* val_ptr = untag_ptr(val);
37801         CHECK_ACCESS(val_ptr);
37802         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
37803         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
37804         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
37805 }
37806
37807 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) {
37808         LDKChannelConfig this_ptr_conv;
37809         this_ptr_conv.inner = untag_ptr(this_ptr);
37810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37812         this_ptr_conv.is_owned = false;
37813         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37814         return ret_conv;
37815 }
37816
37817 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) {
37818         LDKChannelConfig this_ptr_conv;
37819         this_ptr_conv.inner = untag_ptr(this_ptr);
37820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37822         this_ptr_conv.is_owned = false;
37823         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
37824 }
37825
37826 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
37827         LDKChannelConfig this_ptr_conv;
37828         this_ptr_conv.inner = untag_ptr(this_ptr);
37829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37831         this_ptr_conv.is_owned = false;
37832         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
37833         return ret_conv;
37834 }
37835
37836 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
37837         LDKChannelConfig this_ptr_conv;
37838         this_ptr_conv.inner = untag_ptr(this_ptr);
37839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37841         this_ptr_conv.is_owned = false;
37842         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
37843 }
37844
37845 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) {
37846         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
37847         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
37848         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
37849         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
37850         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);
37851         uint64_t ret_ref = 0;
37852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37854         return ret_ref;
37855 }
37856
37857 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
37858         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
37859         uint64_t ret_ref = 0;
37860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37862         return ret_ref;
37863 }
37864 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
37865         LDKChannelConfig arg_conv;
37866         arg_conv.inner = untag_ptr(arg);
37867         arg_conv.is_owned = ptr_is_owned(arg);
37868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37869         arg_conv.is_owned = false;
37870         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
37871         return ret_conv;
37872 }
37873
37874 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
37875         LDKChannelConfig orig_conv;
37876         orig_conv.inner = untag_ptr(orig);
37877         orig_conv.is_owned = ptr_is_owned(orig);
37878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37879         orig_conv.is_owned = false;
37880         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
37881         uint64_t ret_ref = 0;
37882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37884         return ret_ref;
37885 }
37886
37887 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
37888         LDKChannelConfig a_conv;
37889         a_conv.inner = untag_ptr(a);
37890         a_conv.is_owned = ptr_is_owned(a);
37891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37892         a_conv.is_owned = false;
37893         LDKChannelConfig b_conv;
37894         b_conv.inner = untag_ptr(b);
37895         b_conv.is_owned = ptr_is_owned(b);
37896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37897         b_conv.is_owned = false;
37898         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
37899         return ret_conv;
37900 }
37901
37902 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
37903         LDKChannelConfig this_arg_conv;
37904         this_arg_conv.inner = untag_ptr(this_arg);
37905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37907         this_arg_conv.is_owned = false;
37908         LDKChannelConfigUpdate update_conv;
37909         update_conv.inner = untag_ptr(update);
37910         update_conv.is_owned = ptr_is_owned(update);
37911         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
37912         update_conv.is_owned = false;
37913         ChannelConfig_apply(&this_arg_conv, &update_conv);
37914 }
37915
37916 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
37917         LDKChannelConfig ret_var = ChannelConfig_default();
37918         uint64_t ret_ref = 0;
37919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37921         return ret_ref;
37922 }
37923
37924 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
37925         LDKChannelConfig obj_conv;
37926         obj_conv.inner = untag_ptr(obj);
37927         obj_conv.is_owned = ptr_is_owned(obj);
37928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37929         obj_conv.is_owned = false;
37930         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
37931         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37932         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37933         CVec_u8Z_free(ret_var);
37934         return ret_arr;
37935 }
37936
37937 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
37938         LDKu8slice ser_ref;
37939         ser_ref.datalen = ser->arr_len;
37940         ser_ref.data = ser->elems;
37941         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
37942         *ret_conv = ChannelConfig_read(ser_ref);
37943         FREE(ser);
37944         return tag_ptr(ret_conv, true);
37945 }
37946
37947 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
37948         LDKChannelConfigUpdate this_obj_conv;
37949         this_obj_conv.inner = untag_ptr(this_obj);
37950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37952         ChannelConfigUpdate_free(this_obj_conv);
37953 }
37954
37955 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
37956         LDKChannelConfigUpdate this_ptr_conv;
37957         this_ptr_conv.inner = untag_ptr(this_ptr);
37958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37960         this_ptr_conv.is_owned = false;
37961         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37962         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37963         uint64_t ret_ref = tag_ptr(ret_copy, true);
37964         return ret_ref;
37965 }
37966
37967 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) {
37968         LDKChannelConfigUpdate this_ptr_conv;
37969         this_ptr_conv.inner = untag_ptr(this_ptr);
37970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37972         this_ptr_conv.is_owned = false;
37973         void* val_ptr = untag_ptr(val);
37974         CHECK_ACCESS(val_ptr);
37975         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37976         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37977         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
37978 }
37979
37980 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
37981         LDKChannelConfigUpdate this_ptr_conv;
37982         this_ptr_conv.inner = untag_ptr(this_ptr);
37983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37985         this_ptr_conv.is_owned = false;
37986         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37987         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
37988         uint64_t ret_ref = tag_ptr(ret_copy, true);
37989         return ret_ref;
37990 }
37991
37992 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) {
37993         LDKChannelConfigUpdate this_ptr_conv;
37994         this_ptr_conv.inner = untag_ptr(this_ptr);
37995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37997         this_ptr_conv.is_owned = false;
37998         void* val_ptr = untag_ptr(val);
37999         CHECK_ACCESS(val_ptr);
38000         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38001         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38002         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
38003 }
38004
38005 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
38006         LDKChannelConfigUpdate this_ptr_conv;
38007         this_ptr_conv.inner = untag_ptr(this_ptr);
38008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38010         this_ptr_conv.is_owned = false;
38011         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
38012         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
38013         uint64_t ret_ref = tag_ptr(ret_copy, true);
38014         return ret_ref;
38015 }
38016
38017 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
38018         LDKChannelConfigUpdate this_ptr_conv;
38019         this_ptr_conv.inner = untag_ptr(this_ptr);
38020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38022         this_ptr_conv.is_owned = false;
38023         void* val_ptr = untag_ptr(val);
38024         CHECK_ACCESS(val_ptr);
38025         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
38026         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
38027         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
38028 }
38029
38030 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) {
38031         LDKChannelConfigUpdate this_ptr_conv;
38032         this_ptr_conv.inner = untag_ptr(this_ptr);
38033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38035         this_ptr_conv.is_owned = false;
38036         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
38037         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
38038         uint64_t ret_ref = tag_ptr(ret_copy, true);
38039         return ret_ref;
38040 }
38041
38042 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) {
38043         LDKChannelConfigUpdate this_ptr_conv;
38044         this_ptr_conv.inner = untag_ptr(this_ptr);
38045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38047         this_ptr_conv.is_owned = false;
38048         void* val_ptr = untag_ptr(val);
38049         CHECK_ACCESS(val_ptr);
38050         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
38051         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
38052         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
38053 }
38054
38055 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) {
38056         LDKChannelConfigUpdate this_ptr_conv;
38057         this_ptr_conv.inner = untag_ptr(this_ptr);
38058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38060         this_ptr_conv.is_owned = false;
38061         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38062         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
38063         uint64_t ret_ref = tag_ptr(ret_copy, true);
38064         return ret_ref;
38065 }
38066
38067 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) {
38068         LDKChannelConfigUpdate this_ptr_conv;
38069         this_ptr_conv.inner = untag_ptr(this_ptr);
38070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38072         this_ptr_conv.is_owned = false;
38073         void* val_ptr = untag_ptr(val);
38074         CHECK_ACCESS(val_ptr);
38075         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38076         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38077         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
38078 }
38079
38080 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) {
38081         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
38082         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
38083         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
38084         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
38085         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
38086         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
38087         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
38088         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
38089         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
38090         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
38091         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
38092         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
38093         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
38094         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
38095         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
38096         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
38097         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
38098         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
38099         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
38100         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
38101         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);
38102         uint64_t ret_ref = 0;
38103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38105         return ret_ref;
38106 }
38107
38108 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
38109         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
38110         uint64_t ret_ref = 0;
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38113         return ret_ref;
38114 }
38115
38116 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
38117         LDKUserConfig this_obj_conv;
38118         this_obj_conv.inner = untag_ptr(this_obj);
38119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38121         UserConfig_free(this_obj_conv);
38122 }
38123
38124 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
38125         LDKUserConfig this_ptr_conv;
38126         this_ptr_conv.inner = untag_ptr(this_ptr);
38127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38129         this_ptr_conv.is_owned = false;
38130         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
38131         uint64_t ret_ref = 0;
38132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38134         return ret_ref;
38135 }
38136
38137 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
38138         LDKUserConfig this_ptr_conv;
38139         this_ptr_conv.inner = untag_ptr(this_ptr);
38140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38142         this_ptr_conv.is_owned = false;
38143         LDKChannelHandshakeConfig val_conv;
38144         val_conv.inner = untag_ptr(val);
38145         val_conv.is_owned = ptr_is_owned(val);
38146         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38147         val_conv = ChannelHandshakeConfig_clone(&val_conv);
38148         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
38149 }
38150
38151 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
38152         LDKUserConfig this_ptr_conv;
38153         this_ptr_conv.inner = untag_ptr(this_ptr);
38154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38156         this_ptr_conv.is_owned = false;
38157         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
38158         uint64_t ret_ref = 0;
38159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38161         return ret_ref;
38162 }
38163
38164 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
38165         LDKUserConfig this_ptr_conv;
38166         this_ptr_conv.inner = untag_ptr(this_ptr);
38167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38169         this_ptr_conv.is_owned = false;
38170         LDKChannelHandshakeLimits val_conv;
38171         val_conv.inner = untag_ptr(val);
38172         val_conv.is_owned = ptr_is_owned(val);
38173         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38174         val_conv = ChannelHandshakeLimits_clone(&val_conv);
38175         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
38176 }
38177
38178 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
38179         LDKUserConfig this_ptr_conv;
38180         this_ptr_conv.inner = untag_ptr(this_ptr);
38181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38183         this_ptr_conv.is_owned = false;
38184         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
38185         uint64_t ret_ref = 0;
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38188         return ret_ref;
38189 }
38190
38191 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
38192         LDKUserConfig this_ptr_conv;
38193         this_ptr_conv.inner = untag_ptr(this_ptr);
38194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38196         this_ptr_conv.is_owned = false;
38197         LDKChannelConfig val_conv;
38198         val_conv.inner = untag_ptr(val);
38199         val_conv.is_owned = ptr_is_owned(val);
38200         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38201         val_conv = ChannelConfig_clone(&val_conv);
38202         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
38203 }
38204
38205 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
38206         LDKUserConfig this_ptr_conv;
38207         this_ptr_conv.inner = untag_ptr(this_ptr);
38208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38210         this_ptr_conv.is_owned = false;
38211         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
38212         return ret_conv;
38213 }
38214
38215 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) {
38216         LDKUserConfig this_ptr_conv;
38217         this_ptr_conv.inner = untag_ptr(this_ptr);
38218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38220         this_ptr_conv.is_owned = false;
38221         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
38222 }
38223
38224 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
38225         LDKUserConfig this_ptr_conv;
38226         this_ptr_conv.inner = untag_ptr(this_ptr);
38227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38229         this_ptr_conv.is_owned = false;
38230         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
38231         return ret_conv;
38232 }
38233
38234 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
38235         LDKUserConfig this_ptr_conv;
38236         this_ptr_conv.inner = untag_ptr(this_ptr);
38237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38239         this_ptr_conv.is_owned = false;
38240         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
38241 }
38242
38243 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
38244         LDKUserConfig this_ptr_conv;
38245         this_ptr_conv.inner = untag_ptr(this_ptr);
38246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38248         this_ptr_conv.is_owned = false;
38249         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
38250         return ret_conv;
38251 }
38252
38253 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
38254         LDKUserConfig this_ptr_conv;
38255         this_ptr_conv.inner = untag_ptr(this_ptr);
38256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38258         this_ptr_conv.is_owned = false;
38259         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
38260 }
38261
38262 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
38263         LDKUserConfig this_ptr_conv;
38264         this_ptr_conv.inner = untag_ptr(this_ptr);
38265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38267         this_ptr_conv.is_owned = false;
38268         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
38269         return ret_conv;
38270 }
38271
38272 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
38273         LDKUserConfig this_ptr_conv;
38274         this_ptr_conv.inner = untag_ptr(this_ptr);
38275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38277         this_ptr_conv.is_owned = false;
38278         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
38279 }
38280
38281 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
38282         LDKUserConfig this_ptr_conv;
38283         this_ptr_conv.inner = untag_ptr(this_ptr);
38284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38286         this_ptr_conv.is_owned = false;
38287         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
38288         return ret_conv;
38289 }
38290
38291 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
38292         LDKUserConfig this_ptr_conv;
38293         this_ptr_conv.inner = untag_ptr(this_ptr);
38294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38296         this_ptr_conv.is_owned = false;
38297         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
38298 }
38299
38300 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) {
38301         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
38302         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
38303         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
38304         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
38305         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
38306         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
38307         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
38308         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
38309         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
38310         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
38311         LDKChannelConfig channel_config_arg_conv;
38312         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
38313         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
38315         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
38316         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);
38317         uint64_t ret_ref = 0;
38318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38320         return ret_ref;
38321 }
38322
38323 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
38324         LDKUserConfig ret_var = UserConfig_clone(arg);
38325         uint64_t ret_ref = 0;
38326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38328         return ret_ref;
38329 }
38330 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
38331         LDKUserConfig arg_conv;
38332         arg_conv.inner = untag_ptr(arg);
38333         arg_conv.is_owned = ptr_is_owned(arg);
38334         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38335         arg_conv.is_owned = false;
38336         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
38337         return ret_conv;
38338 }
38339
38340 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
38341         LDKUserConfig orig_conv;
38342         orig_conv.inner = untag_ptr(orig);
38343         orig_conv.is_owned = ptr_is_owned(orig);
38344         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38345         orig_conv.is_owned = false;
38346         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
38347         uint64_t ret_ref = 0;
38348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38350         return ret_ref;
38351 }
38352
38353 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
38354         LDKUserConfig ret_var = UserConfig_default();
38355         uint64_t ret_ref = 0;
38356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38358         return ret_ref;
38359 }
38360
38361 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
38362         LDKBestBlock this_obj_conv;
38363         this_obj_conv.inner = untag_ptr(this_obj);
38364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38366         BestBlock_free(this_obj_conv);
38367 }
38368
38369 int8_tArray  __attribute__((export_name("TS_BestBlock_get_block_hash"))) TS_BestBlock_get_block_hash(uint64_t this_ptr) {
38370         LDKBestBlock this_ptr_conv;
38371         this_ptr_conv.inner = untag_ptr(this_ptr);
38372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38374         this_ptr_conv.is_owned = false;
38375         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38376         memcpy(ret_arr->elems, *BestBlock_get_block_hash(&this_ptr_conv), 32);
38377         return ret_arr;
38378 }
38379
38380 void  __attribute__((export_name("TS_BestBlock_set_block_hash"))) TS_BestBlock_set_block_hash(uint64_t this_ptr, int8_tArray val) {
38381         LDKBestBlock this_ptr_conv;
38382         this_ptr_conv.inner = untag_ptr(this_ptr);
38383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38385         this_ptr_conv.is_owned = false;
38386         LDKThirtyTwoBytes val_ref;
38387         CHECK(val->arr_len == 32);
38388         memcpy(val_ref.data, val->elems, 32); FREE(val);
38389         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
38390 }
38391
38392 int32_t  __attribute__((export_name("TS_BestBlock_get_height"))) TS_BestBlock_get_height(uint64_t this_ptr) {
38393         LDKBestBlock this_ptr_conv;
38394         this_ptr_conv.inner = untag_ptr(this_ptr);
38395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38397         this_ptr_conv.is_owned = false;
38398         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
38399         return ret_conv;
38400 }
38401
38402 void  __attribute__((export_name("TS_BestBlock_set_height"))) TS_BestBlock_set_height(uint64_t this_ptr, int32_t val) {
38403         LDKBestBlock this_ptr_conv;
38404         this_ptr_conv.inner = untag_ptr(this_ptr);
38405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38407         this_ptr_conv.is_owned = false;
38408         BestBlock_set_height(&this_ptr_conv, val);
38409 }
38410
38411 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash_arg, int32_t height_arg) {
38412         LDKThirtyTwoBytes block_hash_arg_ref;
38413         CHECK(block_hash_arg->arr_len == 32);
38414         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
38415         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
38416         uint64_t ret_ref = 0;
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38419         return ret_ref;
38420 }
38421
38422 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
38423         LDKBestBlock ret_var = BestBlock_clone(arg);
38424         uint64_t ret_ref = 0;
38425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38427         return ret_ref;
38428 }
38429 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
38430         LDKBestBlock arg_conv;
38431         arg_conv.inner = untag_ptr(arg);
38432         arg_conv.is_owned = ptr_is_owned(arg);
38433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38434         arg_conv.is_owned = false;
38435         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
38436         return ret_conv;
38437 }
38438
38439 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
38440         LDKBestBlock orig_conv;
38441         orig_conv.inner = untag_ptr(orig);
38442         orig_conv.is_owned = ptr_is_owned(orig);
38443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38444         orig_conv.is_owned = false;
38445         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
38446         uint64_t ret_ref = 0;
38447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38449         return ret_ref;
38450 }
38451
38452 int64_t  __attribute__((export_name("TS_BestBlock_hash"))) TS_BestBlock_hash(uint64_t o) {
38453         LDKBestBlock o_conv;
38454         o_conv.inner = untag_ptr(o);
38455         o_conv.is_owned = ptr_is_owned(o);
38456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38457         o_conv.is_owned = false;
38458         int64_t ret_conv = BestBlock_hash(&o_conv);
38459         return ret_conv;
38460 }
38461
38462 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
38463         LDKBestBlock a_conv;
38464         a_conv.inner = untag_ptr(a);
38465         a_conv.is_owned = ptr_is_owned(a);
38466         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38467         a_conv.is_owned = false;
38468         LDKBestBlock b_conv;
38469         b_conv.inner = untag_ptr(b);
38470         b_conv.is_owned = ptr_is_owned(b);
38471         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38472         b_conv.is_owned = false;
38473         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
38474         return ret_conv;
38475 }
38476
38477 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
38478         LDKNetwork network_conv = LDKNetwork_from_js(network);
38479         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
38480         uint64_t ret_ref = 0;
38481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38483         return ret_ref;
38484 }
38485
38486 int8_tArray  __attribute__((export_name("TS_BestBlock_write"))) TS_BestBlock_write(uint64_t obj) {
38487         LDKBestBlock obj_conv;
38488         obj_conv.inner = untag_ptr(obj);
38489         obj_conv.is_owned = ptr_is_owned(obj);
38490         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38491         obj_conv.is_owned = false;
38492         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
38493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38495         CVec_u8Z_free(ret_var);
38496         return ret_arr;
38497 }
38498
38499 uint64_t  __attribute__((export_name("TS_BestBlock_read"))) TS_BestBlock_read(int8_tArray ser) {
38500         LDKu8slice ser_ref;
38501         ser_ref.datalen = ser->arr_len;
38502         ser_ref.data = ser->elems;
38503         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
38504         *ret_conv = BestBlock_read(ser_ref);
38505         FREE(ser);
38506         return tag_ptr(ret_conv, true);
38507 }
38508
38509 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
38510         if (!ptr_is_owned(this_ptr)) return;
38511         void* this_ptr_ptr = untag_ptr(this_ptr);
38512         CHECK_ACCESS(this_ptr_ptr);
38513         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
38514         FREE(untag_ptr(this_ptr));
38515         Listen_free(this_ptr_conv);
38516 }
38517
38518 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
38519         if (!ptr_is_owned(this_ptr)) return;
38520         void* this_ptr_ptr = untag_ptr(this_ptr);
38521         CHECK_ACCESS(this_ptr_ptr);
38522         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
38523         FREE(untag_ptr(this_ptr));
38524         Confirm_free(this_ptr_conv);
38525 }
38526
38527 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
38528         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
38529         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
38530         return ret_conv;
38531 }
38532
38533 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
38534         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
38535         return ret_conv;
38536 }
38537
38538 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
38539         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
38540         return ret_conv;
38541 }
38542
38543 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_unrecoverable_error"))) TS_ChannelMonitorUpdateStatus_unrecoverable_error() {
38544         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_unrecoverable_error());
38545         return ret_conv;
38546 }
38547
38548 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
38549         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
38550         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
38551         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
38552         return ret_conv;
38553 }
38554
38555 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
38556         if (!ptr_is_owned(this_ptr)) return;
38557         void* this_ptr_ptr = untag_ptr(this_ptr);
38558         CHECK_ACCESS(this_ptr_ptr);
38559         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
38560         FREE(untag_ptr(this_ptr));
38561         Watch_free(this_ptr_conv);
38562 }
38563
38564 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
38565         if (!ptr_is_owned(this_ptr)) return;
38566         void* this_ptr_ptr = untag_ptr(this_ptr);
38567         CHECK_ACCESS(this_ptr_ptr);
38568         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
38569         FREE(untag_ptr(this_ptr));
38570         Filter_free(this_ptr_conv);
38571 }
38572
38573 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
38574         LDKWatchedOutput this_obj_conv;
38575         this_obj_conv.inner = untag_ptr(this_obj);
38576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38578         WatchedOutput_free(this_obj_conv);
38579 }
38580
38581 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
38582         LDKWatchedOutput this_ptr_conv;
38583         this_ptr_conv.inner = untag_ptr(this_ptr);
38584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38586         this_ptr_conv.is_owned = false;
38587         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38588         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
38589         uint64_t ret_ref = tag_ptr(ret_copy, true);
38590         return ret_ref;
38591 }
38592
38593 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
38594         LDKWatchedOutput this_ptr_conv;
38595         this_ptr_conv.inner = untag_ptr(this_ptr);
38596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38598         this_ptr_conv.is_owned = false;
38599         void* val_ptr = untag_ptr(val);
38600         CHECK_ACCESS(val_ptr);
38601         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38602         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38603         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
38604 }
38605
38606 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
38607         LDKWatchedOutput this_ptr_conv;
38608         this_ptr_conv.inner = untag_ptr(this_ptr);
38609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38611         this_ptr_conv.is_owned = false;
38612         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
38613         uint64_t ret_ref = 0;
38614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38616         return ret_ref;
38617 }
38618
38619 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
38620         LDKWatchedOutput this_ptr_conv;
38621         this_ptr_conv.inner = untag_ptr(this_ptr);
38622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38624         this_ptr_conv.is_owned = false;
38625         LDKOutPoint val_conv;
38626         val_conv.inner = untag_ptr(val);
38627         val_conv.is_owned = ptr_is_owned(val);
38628         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38629         val_conv = OutPoint_clone(&val_conv);
38630         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
38631 }
38632
38633 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
38634         LDKWatchedOutput this_ptr_conv;
38635         this_ptr_conv.inner = untag_ptr(this_ptr);
38636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38638         this_ptr_conv.is_owned = false;
38639         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
38640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38642         CVec_u8Z_free(ret_var);
38643         return ret_arr;
38644 }
38645
38646 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
38647         LDKWatchedOutput this_ptr_conv;
38648         this_ptr_conv.inner = untag_ptr(this_ptr);
38649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38651         this_ptr_conv.is_owned = false;
38652         LDKCVec_u8Z val_ref;
38653         val_ref.datalen = val->arr_len;
38654         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38655         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38656         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
38657 }
38658
38659 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) {
38660         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
38661         CHECK_ACCESS(block_hash_arg_ptr);
38662         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
38663         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
38664         LDKOutPoint outpoint_arg_conv;
38665         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
38666         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
38667         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
38668         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
38669         LDKCVec_u8Z script_pubkey_arg_ref;
38670         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
38671         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38672         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
38673         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
38674         uint64_t ret_ref = 0;
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38677         return ret_ref;
38678 }
38679
38680 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
38681         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
38682         uint64_t ret_ref = 0;
38683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38685         return ret_ref;
38686 }
38687 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
38688         LDKWatchedOutput arg_conv;
38689         arg_conv.inner = untag_ptr(arg);
38690         arg_conv.is_owned = ptr_is_owned(arg);
38691         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38692         arg_conv.is_owned = false;
38693         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
38694         return ret_conv;
38695 }
38696
38697 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
38698         LDKWatchedOutput orig_conv;
38699         orig_conv.inner = untag_ptr(orig);
38700         orig_conv.is_owned = ptr_is_owned(orig);
38701         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38702         orig_conv.is_owned = false;
38703         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
38704         uint64_t ret_ref = 0;
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38707         return ret_ref;
38708 }
38709
38710 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
38711         LDKWatchedOutput a_conv;
38712         a_conv.inner = untag_ptr(a);
38713         a_conv.is_owned = ptr_is_owned(a);
38714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38715         a_conv.is_owned = false;
38716         LDKWatchedOutput b_conv;
38717         b_conv.inner = untag_ptr(b);
38718         b_conv.is_owned = ptr_is_owned(b);
38719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38720         b_conv.is_owned = false;
38721         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
38722         return ret_conv;
38723 }
38724
38725 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
38726         LDKWatchedOutput o_conv;
38727         o_conv.inner = untag_ptr(o);
38728         o_conv.is_owned = ptr_is_owned(o);
38729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38730         o_conv.is_owned = false;
38731         int64_t ret_conv = WatchedOutput_hash(&o_conv);
38732         return ret_conv;
38733 }
38734
38735 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
38736         if (!ptr_is_owned(this_ptr)) return;
38737         void* this_ptr_ptr = untag_ptr(this_ptr);
38738         CHECK_ACCESS(this_ptr_ptr);
38739         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
38740         FREE(untag_ptr(this_ptr));
38741         BroadcasterInterface_free(this_ptr_conv);
38742 }
38743
38744 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
38745         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
38746         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
38747         return ret_conv;
38748 }
38749
38750 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_on_chain_sweep"))) TS_ConfirmationTarget_on_chain_sweep() {
38751         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_on_chain_sweep());
38752         return ret_conv;
38753 }
38754
38755 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
38756         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
38757         return ret_conv;
38758 }
38759
38760 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee"))) TS_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
38761         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
38762         return ret_conv;
38763 }
38764
38765 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_anchor_channel_fee"))) TS_ConfirmationTarget_anchor_channel_fee() {
38766         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_anchor_channel_fee());
38767         return ret_conv;
38768 }
38769
38770 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_non_anchor_channel_fee"))) TS_ConfirmationTarget_non_anchor_channel_fee() {
38771         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_non_anchor_channel_fee());
38772         return ret_conv;
38773 }
38774
38775 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_channel_close_minimum"))) TS_ConfirmationTarget_channel_close_minimum() {
38776         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_channel_close_minimum());
38777         return ret_conv;
38778 }
38779
38780 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_output_spending_fee"))) TS_ConfirmationTarget_output_spending_fee() {
38781         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_output_spending_fee());
38782         return ret_conv;
38783 }
38784
38785 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
38786         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
38787         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
38788         return ret_conv;
38789 }
38790
38791 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
38792         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
38793         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
38794         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
38795         return ret_conv;
38796 }
38797
38798 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
38799         if (!ptr_is_owned(this_ptr)) return;
38800         void* this_ptr_ptr = untag_ptr(this_ptr);
38801         CHECK_ACCESS(this_ptr_ptr);
38802         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
38803         FREE(untag_ptr(this_ptr));
38804         FeeEstimator_free(this_ptr_conv);
38805 }
38806
38807 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
38808         LDKMonitorUpdateId this_obj_conv;
38809         this_obj_conv.inner = untag_ptr(this_obj);
38810         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38812         MonitorUpdateId_free(this_obj_conv);
38813 }
38814
38815 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
38816         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
38817         uint64_t ret_ref = 0;
38818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38820         return ret_ref;
38821 }
38822 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
38823         LDKMonitorUpdateId arg_conv;
38824         arg_conv.inner = untag_ptr(arg);
38825         arg_conv.is_owned = ptr_is_owned(arg);
38826         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38827         arg_conv.is_owned = false;
38828         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
38829         return ret_conv;
38830 }
38831
38832 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
38833         LDKMonitorUpdateId orig_conv;
38834         orig_conv.inner = untag_ptr(orig);
38835         orig_conv.is_owned = ptr_is_owned(orig);
38836         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38837         orig_conv.is_owned = false;
38838         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
38839         uint64_t ret_ref = 0;
38840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38842         return ret_ref;
38843 }
38844
38845 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
38846         LDKMonitorUpdateId o_conv;
38847         o_conv.inner = untag_ptr(o);
38848         o_conv.is_owned = ptr_is_owned(o);
38849         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38850         o_conv.is_owned = false;
38851         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
38852         return ret_conv;
38853 }
38854
38855 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
38856         LDKMonitorUpdateId a_conv;
38857         a_conv.inner = untag_ptr(a);
38858         a_conv.is_owned = ptr_is_owned(a);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38860         a_conv.is_owned = false;
38861         LDKMonitorUpdateId b_conv;
38862         b_conv.inner = untag_ptr(b);
38863         b_conv.is_owned = ptr_is_owned(b);
38864         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38865         b_conv.is_owned = false;
38866         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
38867         return ret_conv;
38868 }
38869
38870 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
38871         if (!ptr_is_owned(this_ptr)) return;
38872         void* this_ptr_ptr = untag_ptr(this_ptr);
38873         CHECK_ACCESS(this_ptr_ptr);
38874         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
38875         FREE(untag_ptr(this_ptr));
38876         Persist_free(this_ptr_conv);
38877 }
38878
38879 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
38880         LDKLockedChannelMonitor this_obj_conv;
38881         this_obj_conv.inner = untag_ptr(this_obj);
38882         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38884         LockedChannelMonitor_free(this_obj_conv);
38885 }
38886
38887 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
38888         LDKChainMonitor this_obj_conv;
38889         this_obj_conv.inner = untag_ptr(this_obj);
38890         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38892         ChainMonitor_free(this_obj_conv);
38893 }
38894
38895 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) {
38896         void* chain_source_ptr = untag_ptr(chain_source);
38897         CHECK_ACCESS(chain_source_ptr);
38898         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
38899         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
38900         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
38901                 // Manually implement clone for Java trait instances
38902                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
38903                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38904                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
38905                 }
38906         }
38907         void* broadcaster_ptr = untag_ptr(broadcaster);
38908         CHECK_ACCESS(broadcaster_ptr);
38909         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38910         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38911                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38912                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38913         }
38914         void* logger_ptr = untag_ptr(logger);
38915         CHECK_ACCESS(logger_ptr);
38916         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38917         if (logger_conv.free == LDKLogger_JCalls_free) {
38918                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38919                 LDKLogger_JCalls_cloned(&logger_conv);
38920         }
38921         void* feeest_ptr = untag_ptr(feeest);
38922         CHECK_ACCESS(feeest_ptr);
38923         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
38924         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
38925                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38926                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
38927         }
38928         void* persister_ptr = untag_ptr(persister);
38929         CHECK_ACCESS(persister_ptr);
38930         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
38931         if (persister_conv.free == LDKPersist_JCalls_free) {
38932                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38933                 LDKPersist_JCalls_cloned(&persister_conv);
38934         }
38935         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
38936         uint64_t ret_ref = 0;
38937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38939         return ret_ref;
38940 }
38941
38942 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
38943         LDKChainMonitor 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         LDKCVec_ChannelDetailsZ ignored_channels_constr;
38949         ignored_channels_constr.datalen = ignored_channels->arr_len;
38950         if (ignored_channels_constr.datalen > 0)
38951                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38952         else
38953                 ignored_channels_constr.data = NULL;
38954         uint64_t* ignored_channels_vals = ignored_channels->elems;
38955         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
38956                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
38957                 LDKChannelDetails ignored_channels_conv_16_conv;
38958                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
38959                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
38960                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
38961                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
38962                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
38963         }
38964         FREE(ignored_channels);
38965         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
38966         uint64_tArray ret_arr = NULL;
38967         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
38968         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
38969         for (size_t j = 0; j < ret_var.datalen; j++) {
38970                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38971                 *ret_conv_9_copy = ret_var.data[j];
38972                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38973                 ret_arr_ptr[j] = ret_conv_9_ref;
38974         }
38975         
38976         FREE(ret_var.data);
38977         return ret_arr;
38978 }
38979
38980 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
38981         LDKChainMonitor this_arg_conv;
38982         this_arg_conv.inner = untag_ptr(this_arg);
38983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38985         this_arg_conv.is_owned = false;
38986         LDKOutPoint funding_txo_conv;
38987         funding_txo_conv.inner = untag_ptr(funding_txo);
38988         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38989         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38990         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38991         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
38992         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
38993         return tag_ptr(ret_conv, true);
38994 }
38995
38996 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
38997         LDKChainMonitor this_arg_conv;
38998         this_arg_conv.inner = untag_ptr(this_arg);
38999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39001         this_arg_conv.is_owned = false;
39002         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
39003         uint64_tArray ret_arr = NULL;
39004         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39005         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39006         for (size_t d = 0; d < ret_var.datalen; d++) {
39007                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
39008                 *ret_conv_29_conv = ret_var.data[d];
39009                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
39010         }
39011         
39012         FREE(ret_var.data);
39013         return ret_arr;
39014 }
39015
39016 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
39017         LDKChainMonitor this_arg_conv;
39018         this_arg_conv.inner = untag_ptr(this_arg);
39019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39021         this_arg_conv.is_owned = false;
39022         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
39023         uint64_tArray ret_arr = NULL;
39024         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39025         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39026         for (size_t p = 0; p < ret_var.datalen; p++) {
39027                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
39028                 *ret_conv_41_conv = ret_var.data[p];
39029                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
39030         }
39031         
39032         FREE(ret_var.data);
39033         return ret_arr;
39034 }
39035
39036 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) {
39037         LDKChainMonitor this_arg_conv;
39038         this_arg_conv.inner = untag_ptr(this_arg);
39039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39041         this_arg_conv.is_owned = false;
39042         LDKOutPoint funding_txo_conv;
39043         funding_txo_conv.inner = untag_ptr(funding_txo);
39044         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
39045         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
39046         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
39047         LDKMonitorUpdateId completed_update_id_conv;
39048         completed_update_id_conv.inner = untag_ptr(completed_update_id);
39049         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
39051         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
39052         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39053         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
39054         return tag_ptr(ret_conv, true);
39055 }
39056
39057 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
39058         LDKChainMonitor this_arg_conv;
39059         this_arg_conv.inner = untag_ptr(this_arg);
39060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39062         this_arg_conv.is_owned = false;
39063         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
39064         uint64_t ret_ref = 0;
39065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39067         return ret_ref;
39068 }
39069
39070 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
39071         LDKChainMonitor this_arg_conv;
39072         this_arg_conv.inner = untag_ptr(this_arg);
39073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39075         this_arg_conv.is_owned = false;
39076         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
39077 }
39078
39079 void  __attribute__((export_name("TS_ChainMonitor_signer_unblocked"))) TS_ChainMonitor_signer_unblocked(uint64_t this_arg, uint64_t monitor_opt) {
39080         LDKChainMonitor this_arg_conv;
39081         this_arg_conv.inner = untag_ptr(this_arg);
39082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39084         this_arg_conv.is_owned = false;
39085         LDKOutPoint monitor_opt_conv;
39086         monitor_opt_conv.inner = untag_ptr(monitor_opt);
39087         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
39088         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
39089         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
39090         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
39091 }
39092
39093 void  __attribute__((export_name("TS_ChainMonitor_archive_fully_resolved_channel_monitors"))) TS_ChainMonitor_archive_fully_resolved_channel_monitors(uint64_t this_arg) {
39094         LDKChainMonitor this_arg_conv;
39095         this_arg_conv.inner = untag_ptr(this_arg);
39096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39098         this_arg_conv.is_owned = false;
39099         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
39100 }
39101
39102 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
39103         LDKChainMonitor this_arg_conv;
39104         this_arg_conv.inner = untag_ptr(this_arg);
39105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39107         this_arg_conv.is_owned = false;
39108         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
39109         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
39110         return tag_ptr(ret_ret, true);
39111 }
39112
39113 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
39114         LDKChainMonitor this_arg_conv;
39115         this_arg_conv.inner = untag_ptr(this_arg);
39116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39118         this_arg_conv.is_owned = false;
39119         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
39120         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
39121         return tag_ptr(ret_ret, true);
39122 }
39123
39124 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
39125         LDKChainMonitor this_arg_conv;
39126         this_arg_conv.inner = untag_ptr(this_arg);
39127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39129         this_arg_conv.is_owned = false;
39130         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
39131         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
39132         return tag_ptr(ret_ret, true);
39133 }
39134
39135 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
39136         LDKChainMonitor this_arg_conv;
39137         this_arg_conv.inner = untag_ptr(this_arg);
39138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39140         this_arg_conv.is_owned = false;
39141         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
39142         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
39143         return tag_ptr(ret_ret, true);
39144 }
39145
39146 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
39147         LDKChannelMonitorUpdate this_obj_conv;
39148         this_obj_conv.inner = untag_ptr(this_obj);
39149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39151         ChannelMonitorUpdate_free(this_obj_conv);
39152 }
39153
39154 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
39155         LDKChannelMonitorUpdate this_ptr_conv;
39156         this_ptr_conv.inner = untag_ptr(this_ptr);
39157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39159         this_ptr_conv.is_owned = false;
39160         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
39161         return ret_conv;
39162 }
39163
39164 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
39165         LDKChannelMonitorUpdate this_ptr_conv;
39166         this_ptr_conv.inner = untag_ptr(this_ptr);
39167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39169         this_ptr_conv.is_owned = false;
39170         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
39171 }
39172
39173 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_channel_id"))) TS_ChannelMonitorUpdate_get_channel_id(uint64_t this_ptr) {
39174         LDKChannelMonitorUpdate this_ptr_conv;
39175         this_ptr_conv.inner = untag_ptr(this_ptr);
39176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39178         this_ptr_conv.is_owned = false;
39179         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
39180         uint64_t ret_ref = 0;
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39183         return ret_ref;
39184 }
39185
39186 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_channel_id"))) TS_ChannelMonitorUpdate_set_channel_id(uint64_t this_ptr, uint64_t val) {
39187         LDKChannelMonitorUpdate this_ptr_conv;
39188         this_ptr_conv.inner = untag_ptr(this_ptr);
39189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39191         this_ptr_conv.is_owned = false;
39192         LDKChannelId val_conv;
39193         val_conv.inner = untag_ptr(val);
39194         val_conv.is_owned = ptr_is_owned(val);
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39196         val_conv = ChannelId_clone(&val_conv);
39197         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
39198 }
39199
39200 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
39201         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
39202         uint64_t ret_ref = 0;
39203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39205         return ret_ref;
39206 }
39207 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
39208         LDKChannelMonitorUpdate arg_conv;
39209         arg_conv.inner = untag_ptr(arg);
39210         arg_conv.is_owned = ptr_is_owned(arg);
39211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39212         arg_conv.is_owned = false;
39213         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
39214         return ret_conv;
39215 }
39216
39217 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
39218         LDKChannelMonitorUpdate orig_conv;
39219         orig_conv.inner = untag_ptr(orig);
39220         orig_conv.is_owned = ptr_is_owned(orig);
39221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39222         orig_conv.is_owned = false;
39223         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
39224         uint64_t ret_ref = 0;
39225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39227         return ret_ref;
39228 }
39229
39230 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
39231         LDKChannelMonitorUpdate a_conv;
39232         a_conv.inner = untag_ptr(a);
39233         a_conv.is_owned = ptr_is_owned(a);
39234         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39235         a_conv.is_owned = false;
39236         LDKChannelMonitorUpdate b_conv;
39237         b_conv.inner = untag_ptr(b);
39238         b_conv.is_owned = ptr_is_owned(b);
39239         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39240         b_conv.is_owned = false;
39241         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
39242         return ret_conv;
39243 }
39244
39245 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
39246         LDKChannelMonitorUpdate obj_conv;
39247         obj_conv.inner = untag_ptr(obj);
39248         obj_conv.is_owned = ptr_is_owned(obj);
39249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39250         obj_conv.is_owned = false;
39251         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
39252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39254         CVec_u8Z_free(ret_var);
39255         return ret_arr;
39256 }
39257
39258 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
39259         LDKu8slice ser_ref;
39260         ser_ref.datalen = ser->arr_len;
39261         ser_ref.data = ser->elems;
39262         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
39263         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
39264         FREE(ser);
39265         return tag_ptr(ret_conv, true);
39266 }
39267
39268 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
39269         if (!ptr_is_owned(this_ptr)) return;
39270         void* this_ptr_ptr = untag_ptr(this_ptr);
39271         CHECK_ACCESS(this_ptr_ptr);
39272         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
39273         FREE(untag_ptr(this_ptr));
39274         MonitorEvent_free(this_ptr_conv);
39275 }
39276
39277 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
39278         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39279         *ret_copy = MonitorEvent_clone(arg);
39280         uint64_t ret_ref = tag_ptr(ret_copy, true);
39281         return ret_ref;
39282 }
39283 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
39284         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
39285         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
39286         return ret_conv;
39287 }
39288
39289 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
39290         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
39291         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39292         *ret_copy = MonitorEvent_clone(orig_conv);
39293         uint64_t ret_ref = tag_ptr(ret_copy, true);
39294         return ret_ref;
39295 }
39296
39297 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
39298         LDKHTLCUpdate a_conv;
39299         a_conv.inner = untag_ptr(a);
39300         a_conv.is_owned = ptr_is_owned(a);
39301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39302         a_conv = HTLCUpdate_clone(&a_conv);
39303         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39304         *ret_copy = MonitorEvent_htlcevent(a_conv);
39305         uint64_t ret_ref = tag_ptr(ret_copy, true);
39306         return ret_ref;
39307 }
39308
39309 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed_with_info"))) TS_MonitorEvent_holder_force_closed_with_info(uint64_t reason, uint64_t outpoint, uint64_t channel_id) {
39310         void* reason_ptr = untag_ptr(reason);
39311         CHECK_ACCESS(reason_ptr);
39312         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
39313         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
39314         LDKOutPoint outpoint_conv;
39315         outpoint_conv.inner = untag_ptr(outpoint);
39316         outpoint_conv.is_owned = ptr_is_owned(outpoint);
39317         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
39318         outpoint_conv = OutPoint_clone(&outpoint_conv);
39319         LDKChannelId channel_id_conv;
39320         channel_id_conv.inner = untag_ptr(channel_id);
39321         channel_id_conv.is_owned = ptr_is_owned(channel_id);
39322         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
39323         channel_id_conv = ChannelId_clone(&channel_id_conv);
39324         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39325         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
39326         uint64_t ret_ref = tag_ptr(ret_copy, true);
39327         return ret_ref;
39328 }
39329
39330 uint64_t  __attribute__((export_name("TS_MonitorEvent_holder_force_closed"))) TS_MonitorEvent_holder_force_closed(uint64_t a) {
39331         LDKOutPoint a_conv;
39332         a_conv.inner = untag_ptr(a);
39333         a_conv.is_owned = ptr_is_owned(a);
39334         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39335         a_conv = OutPoint_clone(&a_conv);
39336         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39337         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
39338         uint64_t ret_ref = tag_ptr(ret_copy, true);
39339         return ret_ref;
39340 }
39341
39342 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, uint64_t channel_id, int64_t monitor_update_id) {
39343         LDKOutPoint funding_txo_conv;
39344         funding_txo_conv.inner = untag_ptr(funding_txo);
39345         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
39346         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
39347         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
39348         LDKChannelId channel_id_conv;
39349         channel_id_conv.inner = untag_ptr(channel_id);
39350         channel_id_conv.is_owned = ptr_is_owned(channel_id);
39351         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
39352         channel_id_conv = ChannelId_clone(&channel_id_conv);
39353         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39354         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
39355         uint64_t ret_ref = tag_ptr(ret_copy, true);
39356         return ret_ref;
39357 }
39358
39359 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
39360         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
39361         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
39362         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
39363         return ret_conv;
39364 }
39365
39366 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
39367         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
39368         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
39369         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39370         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39371         CVec_u8Z_free(ret_var);
39372         return ret_arr;
39373 }
39374
39375 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
39376         LDKu8slice ser_ref;
39377         ser_ref.datalen = ser->arr_len;
39378         ser_ref.data = ser->elems;
39379         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
39380         *ret_conv = MonitorEvent_read(ser_ref);
39381         FREE(ser);
39382         return tag_ptr(ret_conv, true);
39383 }
39384
39385 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
39386         LDKHTLCUpdate this_obj_conv;
39387         this_obj_conv.inner = untag_ptr(this_obj);
39388         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39390         HTLCUpdate_free(this_obj_conv);
39391 }
39392
39393 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
39394         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
39395         uint64_t ret_ref = 0;
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39398         return ret_ref;
39399 }
39400 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
39401         LDKHTLCUpdate arg_conv;
39402         arg_conv.inner = untag_ptr(arg);
39403         arg_conv.is_owned = ptr_is_owned(arg);
39404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39405         arg_conv.is_owned = false;
39406         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
39407         return ret_conv;
39408 }
39409
39410 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
39411         LDKHTLCUpdate orig_conv;
39412         orig_conv.inner = untag_ptr(orig);
39413         orig_conv.is_owned = ptr_is_owned(orig);
39414         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39415         orig_conv.is_owned = false;
39416         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
39417         uint64_t ret_ref = 0;
39418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39420         return ret_ref;
39421 }
39422
39423 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
39424         LDKHTLCUpdate a_conv;
39425         a_conv.inner = untag_ptr(a);
39426         a_conv.is_owned = ptr_is_owned(a);
39427         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39428         a_conv.is_owned = false;
39429         LDKHTLCUpdate b_conv;
39430         b_conv.inner = untag_ptr(b);
39431         b_conv.is_owned = ptr_is_owned(b);
39432         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39433         b_conv.is_owned = false;
39434         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
39435         return ret_conv;
39436 }
39437
39438 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
39439         LDKHTLCUpdate obj_conv;
39440         obj_conv.inner = untag_ptr(obj);
39441         obj_conv.is_owned = ptr_is_owned(obj);
39442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39443         obj_conv.is_owned = false;
39444         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
39445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39447         CVec_u8Z_free(ret_var);
39448         return ret_arr;
39449 }
39450
39451 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
39452         LDKu8slice ser_ref;
39453         ser_ref.datalen = ser->arr_len;
39454         ser_ref.data = ser->elems;
39455         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
39456         *ret_conv = HTLCUpdate_read(ser_ref);
39457         FREE(ser);
39458         return tag_ptr(ret_conv, true);
39459 }
39460
39461 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
39462         if (!ptr_is_owned(this_ptr)) return;
39463         void* this_ptr_ptr = untag_ptr(this_ptr);
39464         CHECK_ACCESS(this_ptr_ptr);
39465         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
39466         FREE(untag_ptr(this_ptr));
39467         Balance_free(this_ptr_conv);
39468 }
39469
39470 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
39471         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39472         *ret_copy = Balance_clone(arg);
39473         uint64_t ret_ref = tag_ptr(ret_copy, true);
39474         return ret_ref;
39475 }
39476 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
39477         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
39478         int64_t ret_conv = Balance_clone_ptr(arg_conv);
39479         return ret_conv;
39480 }
39481
39482 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
39483         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
39484         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39485         *ret_copy = Balance_clone(orig_conv);
39486         uint64_t ret_ref = tag_ptr(ret_copy, true);
39487         return ret_ref;
39488 }
39489
39490 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
39491         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39492         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
39493         uint64_t ret_ref = tag_ptr(ret_copy, true);
39494         return ret_ref;
39495 }
39496
39497 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
39498         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39499         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
39500         uint64_t ret_ref = tag_ptr(ret_copy, true);
39501         return ret_ref;
39502 }
39503
39504 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) {
39505         LDKThirtyTwoBytes payment_hash_ref;
39506         CHECK(payment_hash->arr_len == 32);
39507         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39508         LDKThirtyTwoBytes payment_preimage_ref;
39509         CHECK(payment_preimage->arr_len == 32);
39510         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39511         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39512         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
39513         uint64_t ret_ref = tag_ptr(ret_copy, true);
39514         return ret_ref;
39515 }
39516
39517 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) {
39518         LDKThirtyTwoBytes payment_hash_ref;
39519         CHECK(payment_hash->arr_len == 32);
39520         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39521         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39522         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
39523         uint64_t ret_ref = tag_ptr(ret_copy, true);
39524         return ret_ref;
39525 }
39526
39527 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) {
39528         LDKThirtyTwoBytes payment_hash_ref;
39529         CHECK(payment_hash->arr_len == 32);
39530         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39531         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39532         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
39533         uint64_t ret_ref = tag_ptr(ret_copy, true);
39534         return ret_ref;
39535 }
39536
39537 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
39538         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39539         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
39540         uint64_t ret_ref = tag_ptr(ret_copy, true);
39541         return ret_ref;
39542 }
39543
39544 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
39545         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
39546         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
39547         jboolean ret_conv = Balance_eq(a_conv, b_conv);
39548         return ret_conv;
39549 }
39550
39551 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
39552         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
39553         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
39554         return ret_conv;
39555 }
39556
39557 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
39558         LDKChannelMonitor this_obj_conv;
39559         this_obj_conv.inner = untag_ptr(this_obj);
39560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39562         ChannelMonitor_free(this_obj_conv);
39563 }
39564
39565 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
39566         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
39567         uint64_t ret_ref = 0;
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39570         return ret_ref;
39571 }
39572 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
39573         LDKChannelMonitor arg_conv;
39574         arg_conv.inner = untag_ptr(arg);
39575         arg_conv.is_owned = ptr_is_owned(arg);
39576         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39577         arg_conv.is_owned = false;
39578         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
39579         return ret_conv;
39580 }
39581
39582 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
39583         LDKChannelMonitor orig_conv;
39584         orig_conv.inner = untag_ptr(orig);
39585         orig_conv.is_owned = ptr_is_owned(orig);
39586         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39587         orig_conv.is_owned = false;
39588         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
39589         uint64_t ret_ref = 0;
39590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39592         return ret_ref;
39593 }
39594
39595 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
39596         LDKChannelMonitor obj_conv;
39597         obj_conv.inner = untag_ptr(obj);
39598         obj_conv.is_owned = ptr_is_owned(obj);
39599         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39600         obj_conv.is_owned = false;
39601         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
39602         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39603         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39604         CVec_u8Z_free(ret_var);
39605         return ret_arr;
39606 }
39607
39608 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) {
39609         LDKChannelMonitor this_arg_conv;
39610         this_arg_conv.inner = untag_ptr(this_arg);
39611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39613         this_arg_conv.is_owned = false;
39614         LDKChannelMonitorUpdate updates_conv;
39615         updates_conv.inner = untag_ptr(updates);
39616         updates_conv.is_owned = ptr_is_owned(updates);
39617         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
39618         updates_conv.is_owned = false;
39619         void* broadcaster_ptr = untag_ptr(broadcaster);
39620         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39621         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39622         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39623         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39624         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39625         void* logger_ptr = untag_ptr(logger);
39626         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39627         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39628         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
39629         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39630         return tag_ptr(ret_conv, true);
39631 }
39632
39633 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
39634         LDKChannelMonitor this_arg_conv;
39635         this_arg_conv.inner = untag_ptr(this_arg);
39636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39638         this_arg_conv.is_owned = false;
39639         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
39640         return ret_conv;
39641 }
39642
39643 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
39644         LDKChannelMonitor this_arg_conv;
39645         this_arg_conv.inner = untag_ptr(this_arg);
39646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39648         this_arg_conv.is_owned = false;
39649         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
39650         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
39651         return tag_ptr(ret_conv, true);
39652 }
39653
39654 uint64_t  __attribute__((export_name("TS_ChannelMonitor_channel_id"))) TS_ChannelMonitor_channel_id(uint64_t this_arg) {
39655         LDKChannelMonitor this_arg_conv;
39656         this_arg_conv.inner = untag_ptr(this_arg);
39657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39659         this_arg_conv.is_owned = false;
39660         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
39661         uint64_t ret_ref = 0;
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39664         return ret_ref;
39665 }
39666
39667 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
39668         LDKChannelMonitor this_arg_conv;
39669         this_arg_conv.inner = untag_ptr(this_arg);
39670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39672         this_arg_conv.is_owned = false;
39673         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
39674         uint64_tArray ret_arr = NULL;
39675         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39676         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39677         for (size_t a = 0; a < ret_var.datalen; a++) {
39678                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
39679                 *ret_conv_52_conv = ret_var.data[a];
39680                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
39681         }
39682         
39683         FREE(ret_var.data);
39684         return ret_arr;
39685 }
39686
39687 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) {
39688         LDKChannelMonitor this_arg_conv;
39689         this_arg_conv.inner = untag_ptr(this_arg);
39690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39692         this_arg_conv.is_owned = false;
39693         void* filter_ptr = untag_ptr(filter);
39694         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
39695         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
39696         void* logger_ptr = untag_ptr(logger);
39697         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39698         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39699         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
39700 }
39701
39702 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) {
39703         LDKChannelMonitor this_arg_conv;
39704         this_arg_conv.inner = untag_ptr(this_arg);
39705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39707         this_arg_conv.is_owned = false;
39708         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
39709         uint64_tArray ret_arr = NULL;
39710         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39711         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39712         for (size_t o = 0; o < ret_var.datalen; o++) {
39713                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39714                 *ret_conv_14_copy = ret_var.data[o];
39715                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
39716                 ret_arr_ptr[o] = ret_conv_14_ref;
39717         }
39718         
39719         FREE(ret_var.data);
39720         return ret_arr;
39721 }
39722
39723 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
39724         LDKChannelMonitor this_arg_conv;
39725         this_arg_conv.inner = untag_ptr(this_arg);
39726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39728         this_arg_conv.is_owned = false;
39729         void* handler_ptr = untag_ptr(handler);
39730         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
39731         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
39732         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
39733 }
39734
39735 uint64_t  __attribute__((export_name("TS_ChannelMonitor_initial_counterparty_commitment_tx"))) TS_ChannelMonitor_initial_counterparty_commitment_tx(uint64_t this_arg) {
39736         LDKChannelMonitor this_arg_conv;
39737         this_arg_conv.inner = untag_ptr(this_arg);
39738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39740         this_arg_conv.is_owned = false;
39741         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
39742         uint64_t ret_ref = 0;
39743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39745         return ret_ref;
39746 }
39747
39748 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) {
39749         LDKChannelMonitor this_arg_conv;
39750         this_arg_conv.inner = untag_ptr(this_arg);
39751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39753         this_arg_conv.is_owned = false;
39754         LDKChannelMonitorUpdate update_conv;
39755         update_conv.inner = untag_ptr(update);
39756         update_conv.is_owned = ptr_is_owned(update);
39757         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
39758         update_conv.is_owned = false;
39759         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
39760         uint64_tArray ret_arr = NULL;
39761         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39762         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39763         for (size_t x = 0; x < ret_var.datalen; x++) {
39764                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
39765                 uint64_t ret_conv_23_ref = 0;
39766                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
39767                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
39768                 ret_arr_ptr[x] = ret_conv_23_ref;
39769         }
39770         
39771         FREE(ret_var.data);
39772         return ret_arr;
39773 }
39774
39775 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) {
39776         LDKChannelMonitor this_arg_conv;
39777         this_arg_conv.inner = untag_ptr(this_arg);
39778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39780         this_arg_conv.is_owned = false;
39781         LDKTransaction justice_tx_ref;
39782         justice_tx_ref.datalen = justice_tx->arr_len;
39783         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
39784         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
39785         justice_tx_ref.data_is_owned = true;
39786         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
39787         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
39788         return tag_ptr(ret_conv, true);
39789 }
39790
39791 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
39792         LDKChannelMonitor this_arg_conv;
39793         this_arg_conv.inner = untag_ptr(this_arg);
39794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39796         this_arg_conv.is_owned = false;
39797         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39798         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
39799         return ret_arr;
39800 }
39801
39802 void  __attribute__((export_name("TS_ChannelMonitor_broadcast_latest_holder_commitment_txn"))) TS_ChannelMonitor_broadcast_latest_holder_commitment_txn(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
39803         LDKChannelMonitor this_arg_conv;
39804         this_arg_conv.inner = untag_ptr(this_arg);
39805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39807         this_arg_conv.is_owned = false;
39808         void* broadcaster_ptr = untag_ptr(broadcaster);
39809         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39810         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39811         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39812         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39813         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39814         void* logger_ptr = untag_ptr(logger);
39815         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39816         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39817         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39818 }
39819
39820 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) {
39821         LDKChannelMonitor this_arg_conv;
39822         this_arg_conv.inner = untag_ptr(this_arg);
39823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39825         this_arg_conv.is_owned = false;
39826         uint8_t header_arr[80];
39827         CHECK(header->arr_len == 80);
39828         memcpy(header_arr, header->elems, 80); FREE(header);
39829         uint8_t (*header_ref)[80] = &header_arr;
39830         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39831         txdata_constr.datalen = txdata->arr_len;
39832         if (txdata_constr.datalen > 0)
39833                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39834         else
39835                 txdata_constr.data = NULL;
39836         uint64_t* txdata_vals = txdata->elems;
39837         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39838                 uint64_t txdata_conv_28 = txdata_vals[c];
39839                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39840                 CHECK_ACCESS(txdata_conv_28_ptr);
39841                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39842                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39843                 txdata_constr.data[c] = txdata_conv_28_conv;
39844         }
39845         FREE(txdata);
39846         void* broadcaster_ptr = untag_ptr(broadcaster);
39847         CHECK_ACCESS(broadcaster_ptr);
39848         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39849         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39850                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39851                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39852         }
39853         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39854         CHECK_ACCESS(fee_estimator_ptr);
39855         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39856         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39857                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39858                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39859         }
39860         void* logger_ptr = untag_ptr(logger);
39861         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39862         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39863         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);
39864         uint64_tArray ret_arr = NULL;
39865         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39866         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39867         for (size_t x = 0; x < ret_var.datalen; x++) {
39868                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39869                 *ret_conv_49_conv = ret_var.data[x];
39870                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39871         }
39872         
39873         FREE(ret_var.data);
39874         return ret_arr;
39875 }
39876
39877 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) {
39878         LDKChannelMonitor this_arg_conv;
39879         this_arg_conv.inner = untag_ptr(this_arg);
39880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39882         this_arg_conv.is_owned = false;
39883         uint8_t header_arr[80];
39884         CHECK(header->arr_len == 80);
39885         memcpy(header_arr, header->elems, 80); FREE(header);
39886         uint8_t (*header_ref)[80] = &header_arr;
39887         void* broadcaster_ptr = untag_ptr(broadcaster);
39888         CHECK_ACCESS(broadcaster_ptr);
39889         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39890         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39891                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39892                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39893         }
39894         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39895         CHECK_ACCESS(fee_estimator_ptr);
39896         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39897         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39898                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39899                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39900         }
39901         void* logger_ptr = untag_ptr(logger);
39902         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39903         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39904         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39905 }
39906
39907 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) {
39908         LDKChannelMonitor this_arg_conv;
39909         this_arg_conv.inner = untag_ptr(this_arg);
39910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39912         this_arg_conv.is_owned = false;
39913         uint8_t header_arr[80];
39914         CHECK(header->arr_len == 80);
39915         memcpy(header_arr, header->elems, 80); FREE(header);
39916         uint8_t (*header_ref)[80] = &header_arr;
39917         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39918         txdata_constr.datalen = txdata->arr_len;
39919         if (txdata_constr.datalen > 0)
39920                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39921         else
39922                 txdata_constr.data = NULL;
39923         uint64_t* txdata_vals = txdata->elems;
39924         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39925                 uint64_t txdata_conv_28 = txdata_vals[c];
39926                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39927                 CHECK_ACCESS(txdata_conv_28_ptr);
39928                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39929                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39930                 txdata_constr.data[c] = txdata_conv_28_conv;
39931         }
39932         FREE(txdata);
39933         void* broadcaster_ptr = untag_ptr(broadcaster);
39934         CHECK_ACCESS(broadcaster_ptr);
39935         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39936         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39937                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39938                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39939         }
39940         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39941         CHECK_ACCESS(fee_estimator_ptr);
39942         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39943         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39944                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39945                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39946         }
39947         void* logger_ptr = untag_ptr(logger);
39948         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39949         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39950         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);
39951         uint64_tArray ret_arr = NULL;
39952         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
39953         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
39954         for (size_t x = 0; x < ret_var.datalen; x++) {
39955                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39956                 *ret_conv_49_conv = ret_var.data[x];
39957                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39958         }
39959         
39960         FREE(ret_var.data);
39961         return ret_arr;
39962 }
39963
39964 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) {
39965         LDKChannelMonitor this_arg_conv;
39966         this_arg_conv.inner = untag_ptr(this_arg);
39967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39969         this_arg_conv.is_owned = false;
39970         uint8_t txid_arr[32];
39971         CHECK(txid->arr_len == 32);
39972         memcpy(txid_arr, txid->elems, 32); FREE(txid);
39973         uint8_t (*txid_ref)[32] = &txid_arr;
39974         void* broadcaster_ptr = untag_ptr(broadcaster);
39975         CHECK_ACCESS(broadcaster_ptr);
39976         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39977         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39978                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39979                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39980         }
39981         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39982         CHECK_ACCESS(fee_estimator_ptr);
39983         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39984         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39986                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39987         }
39988         void* logger_ptr = untag_ptr(logger);
39989         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39990         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39991         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
39992 }
39993
39994 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) {
39995         LDKChannelMonitor this_arg_conv;
39996         this_arg_conv.inner = untag_ptr(this_arg);
39997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39999         this_arg_conv.is_owned = false;
40000         uint8_t header_arr[80];
40001         CHECK(header->arr_len == 80);
40002         memcpy(header_arr, header->elems, 80); FREE(header);
40003         uint8_t (*header_ref)[80] = &header_arr;
40004         void* broadcaster_ptr = untag_ptr(broadcaster);
40005         CHECK_ACCESS(broadcaster_ptr);
40006         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40007         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40009                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40010         }
40011         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40012         CHECK_ACCESS(fee_estimator_ptr);
40013         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40014         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40015                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40016                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40017         }
40018         void* logger_ptr = untag_ptr(logger);
40019         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40020         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40021         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
40022         uint64_tArray ret_arr = NULL;
40023         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40024         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40025         for (size_t x = 0; x < ret_var.datalen; x++) {
40026                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
40027                 *ret_conv_49_conv = ret_var.data[x];
40028                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
40029         }
40030         
40031         FREE(ret_var.data);
40032         return ret_arr;
40033 }
40034
40035 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
40036         LDKChannelMonitor this_arg_conv;
40037         this_arg_conv.inner = untag_ptr(this_arg);
40038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40040         this_arg_conv.is_owned = false;
40041         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
40042         uint64_tArray ret_arr = NULL;
40043         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40044         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40045         for (size_t c = 0; c < ret_var.datalen; c++) {
40046                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
40047                 *ret_conv_54_conv = ret_var.data[c];
40048                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
40049         }
40050         
40051         FREE(ret_var.data);
40052         return ret_arr;
40053 }
40054
40055 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
40056         LDKChannelMonitor this_arg_conv;
40057         this_arg_conv.inner = untag_ptr(this_arg);
40058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40060         this_arg_conv.is_owned = false;
40061         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
40062         uint64_t ret_ref = 0;
40063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40065         return ret_ref;
40066 }
40067
40068 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) {
40069         LDKChannelMonitor this_arg_conv;
40070         this_arg_conv.inner = untag_ptr(this_arg);
40071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40073         this_arg_conv.is_owned = false;
40074         void* broadcaster_ptr = untag_ptr(broadcaster);
40075         CHECK_ACCESS(broadcaster_ptr);
40076         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40077         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40078                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40079                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40080         }
40081         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40082         CHECK_ACCESS(fee_estimator_ptr);
40083         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40084         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40085                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40086                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40087         }
40088         void* logger_ptr = untag_ptr(logger);
40089         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40090         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40091         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40092 }
40093
40094 void  __attribute__((export_name("TS_ChannelMonitor_signer_unblocked"))) TS_ChannelMonitor_signer_unblocked(uint64_t this_arg, uint64_t broadcaster, uint64_t fee_estimator, uint64_t logger) {
40095         LDKChannelMonitor this_arg_conv;
40096         this_arg_conv.inner = untag_ptr(this_arg);
40097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40099         this_arg_conv.is_owned = false;
40100         void* broadcaster_ptr = untag_ptr(broadcaster);
40101         CHECK_ACCESS(broadcaster_ptr);
40102         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40103         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40104                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40105                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40106         }
40107         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40108         CHECK_ACCESS(fee_estimator_ptr);
40109         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40110         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40111                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40112                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40113         }
40114         void* logger_ptr = untag_ptr(logger);
40115         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40116         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40117         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40118 }
40119
40120 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) {
40121         LDKChannelMonitor this_arg_conv;
40122         this_arg_conv.inner = untag_ptr(this_arg);
40123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40125         this_arg_conv.is_owned = false;
40126         LDKTransaction tx_ref;
40127         tx_ref.datalen = tx->arr_len;
40128         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
40129         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
40130         tx_ref.data_is_owned = true;
40131         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
40132         uint64_tArray ret_arr = NULL;
40133         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40134         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40135         for (size_t b = 0; b < ret_var.datalen; b++) {
40136                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
40137                 *ret_conv_27_copy = ret_var.data[b];
40138                 uint64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
40139                 ret_arr_ptr[b] = ret_conv_27_ref;
40140         }
40141         
40142         FREE(ret_var.data);
40143         return ret_arr;
40144 }
40145
40146 jboolean  __attribute__((export_name("TS_ChannelMonitor_is_fully_resolved"))) TS_ChannelMonitor_is_fully_resolved(uint64_t this_arg, uint64_t logger) {
40147         LDKChannelMonitor this_arg_conv;
40148         this_arg_conv.inner = untag_ptr(this_arg);
40149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40151         this_arg_conv.is_owned = false;
40152         void* logger_ptr = untag_ptr(logger);
40153         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40154         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40155         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
40156         return ret_conv;
40157 }
40158
40159 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
40160         LDKChannelMonitor this_arg_conv;
40161         this_arg_conv.inner = untag_ptr(this_arg);
40162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40164         this_arg_conv.is_owned = false;
40165         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
40166         uint64_tArray ret_arr = NULL;
40167         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40168         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40169         for (size_t j = 0; j < ret_var.datalen; j++) {
40170                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40171                 *ret_conv_9_copy = ret_var.data[j];
40172                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
40173                 ret_arr_ptr[j] = ret_conv_9_ref;
40174         }
40175         
40176         FREE(ret_var.data);
40177         return ret_arr;
40178 }
40179
40180 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
40181         LDKu8slice ser_ref;
40182         ser_ref.datalen = ser->arr_len;
40183         ser_ref.data = ser->elems;
40184         void* arg_a_ptr = untag_ptr(arg_a);
40185         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
40186         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
40187         void* arg_b_ptr = untag_ptr(arg_b);
40188         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
40189         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
40190         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
40191         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
40192         FREE(ser);
40193         return tag_ptr(ret_conv, true);
40194 }
40195
40196 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
40197         LDKOutPoint this_obj_conv;
40198         this_obj_conv.inner = untag_ptr(this_obj);
40199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40201         OutPoint_free(this_obj_conv);
40202 }
40203
40204 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
40205         LDKOutPoint this_ptr_conv;
40206         this_ptr_conv.inner = untag_ptr(this_ptr);
40207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40209         this_ptr_conv.is_owned = false;
40210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40211         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
40212         return ret_arr;
40213 }
40214
40215 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
40216         LDKOutPoint this_ptr_conv;
40217         this_ptr_conv.inner = untag_ptr(this_ptr);
40218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40220         this_ptr_conv.is_owned = false;
40221         LDKThirtyTwoBytes val_ref;
40222         CHECK(val->arr_len == 32);
40223         memcpy(val_ref.data, val->elems, 32); FREE(val);
40224         OutPoint_set_txid(&this_ptr_conv, val_ref);
40225 }
40226
40227 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
40228         LDKOutPoint this_ptr_conv;
40229         this_ptr_conv.inner = untag_ptr(this_ptr);
40230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40232         this_ptr_conv.is_owned = false;
40233         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
40234         return ret_conv;
40235 }
40236
40237 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
40238         LDKOutPoint this_ptr_conv;
40239         this_ptr_conv.inner = untag_ptr(this_ptr);
40240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40242         this_ptr_conv.is_owned = false;
40243         OutPoint_set_index(&this_ptr_conv, val);
40244 }
40245
40246 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
40247         LDKThirtyTwoBytes txid_arg_ref;
40248         CHECK(txid_arg->arr_len == 32);
40249         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
40250         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
40251         uint64_t ret_ref = 0;
40252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40254         return ret_ref;
40255 }
40256
40257 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
40258         LDKOutPoint ret_var = OutPoint_clone(arg);
40259         uint64_t ret_ref = 0;
40260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40262         return ret_ref;
40263 }
40264 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
40265         LDKOutPoint arg_conv;
40266         arg_conv.inner = untag_ptr(arg);
40267         arg_conv.is_owned = ptr_is_owned(arg);
40268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40269         arg_conv.is_owned = false;
40270         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
40271         return ret_conv;
40272 }
40273
40274 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
40275         LDKOutPoint orig_conv;
40276         orig_conv.inner = untag_ptr(orig);
40277         orig_conv.is_owned = ptr_is_owned(orig);
40278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40279         orig_conv.is_owned = false;
40280         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
40281         uint64_t ret_ref = 0;
40282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40284         return ret_ref;
40285 }
40286
40287 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
40288         LDKOutPoint a_conv;
40289         a_conv.inner = untag_ptr(a);
40290         a_conv.is_owned = ptr_is_owned(a);
40291         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40292         a_conv.is_owned = false;
40293         LDKOutPoint b_conv;
40294         b_conv.inner = untag_ptr(b);
40295         b_conv.is_owned = ptr_is_owned(b);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40297         b_conv.is_owned = false;
40298         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
40299         return ret_conv;
40300 }
40301
40302 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
40303         LDKOutPoint o_conv;
40304         o_conv.inner = untag_ptr(o);
40305         o_conv.is_owned = ptr_is_owned(o);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40307         o_conv.is_owned = false;
40308         int64_t ret_conv = OutPoint_hash(&o_conv);
40309         return ret_conv;
40310 }
40311
40312 jstring  __attribute__((export_name("TS_OutPoint_to_str"))) TS_OutPoint_to_str(uint64_t o) {
40313         LDKOutPoint o_conv;
40314         o_conv.inner = untag_ptr(o);
40315         o_conv.is_owned = ptr_is_owned(o);
40316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40317         o_conv.is_owned = false;
40318         LDKStr ret_str = OutPoint_to_str(&o_conv);
40319         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40320         Str_free(ret_str);
40321         return ret_conv;
40322 }
40323
40324 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
40325         LDKOutPoint obj_conv;
40326         obj_conv.inner = untag_ptr(obj);
40327         obj_conv.is_owned = ptr_is_owned(obj);
40328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40329         obj_conv.is_owned = false;
40330         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
40331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40333         CVec_u8Z_free(ret_var);
40334         return ret_arr;
40335 }
40336
40337 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
40338         LDKu8slice ser_ref;
40339         ser_ref.datalen = ser->arr_len;
40340         ser_ref.data = ser->elems;
40341         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
40342         *ret_conv = OutPoint_read(ser_ref);
40343         FREE(ser);
40344         return tag_ptr(ret_conv, true);
40345 }
40346
40347 void  __attribute__((export_name("TS_InboundHTLCErr_free"))) TS_InboundHTLCErr_free(uint64_t this_obj) {
40348         LDKInboundHTLCErr this_obj_conv;
40349         this_obj_conv.inner = untag_ptr(this_obj);
40350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40352         InboundHTLCErr_free(this_obj_conv);
40353 }
40354
40355 int16_t  __attribute__((export_name("TS_InboundHTLCErr_get_err_code"))) TS_InboundHTLCErr_get_err_code(uint64_t this_ptr) {
40356         LDKInboundHTLCErr this_ptr_conv;
40357         this_ptr_conv.inner = untag_ptr(this_ptr);
40358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40360         this_ptr_conv.is_owned = false;
40361         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
40362         return ret_conv;
40363 }
40364
40365 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_code"))) TS_InboundHTLCErr_set_err_code(uint64_t this_ptr, int16_t val) {
40366         LDKInboundHTLCErr this_ptr_conv;
40367         this_ptr_conv.inner = untag_ptr(this_ptr);
40368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40370         this_ptr_conv.is_owned = false;
40371         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
40372 }
40373
40374 int8_tArray  __attribute__((export_name("TS_InboundHTLCErr_get_err_data"))) TS_InboundHTLCErr_get_err_data(uint64_t this_ptr) {
40375         LDKInboundHTLCErr this_ptr_conv;
40376         this_ptr_conv.inner = untag_ptr(this_ptr);
40377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40379         this_ptr_conv.is_owned = false;
40380         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
40381         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40382         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40383         CVec_u8Z_free(ret_var);
40384         return ret_arr;
40385 }
40386
40387 void  __attribute__((export_name("TS_InboundHTLCErr_set_err_data"))) TS_InboundHTLCErr_set_err_data(uint64_t this_ptr, int8_tArray val) {
40388         LDKInboundHTLCErr this_ptr_conv;
40389         this_ptr_conv.inner = untag_ptr(this_ptr);
40390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40392         this_ptr_conv.is_owned = false;
40393         LDKCVec_u8Z val_ref;
40394         val_ref.datalen = val->arr_len;
40395         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40396         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40397         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
40398 }
40399
40400 jstring  __attribute__((export_name("TS_InboundHTLCErr_get_msg"))) TS_InboundHTLCErr_get_msg(uint64_t this_ptr) {
40401         LDKInboundHTLCErr this_ptr_conv;
40402         this_ptr_conv.inner = untag_ptr(this_ptr);
40403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40405         this_ptr_conv.is_owned = false;
40406         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
40407         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40408         Str_free(ret_str);
40409         return ret_conv;
40410 }
40411
40412 void  __attribute__((export_name("TS_InboundHTLCErr_set_msg"))) TS_InboundHTLCErr_set_msg(uint64_t this_ptr, jstring val) {
40413         LDKInboundHTLCErr this_ptr_conv;
40414         this_ptr_conv.inner = untag_ptr(this_ptr);
40415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40417         this_ptr_conv.is_owned = false;
40418         LDKStr val_conv = str_ref_to_owned_c(val);
40419         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
40420 }
40421
40422 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_new"))) TS_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
40423         LDKCVec_u8Z err_data_arg_ref;
40424         err_data_arg_ref.datalen = err_data_arg->arr_len;
40425         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40426         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
40427         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
40428         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
40429         uint64_t ret_ref = 0;
40430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40432         return ret_ref;
40433 }
40434
40435 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
40436         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
40437         uint64_t ret_ref = 0;
40438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40440         return ret_ref;
40441 }
40442 int64_t  __attribute__((export_name("TS_InboundHTLCErr_clone_ptr"))) TS_InboundHTLCErr_clone_ptr(uint64_t arg) {
40443         LDKInboundHTLCErr arg_conv;
40444         arg_conv.inner = untag_ptr(arg);
40445         arg_conv.is_owned = ptr_is_owned(arg);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40447         arg_conv.is_owned = false;
40448         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
40449         return ret_conv;
40450 }
40451
40452 uint64_t  __attribute__((export_name("TS_InboundHTLCErr_clone"))) TS_InboundHTLCErr_clone(uint64_t orig) {
40453         LDKInboundHTLCErr orig_conv;
40454         orig_conv.inner = untag_ptr(orig);
40455         orig_conv.is_owned = ptr_is_owned(orig);
40456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40457         orig_conv.is_owned = false;
40458         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
40459         uint64_t ret_ref = 0;
40460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40462         return ret_ref;
40463 }
40464
40465 int64_t  __attribute__((export_name("TS_InboundHTLCErr_hash"))) TS_InboundHTLCErr_hash(uint64_t o) {
40466         LDKInboundHTLCErr o_conv;
40467         o_conv.inner = untag_ptr(o);
40468         o_conv.is_owned = ptr_is_owned(o);
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40470         o_conv.is_owned = false;
40471         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
40472         return ret_conv;
40473 }
40474
40475 jboolean  __attribute__((export_name("TS_InboundHTLCErr_eq"))) TS_InboundHTLCErr_eq(uint64_t a, uint64_t b) {
40476         LDKInboundHTLCErr a_conv;
40477         a_conv.inner = untag_ptr(a);
40478         a_conv.is_owned = ptr_is_owned(a);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40480         a_conv.is_owned = false;
40481         LDKInboundHTLCErr b_conv;
40482         b_conv.inner = untag_ptr(b);
40483         b_conv.is_owned = ptr_is_owned(b);
40484         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40485         b_conv.is_owned = false;
40486         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
40487         return ret_conv;
40488 }
40489
40490 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) {
40491         LDKUpdateAddHTLC msg_conv;
40492         msg_conv.inner = untag_ptr(msg);
40493         msg_conv.is_owned = ptr_is_owned(msg);
40494         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40495         msg_conv.is_owned = false;
40496         void* node_signer_ptr = untag_ptr(node_signer);
40497         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
40498         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
40499         void* logger_ptr = untag_ptr(logger);
40500         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40501         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40502         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
40503         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
40504         return tag_ptr(ret_conv, true);
40505 }
40506
40507 void  __attribute__((export_name("TS_PendingHTLCRouting_free"))) TS_PendingHTLCRouting_free(uint64_t this_ptr) {
40508         if (!ptr_is_owned(this_ptr)) return;
40509         void* this_ptr_ptr = untag_ptr(this_ptr);
40510         CHECK_ACCESS(this_ptr_ptr);
40511         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
40512         FREE(untag_ptr(this_ptr));
40513         PendingHTLCRouting_free(this_ptr_conv);
40514 }
40515
40516 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
40517         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40518         *ret_copy = PendingHTLCRouting_clone(arg);
40519         uint64_t ret_ref = tag_ptr(ret_copy, true);
40520         return ret_ref;
40521 }
40522 int64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone_ptr"))) TS_PendingHTLCRouting_clone_ptr(uint64_t arg) {
40523         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
40524         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
40525         return ret_conv;
40526 }
40527
40528 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_clone"))) TS_PendingHTLCRouting_clone(uint64_t orig) {
40529         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
40530         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40531         *ret_copy = PendingHTLCRouting_clone(orig_conv);
40532         uint64_t ret_ref = tag_ptr(ret_copy, true);
40533         return ret_ref;
40534 }
40535
40536 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_forward"))) TS_PendingHTLCRouting_forward(uint64_t onion_packet, int64_t short_channel_id, uint64_t blinded) {
40537         LDKOnionPacket onion_packet_conv;
40538         onion_packet_conv.inner = untag_ptr(onion_packet);
40539         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
40540         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
40541         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
40542         LDKBlindedForward blinded_conv;
40543         blinded_conv.inner = untag_ptr(blinded);
40544         blinded_conv.is_owned = ptr_is_owned(blinded);
40545         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
40546         blinded_conv = BlindedForward_clone(&blinded_conv);
40547         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40548         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
40549         uint64_t ret_ref = tag_ptr(ret_copy, true);
40550         return ret_ref;
40551 }
40552
40553 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_receive"))) TS_PendingHTLCRouting_receive(uint64_t payment_data, uint64_t payment_metadata, uint64_t payment_context, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, uint64_tArray custom_tlvs, jboolean requires_blinded_error) {
40554         LDKFinalOnionHopData payment_data_conv;
40555         payment_data_conv.inner = untag_ptr(payment_data);
40556         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40558         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40559         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40560         CHECK_ACCESS(payment_metadata_ptr);
40561         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40562         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40563         void* payment_context_ptr = untag_ptr(payment_context);
40564         CHECK_ACCESS(payment_context_ptr);
40565         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
40566         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
40567         LDKThirtyTwoBytes phantom_shared_secret_ref;
40568         CHECK(phantom_shared_secret->arr_len == 32);
40569         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
40570         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40571         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40572         if (custom_tlvs_constr.datalen > 0)
40573                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40574         else
40575                 custom_tlvs_constr.data = NULL;
40576         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
40577         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40578                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40579                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40580                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40581                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40582                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40583                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40584         }
40585         FREE(custom_tlvs);
40586         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40587         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, payment_context_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
40588         uint64_t ret_ref = tag_ptr(ret_copy, true);
40589         return ret_ref;
40590 }
40591
40592 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, jboolean requires_blinded_error) {
40593         LDKFinalOnionHopData payment_data_conv;
40594         payment_data_conv.inner = untag_ptr(payment_data);
40595         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40596         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40597         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40598         LDKThirtyTwoBytes payment_preimage_ref;
40599         CHECK(payment_preimage->arr_len == 32);
40600         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
40601         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40602         CHECK_ACCESS(payment_metadata_ptr);
40603         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40604         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40605         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40606         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40607         if (custom_tlvs_constr.datalen > 0)
40608                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40609         else
40610                 custom_tlvs_constr.data = NULL;
40611         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
40612         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40613                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40614                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40615                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40616                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40617                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40618                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40619         }
40620         FREE(custom_tlvs);
40621         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40622         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
40623         uint64_t ret_ref = tag_ptr(ret_copy, true);
40624         return ret_ref;
40625 }
40626
40627 void  __attribute__((export_name("TS_BlindedForward_free"))) TS_BlindedForward_free(uint64_t this_obj) {
40628         LDKBlindedForward this_obj_conv;
40629         this_obj_conv.inner = untag_ptr(this_obj);
40630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40632         BlindedForward_free(this_obj_conv);
40633 }
40634
40635 int8_tArray  __attribute__((export_name("TS_BlindedForward_get_inbound_blinding_point"))) TS_BlindedForward_get_inbound_blinding_point(uint64_t this_ptr) {
40636         LDKBlindedForward this_ptr_conv;
40637         this_ptr_conv.inner = untag_ptr(this_ptr);
40638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40640         this_ptr_conv.is_owned = false;
40641         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40642         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
40643         return ret_arr;
40644 }
40645
40646 void  __attribute__((export_name("TS_BlindedForward_set_inbound_blinding_point"))) TS_BlindedForward_set_inbound_blinding_point(uint64_t this_ptr, int8_tArray val) {
40647         LDKBlindedForward this_ptr_conv;
40648         this_ptr_conv.inner = untag_ptr(this_ptr);
40649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40651         this_ptr_conv.is_owned = false;
40652         LDKPublicKey val_ref;
40653         CHECK(val->arr_len == 33);
40654         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40655         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
40656 }
40657
40658 uint32_t  __attribute__((export_name("TS_BlindedForward_get_failure"))) TS_BlindedForward_get_failure(uint64_t this_ptr) {
40659         LDKBlindedForward this_ptr_conv;
40660         this_ptr_conv.inner = untag_ptr(this_ptr);
40661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40663         this_ptr_conv.is_owned = false;
40664         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedForward_get_failure(&this_ptr_conv));
40665         return ret_conv;
40666 }
40667
40668 void  __attribute__((export_name("TS_BlindedForward_set_failure"))) TS_BlindedForward_set_failure(uint64_t this_ptr, uint32_t val) {
40669         LDKBlindedForward this_ptr_conv;
40670         this_ptr_conv.inner = untag_ptr(this_ptr);
40671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40673         this_ptr_conv.is_owned = false;
40674         LDKBlindedFailure val_conv = LDKBlindedFailure_from_js(val);
40675         BlindedForward_set_failure(&this_ptr_conv, val_conv);
40676 }
40677
40678 uint64_t  __attribute__((export_name("TS_BlindedForward_new"))) TS_BlindedForward_new(int8_tArray inbound_blinding_point_arg, uint32_t failure_arg) {
40679         LDKPublicKey inbound_blinding_point_arg_ref;
40680         CHECK(inbound_blinding_point_arg->arr_len == 33);
40681         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
40682         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_js(failure_arg);
40683         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
40684         uint64_t ret_ref = 0;
40685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40687         return ret_ref;
40688 }
40689
40690 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
40691         LDKBlindedForward ret_var = BlindedForward_clone(arg);
40692         uint64_t ret_ref = 0;
40693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40695         return ret_ref;
40696 }
40697 int64_t  __attribute__((export_name("TS_BlindedForward_clone_ptr"))) TS_BlindedForward_clone_ptr(uint64_t arg) {
40698         LDKBlindedForward arg_conv;
40699         arg_conv.inner = untag_ptr(arg);
40700         arg_conv.is_owned = ptr_is_owned(arg);
40701         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40702         arg_conv.is_owned = false;
40703         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
40704         return ret_conv;
40705 }
40706
40707 uint64_t  __attribute__((export_name("TS_BlindedForward_clone"))) TS_BlindedForward_clone(uint64_t orig) {
40708         LDKBlindedForward orig_conv;
40709         orig_conv.inner = untag_ptr(orig);
40710         orig_conv.is_owned = ptr_is_owned(orig);
40711         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40712         orig_conv.is_owned = false;
40713         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
40714         uint64_t ret_ref = 0;
40715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40717         return ret_ref;
40718 }
40719
40720 int64_t  __attribute__((export_name("TS_BlindedForward_hash"))) TS_BlindedForward_hash(uint64_t o) {
40721         LDKBlindedForward o_conv;
40722         o_conv.inner = untag_ptr(o);
40723         o_conv.is_owned = ptr_is_owned(o);
40724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40725         o_conv.is_owned = false;
40726         int64_t ret_conv = BlindedForward_hash(&o_conv);
40727         return ret_conv;
40728 }
40729
40730 jboolean  __attribute__((export_name("TS_BlindedForward_eq"))) TS_BlindedForward_eq(uint64_t a, uint64_t b) {
40731         LDKBlindedForward a_conv;
40732         a_conv.inner = untag_ptr(a);
40733         a_conv.is_owned = ptr_is_owned(a);
40734         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40735         a_conv.is_owned = false;
40736         LDKBlindedForward b_conv;
40737         b_conv.inner = untag_ptr(b);
40738         b_conv.is_owned = ptr_is_owned(b);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40740         b_conv.is_owned = false;
40741         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
40742         return ret_conv;
40743 }
40744
40745 void  __attribute__((export_name("TS_PendingHTLCInfo_free"))) TS_PendingHTLCInfo_free(uint64_t this_obj) {
40746         LDKPendingHTLCInfo this_obj_conv;
40747         this_obj_conv.inner = untag_ptr(this_obj);
40748         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40750         PendingHTLCInfo_free(this_obj_conv);
40751 }
40752
40753 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_routing"))) TS_PendingHTLCInfo_get_routing(uint64_t this_ptr) {
40754         LDKPendingHTLCInfo this_ptr_conv;
40755         this_ptr_conv.inner = untag_ptr(this_ptr);
40756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40758         this_ptr_conv.is_owned = false;
40759         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40760         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
40761         uint64_t ret_ref = tag_ptr(ret_copy, true);
40762         return ret_ref;
40763 }
40764
40765 void  __attribute__((export_name("TS_PendingHTLCInfo_set_routing"))) TS_PendingHTLCInfo_set_routing(uint64_t this_ptr, uint64_t val) {
40766         LDKPendingHTLCInfo this_ptr_conv;
40767         this_ptr_conv.inner = untag_ptr(this_ptr);
40768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40770         this_ptr_conv.is_owned = false;
40771         void* val_ptr = untag_ptr(val);
40772         CHECK_ACCESS(val_ptr);
40773         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
40774         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
40775         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
40776 }
40777
40778 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_shared_secret"))) TS_PendingHTLCInfo_get_incoming_shared_secret(uint64_t this_ptr) {
40779         LDKPendingHTLCInfo this_ptr_conv;
40780         this_ptr_conv.inner = untag_ptr(this_ptr);
40781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40783         this_ptr_conv.is_owned = false;
40784         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40785         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
40786         return ret_arr;
40787 }
40788
40789 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_shared_secret"))) TS_PendingHTLCInfo_set_incoming_shared_secret(uint64_t this_ptr, int8_tArray val) {
40790         LDKPendingHTLCInfo this_ptr_conv;
40791         this_ptr_conv.inner = untag_ptr(this_ptr);
40792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40794         this_ptr_conv.is_owned = false;
40795         LDKThirtyTwoBytes val_ref;
40796         CHECK(val->arr_len == 32);
40797         memcpy(val_ref.data, val->elems, 32); FREE(val);
40798         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
40799 }
40800
40801 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_get_payment_hash"))) TS_PendingHTLCInfo_get_payment_hash(uint64_t this_ptr) {
40802         LDKPendingHTLCInfo this_ptr_conv;
40803         this_ptr_conv.inner = untag_ptr(this_ptr);
40804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40806         this_ptr_conv.is_owned = false;
40807         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40808         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
40809         return ret_arr;
40810 }
40811
40812 void  __attribute__((export_name("TS_PendingHTLCInfo_set_payment_hash"))) TS_PendingHTLCInfo_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
40813         LDKPendingHTLCInfo this_ptr_conv;
40814         this_ptr_conv.inner = untag_ptr(this_ptr);
40815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40817         this_ptr_conv.is_owned = false;
40818         LDKThirtyTwoBytes val_ref;
40819         CHECK(val->arr_len == 32);
40820         memcpy(val_ref.data, val->elems, 32); FREE(val);
40821         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
40822 }
40823
40824 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_incoming_amt_msat"))) TS_PendingHTLCInfo_get_incoming_amt_msat(uint64_t this_ptr) {
40825         LDKPendingHTLCInfo this_ptr_conv;
40826         this_ptr_conv.inner = untag_ptr(this_ptr);
40827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40829         this_ptr_conv.is_owned = false;
40830         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40831         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
40832         uint64_t ret_ref = tag_ptr(ret_copy, true);
40833         return ret_ref;
40834 }
40835
40836 void  __attribute__((export_name("TS_PendingHTLCInfo_set_incoming_amt_msat"))) TS_PendingHTLCInfo_set_incoming_amt_msat(uint64_t this_ptr, uint64_t val) {
40837         LDKPendingHTLCInfo this_ptr_conv;
40838         this_ptr_conv.inner = untag_ptr(this_ptr);
40839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40841         this_ptr_conv.is_owned = false;
40842         void* val_ptr = untag_ptr(val);
40843         CHECK_ACCESS(val_ptr);
40844         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40845         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40846         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
40847 }
40848
40849 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_amt_msat"))) TS_PendingHTLCInfo_get_outgoing_amt_msat(uint64_t this_ptr) {
40850         LDKPendingHTLCInfo this_ptr_conv;
40851         this_ptr_conv.inner = untag_ptr(this_ptr);
40852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40854         this_ptr_conv.is_owned = false;
40855         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
40856         return ret_conv;
40857 }
40858
40859 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_amt_msat"))) TS_PendingHTLCInfo_set_outgoing_amt_msat(uint64_t this_ptr, int64_t val) {
40860         LDKPendingHTLCInfo this_ptr_conv;
40861         this_ptr_conv.inner = untag_ptr(this_ptr);
40862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40864         this_ptr_conv.is_owned = false;
40865         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
40866 }
40867
40868 int32_t  __attribute__((export_name("TS_PendingHTLCInfo_get_outgoing_cltv_value"))) TS_PendingHTLCInfo_get_outgoing_cltv_value(uint64_t this_ptr) {
40869         LDKPendingHTLCInfo this_ptr_conv;
40870         this_ptr_conv.inner = untag_ptr(this_ptr);
40871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40873         this_ptr_conv.is_owned = false;
40874         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
40875         return ret_conv;
40876 }
40877
40878 void  __attribute__((export_name("TS_PendingHTLCInfo_set_outgoing_cltv_value"))) TS_PendingHTLCInfo_set_outgoing_cltv_value(uint64_t this_ptr, int32_t val) {
40879         LDKPendingHTLCInfo this_ptr_conv;
40880         this_ptr_conv.inner = untag_ptr(this_ptr);
40881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40883         this_ptr_conv.is_owned = false;
40884         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
40885 }
40886
40887 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_get_skimmed_fee_msat"))) TS_PendingHTLCInfo_get_skimmed_fee_msat(uint64_t this_ptr) {
40888         LDKPendingHTLCInfo this_ptr_conv;
40889         this_ptr_conv.inner = untag_ptr(this_ptr);
40890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40892         this_ptr_conv.is_owned = false;
40893         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40894         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
40895         uint64_t ret_ref = tag_ptr(ret_copy, true);
40896         return ret_ref;
40897 }
40898
40899 void  __attribute__((export_name("TS_PendingHTLCInfo_set_skimmed_fee_msat"))) TS_PendingHTLCInfo_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
40900         LDKPendingHTLCInfo this_ptr_conv;
40901         this_ptr_conv.inner = untag_ptr(this_ptr);
40902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40904         this_ptr_conv.is_owned = false;
40905         void* val_ptr = untag_ptr(val);
40906         CHECK_ACCESS(val_ptr);
40907         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40908         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40909         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
40910 }
40911
40912 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) {
40913         void* routing_arg_ptr = untag_ptr(routing_arg);
40914         CHECK_ACCESS(routing_arg_ptr);
40915         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
40916         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
40917         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
40918         CHECK(incoming_shared_secret_arg->arr_len == 32);
40919         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
40920         LDKThirtyTwoBytes payment_hash_arg_ref;
40921         CHECK(payment_hash_arg->arr_len == 32);
40922         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
40923         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
40924         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
40925         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
40926         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
40927         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
40928         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
40929         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
40930         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
40931         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);
40932         uint64_t ret_ref = 0;
40933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40935         return ret_ref;
40936 }
40937
40938 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
40939         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
40940         uint64_t ret_ref = 0;
40941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40943         return ret_ref;
40944 }
40945 int64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone_ptr"))) TS_PendingHTLCInfo_clone_ptr(uint64_t arg) {
40946         LDKPendingHTLCInfo arg_conv;
40947         arg_conv.inner = untag_ptr(arg);
40948         arg_conv.is_owned = ptr_is_owned(arg);
40949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40950         arg_conv.is_owned = false;
40951         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
40952         return ret_conv;
40953 }
40954
40955 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_clone"))) TS_PendingHTLCInfo_clone(uint64_t orig) {
40956         LDKPendingHTLCInfo orig_conv;
40957         orig_conv.inner = untag_ptr(orig);
40958         orig_conv.is_owned = ptr_is_owned(orig);
40959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40960         orig_conv.is_owned = false;
40961         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
40962         uint64_t ret_ref = 0;
40963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40965         return ret_ref;
40966 }
40967
40968 uint32_t  __attribute__((export_name("TS_BlindedFailure_clone"))) TS_BlindedFailure_clone(uint64_t orig) {
40969         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
40970         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_clone(orig_conv));
40971         return ret_conv;
40972 }
40973
40974 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_introduction_node"))) TS_BlindedFailure_from_introduction_node() {
40975         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_introduction_node());
40976         return ret_conv;
40977 }
40978
40979 uint32_t  __attribute__((export_name("TS_BlindedFailure_from_blinded_node"))) TS_BlindedFailure_from_blinded_node() {
40980         uint32_t ret_conv = LDKBlindedFailure_to_js(BlindedFailure_from_blinded_node());
40981         return ret_conv;
40982 }
40983
40984 int64_t  __attribute__((export_name("TS_BlindedFailure_hash"))) TS_BlindedFailure_hash(uint64_t o) {
40985         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
40986         int64_t ret_conv = BlindedFailure_hash(o_conv);
40987         return ret_conv;
40988 }
40989
40990 jboolean  __attribute__((export_name("TS_BlindedFailure_eq"))) TS_BlindedFailure_eq(uint64_t a, uint64_t b) {
40991         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
40992         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
40993         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
40994         return ret_conv;
40995 }
40996
40997 void  __attribute__((export_name("TS_FailureCode_free"))) TS_FailureCode_free(uint64_t this_ptr) {
40998         if (!ptr_is_owned(this_ptr)) return;
40999         void* this_ptr_ptr = untag_ptr(this_ptr);
41000         CHECK_ACCESS(this_ptr_ptr);
41001         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
41002         FREE(untag_ptr(this_ptr));
41003         FailureCode_free(this_ptr_conv);
41004 }
41005
41006 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
41007         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41008         *ret_copy = FailureCode_clone(arg);
41009         uint64_t ret_ref = tag_ptr(ret_copy, true);
41010         return ret_ref;
41011 }
41012 int64_t  __attribute__((export_name("TS_FailureCode_clone_ptr"))) TS_FailureCode_clone_ptr(uint64_t arg) {
41013         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
41014         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
41015         return ret_conv;
41016 }
41017
41018 uint64_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
41019         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
41020         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41021         *ret_copy = FailureCode_clone(orig_conv);
41022         uint64_t ret_ref = tag_ptr(ret_copy, true);
41023         return ret_ref;
41024 }
41025
41026 uint64_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
41027         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41028         *ret_copy = FailureCode_temporary_node_failure();
41029         uint64_t ret_ref = tag_ptr(ret_copy, true);
41030         return ret_ref;
41031 }
41032
41033 uint64_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
41034         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41035         *ret_copy = FailureCode_required_node_feature_missing();
41036         uint64_t ret_ref = tag_ptr(ret_copy, true);
41037         return ret_ref;
41038 }
41039
41040 uint64_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
41041         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41042         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
41043         uint64_t ret_ref = tag_ptr(ret_copy, true);
41044         return ret_ref;
41045 }
41046
41047 uint64_t  __attribute__((export_name("TS_FailureCode_invalid_onion_payload"))) TS_FailureCode_invalid_onion_payload(uint64_t a) {
41048         void* a_ptr = untag_ptr(a);
41049         CHECK_ACCESS(a_ptr);
41050         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
41051         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
41052         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41053         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
41054         uint64_t ret_ref = tag_ptr(ret_copy, true);
41055         return ret_ref;
41056 }
41057
41058 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
41059         LDKChannelManager this_obj_conv;
41060         this_obj_conv.inner = untag_ptr(this_obj);
41061         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41063         ChannelManager_free(this_obj_conv);
41064 }
41065
41066 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
41067         LDKChainParameters this_obj_conv;
41068         this_obj_conv.inner = untag_ptr(this_obj);
41069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41071         ChainParameters_free(this_obj_conv);
41072 }
41073
41074 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
41075         LDKChainParameters this_ptr_conv;
41076         this_ptr_conv.inner = untag_ptr(this_ptr);
41077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41079         this_ptr_conv.is_owned = false;
41080         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
41081         return ret_conv;
41082 }
41083
41084 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
41085         LDKChainParameters this_ptr_conv;
41086         this_ptr_conv.inner = untag_ptr(this_ptr);
41087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41089         this_ptr_conv.is_owned = false;
41090         LDKNetwork val_conv = LDKNetwork_from_js(val);
41091         ChainParameters_set_network(&this_ptr_conv, val_conv);
41092 }
41093
41094 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
41095         LDKChainParameters this_ptr_conv;
41096         this_ptr_conv.inner = untag_ptr(this_ptr);
41097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41099         this_ptr_conv.is_owned = false;
41100         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
41101         uint64_t ret_ref = 0;
41102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41104         return ret_ref;
41105 }
41106
41107 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
41108         LDKChainParameters this_ptr_conv;
41109         this_ptr_conv.inner = untag_ptr(this_ptr);
41110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41112         this_ptr_conv.is_owned = false;
41113         LDKBestBlock val_conv;
41114         val_conv.inner = untag_ptr(val);
41115         val_conv.is_owned = ptr_is_owned(val);
41116         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41117         val_conv = BestBlock_clone(&val_conv);
41118         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
41119 }
41120
41121 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
41122         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
41123         LDKBestBlock best_block_arg_conv;
41124         best_block_arg_conv.inner = untag_ptr(best_block_arg);
41125         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
41126         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
41127         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
41128         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
41129         uint64_t ret_ref = 0;
41130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41132         return ret_ref;
41133 }
41134
41135 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
41136         LDKChainParameters ret_var = ChainParameters_clone(arg);
41137         uint64_t ret_ref = 0;
41138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41140         return ret_ref;
41141 }
41142 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
41143         LDKChainParameters arg_conv;
41144         arg_conv.inner = untag_ptr(arg);
41145         arg_conv.is_owned = ptr_is_owned(arg);
41146         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41147         arg_conv.is_owned = false;
41148         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
41149         return ret_conv;
41150 }
41151
41152 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
41153         LDKChainParameters orig_conv;
41154         orig_conv.inner = untag_ptr(orig);
41155         orig_conv.is_owned = ptr_is_owned(orig);
41156         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41157         orig_conv.is_owned = false;
41158         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
41159         uint64_t ret_ref = 0;
41160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41162         return ret_ref;
41163 }
41164
41165 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
41166         if (!ptr_is_owned(this_ptr)) return;
41167         void* this_ptr_ptr = untag_ptr(this_ptr);
41168         CHECK_ACCESS(this_ptr_ptr);
41169         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
41170         FREE(untag_ptr(this_ptr));
41171         RecentPaymentDetails_free(this_ptr_conv);
41172 }
41173
41174 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
41175         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41176         *ret_copy = RecentPaymentDetails_clone(arg);
41177         uint64_t ret_ref = tag_ptr(ret_copy, true);
41178         return ret_ref;
41179 }
41180 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
41181         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
41182         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
41183         return ret_conv;
41184 }
41185
41186 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
41187         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
41188         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41189         *ret_copy = RecentPaymentDetails_clone(orig_conv);
41190         uint64_t ret_ref = tag_ptr(ret_copy, true);
41191         return ret_ref;
41192 }
41193
41194 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_awaiting_invoice"))) TS_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
41195         LDKThirtyTwoBytes payment_id_ref;
41196         CHECK(payment_id->arr_len == 32);
41197         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41198         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41199         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
41200         uint64_t ret_ref = tag_ptr(ret_copy, true);
41201         return ret_ref;
41202 }
41203
41204 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
41205         LDKThirtyTwoBytes payment_id_ref;
41206         CHECK(payment_id->arr_len == 32);
41207         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41208         LDKThirtyTwoBytes payment_hash_ref;
41209         CHECK(payment_hash->arr_len == 32);
41210         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41211         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41212         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
41213         uint64_t ret_ref = tag_ptr(ret_copy, true);
41214         return ret_ref;
41215 }
41216
41217 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_id, uint64_t payment_hash) {
41218         LDKThirtyTwoBytes payment_id_ref;
41219         CHECK(payment_id->arr_len == 32);
41220         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41221         void* payment_hash_ptr = untag_ptr(payment_hash);
41222         CHECK_ACCESS(payment_hash_ptr);
41223         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
41224         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
41225         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41226         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
41227         uint64_t ret_ref = tag_ptr(ret_copy, true);
41228         return ret_ref;
41229 }
41230
41231 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
41232         LDKThirtyTwoBytes payment_id_ref;
41233         CHECK(payment_id->arr_len == 32);
41234         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41235         LDKThirtyTwoBytes payment_hash_ref;
41236         CHECK(payment_hash->arr_len == 32);
41237         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41238         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41239         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
41240         uint64_t ret_ref = tag_ptr(ret_copy, true);
41241         return ret_ref;
41242 }
41243
41244 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
41245         LDKPhantomRouteHints this_obj_conv;
41246         this_obj_conv.inner = untag_ptr(this_obj);
41247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41249         PhantomRouteHints_free(this_obj_conv);
41250 }
41251
41252 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
41253         LDKPhantomRouteHints this_ptr_conv;
41254         this_ptr_conv.inner = untag_ptr(this_ptr);
41255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41257         this_ptr_conv.is_owned = false;
41258         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
41259         uint64_tArray ret_arr = NULL;
41260         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41261         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41262         for (size_t q = 0; q < ret_var.datalen; q++) {
41263                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41264                 uint64_t ret_conv_16_ref = 0;
41265                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41266                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41267                 ret_arr_ptr[q] = ret_conv_16_ref;
41268         }
41269         
41270         FREE(ret_var.data);
41271         return ret_arr;
41272 }
41273
41274 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
41275         LDKPhantomRouteHints this_ptr_conv;
41276         this_ptr_conv.inner = untag_ptr(this_ptr);
41277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41279         this_ptr_conv.is_owned = false;
41280         LDKCVec_ChannelDetailsZ val_constr;
41281         val_constr.datalen = val->arr_len;
41282         if (val_constr.datalen > 0)
41283                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41284         else
41285                 val_constr.data = NULL;
41286         uint64_t* val_vals = val->elems;
41287         for (size_t q = 0; q < val_constr.datalen; q++) {
41288                 uint64_t val_conv_16 = val_vals[q];
41289                 LDKChannelDetails val_conv_16_conv;
41290                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
41291                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
41292                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
41293                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
41294                 val_constr.data[q] = val_conv_16_conv;
41295         }
41296         FREE(val);
41297         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
41298 }
41299
41300 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
41301         LDKPhantomRouteHints this_ptr_conv;
41302         this_ptr_conv.inner = untag_ptr(this_ptr);
41303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41305         this_ptr_conv.is_owned = false;
41306         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
41307         return ret_conv;
41308 }
41309
41310 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
41311         LDKPhantomRouteHints this_ptr_conv;
41312         this_ptr_conv.inner = untag_ptr(this_ptr);
41313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41315         this_ptr_conv.is_owned = false;
41316         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
41317 }
41318
41319 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
41320         LDKPhantomRouteHints this_ptr_conv;
41321         this_ptr_conv.inner = untag_ptr(this_ptr);
41322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41324         this_ptr_conv.is_owned = false;
41325         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41326         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
41327         return ret_arr;
41328 }
41329
41330 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
41331         LDKPhantomRouteHints this_ptr_conv;
41332         this_ptr_conv.inner = untag_ptr(this_ptr);
41333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41335         this_ptr_conv.is_owned = false;
41336         LDKPublicKey val_ref;
41337         CHECK(val->arr_len == 33);
41338         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41339         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
41340 }
41341
41342 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) {
41343         LDKCVec_ChannelDetailsZ channels_arg_constr;
41344         channels_arg_constr.datalen = channels_arg->arr_len;
41345         if (channels_arg_constr.datalen > 0)
41346                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41347         else
41348                 channels_arg_constr.data = NULL;
41349         uint64_t* channels_arg_vals = channels_arg->elems;
41350         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
41351                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
41352                 LDKChannelDetails channels_arg_conv_16_conv;
41353                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
41354                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
41355                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
41356                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
41357                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
41358         }
41359         FREE(channels_arg);
41360         LDKPublicKey real_node_pubkey_arg_ref;
41361         CHECK(real_node_pubkey_arg->arr_len == 33);
41362         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
41363         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
41364         uint64_t ret_ref = 0;
41365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41367         return ret_ref;
41368 }
41369
41370 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
41371         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
41372         uint64_t ret_ref = 0;
41373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41375         return ret_ref;
41376 }
41377 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
41378         LDKPhantomRouteHints arg_conv;
41379         arg_conv.inner = untag_ptr(arg);
41380         arg_conv.is_owned = ptr_is_owned(arg);
41381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41382         arg_conv.is_owned = false;
41383         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
41384         return ret_conv;
41385 }
41386
41387 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
41388         LDKPhantomRouteHints orig_conv;
41389         orig_conv.inner = untag_ptr(orig);
41390         orig_conv.is_owned = ptr_is_owned(orig);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41392         orig_conv.is_owned = false;
41393         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
41394         uint64_t ret_ref = 0;
41395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41397         return ret_ref;
41398 }
41399
41400 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) {
41401         void* fee_est_ptr = untag_ptr(fee_est);
41402         CHECK_ACCESS(fee_est_ptr);
41403         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
41404         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
41405                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41406                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
41407         }
41408         void* chain_monitor_ptr = untag_ptr(chain_monitor);
41409         CHECK_ACCESS(chain_monitor_ptr);
41410         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
41411         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
41412                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41413                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
41414         }
41415         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
41416         CHECK_ACCESS(tx_broadcaster_ptr);
41417         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
41418         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41419                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41420                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
41421         }
41422         void* router_ptr = untag_ptr(router);
41423         CHECK_ACCESS(router_ptr);
41424         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41425         if (router_conv.free == LDKRouter_JCalls_free) {
41426                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41427                 LDKRouter_JCalls_cloned(&router_conv);
41428         }
41429         void* logger_ptr = untag_ptr(logger);
41430         CHECK_ACCESS(logger_ptr);
41431         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41432         if (logger_conv.free == LDKLogger_JCalls_free) {
41433                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41434                 LDKLogger_JCalls_cloned(&logger_conv);
41435         }
41436         void* entropy_source_ptr = untag_ptr(entropy_source);
41437         CHECK_ACCESS(entropy_source_ptr);
41438         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41439         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41440                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41441                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41442         }
41443         void* node_signer_ptr = untag_ptr(node_signer);
41444         CHECK_ACCESS(node_signer_ptr);
41445         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41446         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41447                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41448                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41449         }
41450         void* signer_provider_ptr = untag_ptr(signer_provider);
41451         CHECK_ACCESS(signer_provider_ptr);
41452         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41453         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41454                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41455                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41456         }
41457         LDKUserConfig config_conv;
41458         config_conv.inner = untag_ptr(config);
41459         config_conv.is_owned = ptr_is_owned(config);
41460         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41461         config_conv = UserConfig_clone(&config_conv);
41462         LDKChainParameters params_conv;
41463         params_conv.inner = untag_ptr(params);
41464         params_conv.is_owned = ptr_is_owned(params);
41465         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41466         params_conv = ChainParameters_clone(&params_conv);
41467         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);
41468         uint64_t ret_ref = 0;
41469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41471         return ret_ref;
41472 }
41473
41474 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
41475         LDKChannelManager this_arg_conv;
41476         this_arg_conv.inner = untag_ptr(this_arg);
41477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41479         this_arg_conv.is_owned = false;
41480         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
41481         uint64_t ret_ref = 0;
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41484         return ret_ref;
41485 }
41486
41487 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) {
41488         LDKChannelManager this_arg_conv;
41489         this_arg_conv.inner = untag_ptr(this_arg);
41490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41492         this_arg_conv.is_owned = false;
41493         LDKPublicKey their_network_key_ref;
41494         CHECK(their_network_key->arr_len == 33);
41495         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
41496         LDKU128 user_channel_id_ref;
41497         CHECK(user_channel_id->arr_len == 16);
41498         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
41499         LDKChannelId temporary_channel_id_conv;
41500         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
41501         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
41503         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
41504         LDKUserConfig override_config_conv;
41505         override_config_conv.inner = untag_ptr(override_config);
41506         override_config_conv.is_owned = ptr_is_owned(override_config);
41507         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
41508         override_config_conv = UserConfig_clone(&override_config_conv);
41509         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
41510         *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);
41511         return tag_ptr(ret_conv, true);
41512 }
41513
41514 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
41515         LDKChannelManager this_arg_conv;
41516         this_arg_conv.inner = untag_ptr(this_arg);
41517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41519         this_arg_conv.is_owned = false;
41520         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
41521         uint64_tArray ret_arr = NULL;
41522         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41523         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41524         for (size_t q = 0; q < ret_var.datalen; q++) {
41525                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41526                 uint64_t ret_conv_16_ref = 0;
41527                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41528                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41529                 ret_arr_ptr[q] = ret_conv_16_ref;
41530         }
41531         
41532         FREE(ret_var.data);
41533         return ret_arr;
41534 }
41535
41536 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
41537         LDKChannelManager this_arg_conv;
41538         this_arg_conv.inner = untag_ptr(this_arg);
41539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41541         this_arg_conv.is_owned = false;
41542         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
41543         uint64_tArray ret_arr = NULL;
41544         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41545         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41546         for (size_t q = 0; q < ret_var.datalen; q++) {
41547                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41548                 uint64_t ret_conv_16_ref = 0;
41549                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41550                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41551                 ret_arr_ptr[q] = ret_conv_16_ref;
41552         }
41553         
41554         FREE(ret_var.data);
41555         return ret_arr;
41556 }
41557
41558 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) {
41559         LDKChannelManager this_arg_conv;
41560         this_arg_conv.inner = untag_ptr(this_arg);
41561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41563         this_arg_conv.is_owned = false;
41564         LDKPublicKey counterparty_node_id_ref;
41565         CHECK(counterparty_node_id->arr_len == 33);
41566         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41567         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
41568         uint64_tArray ret_arr = NULL;
41569         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41570         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41571         for (size_t q = 0; q < ret_var.datalen; q++) {
41572                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41573                 uint64_t ret_conv_16_ref = 0;
41574                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41575                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41576                 ret_arr_ptr[q] = ret_conv_16_ref;
41577         }
41578         
41579         FREE(ret_var.data);
41580         return ret_arr;
41581 }
41582
41583 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
41584         LDKChannelManager this_arg_conv;
41585         this_arg_conv.inner = untag_ptr(this_arg);
41586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41588         this_arg_conv.is_owned = false;
41589         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
41590         uint64_tArray ret_arr = NULL;
41591         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41592         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41593         for (size_t w = 0; w < ret_var.datalen; w++) {
41594                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41595                 *ret_conv_22_copy = ret_var.data[w];
41596                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
41597                 ret_arr_ptr[w] = ret_conv_22_ref;
41598         }
41599         
41600         FREE(ret_var.data);
41601         return ret_arr;
41602 }
41603
41604 uint64_t  __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint64_t this_arg, uint64_t channel_id, int8_tArray counterparty_node_id) {
41605         LDKChannelManager this_arg_conv;
41606         this_arg_conv.inner = untag_ptr(this_arg);
41607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41609         this_arg_conv.is_owned = false;
41610         LDKChannelId channel_id_conv;
41611         channel_id_conv.inner = untag_ptr(channel_id);
41612         channel_id_conv.is_owned = ptr_is_owned(channel_id);
41613         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
41614         channel_id_conv.is_owned = false;
41615         LDKPublicKey counterparty_node_id_ref;
41616         CHECK(counterparty_node_id->arr_len == 33);
41617         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41618         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41619         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
41620         return tag_ptr(ret_conv, true);
41621 }
41622
41623 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, uint64_t channel_id, int8_tArray counterparty_node_id, uint64_t target_feerate_sats_per_1000_weight, uint64_t shutdown_script) {
41624         LDKChannelManager this_arg_conv;
41625         this_arg_conv.inner = untag_ptr(this_arg);
41626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41628         this_arg_conv.is_owned = false;
41629         LDKChannelId channel_id_conv;
41630         channel_id_conv.inner = untag_ptr(channel_id);
41631         channel_id_conv.is_owned = ptr_is_owned(channel_id);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
41633         channel_id_conv.is_owned = false;
41634         LDKPublicKey counterparty_node_id_ref;
41635         CHECK(counterparty_node_id->arr_len == 33);
41636         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41637         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
41638         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
41639         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
41640         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
41641         LDKShutdownScript shutdown_script_conv;
41642         shutdown_script_conv.inner = untag_ptr(shutdown_script);
41643         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
41644         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
41645         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
41646         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41647         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
41648         return tag_ptr(ret_conv, true);
41649 }
41650
41651 uint64_t  __attribute__((export_name("TS_ChannelManager_force_close_broadcasting_latest_txn"))) TS_ChannelManager_force_close_broadcasting_latest_txn(uint64_t this_arg, uint64_t channel_id, int8_tArray counterparty_node_id) {
41652         LDKChannelManager this_arg_conv;
41653         this_arg_conv.inner = untag_ptr(this_arg);
41654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41656         this_arg_conv.is_owned = false;
41657         LDKChannelId channel_id_conv;
41658         channel_id_conv.inner = untag_ptr(channel_id);
41659         channel_id_conv.is_owned = ptr_is_owned(channel_id);
41660         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
41661         channel_id_conv.is_owned = false;
41662         LDKPublicKey counterparty_node_id_ref;
41663         CHECK(counterparty_node_id->arr_len == 33);
41664         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41665         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41666         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
41667         return tag_ptr(ret_conv, true);
41668 }
41669
41670 uint64_t  __attribute__((export_name("TS_ChannelManager_force_close_without_broadcasting_txn"))) TS_ChannelManager_force_close_without_broadcasting_txn(uint64_t this_arg, uint64_t channel_id, int8_tArray counterparty_node_id) {
41671         LDKChannelManager this_arg_conv;
41672         this_arg_conv.inner = untag_ptr(this_arg);
41673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41675         this_arg_conv.is_owned = false;
41676         LDKChannelId channel_id_conv;
41677         channel_id_conv.inner = untag_ptr(channel_id);
41678         channel_id_conv.is_owned = ptr_is_owned(channel_id);
41679         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
41680         channel_id_conv.is_owned = false;
41681         LDKPublicKey counterparty_node_id_ref;
41682         CHECK(counterparty_node_id->arr_len == 33);
41683         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41684         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41685         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
41686         return tag_ptr(ret_conv, true);
41687 }
41688
41689 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) {
41690         LDKChannelManager this_arg_conv;
41691         this_arg_conv.inner = untag_ptr(this_arg);
41692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41694         this_arg_conv.is_owned = false;
41695         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
41696 }
41697
41698 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) {
41699         LDKChannelManager this_arg_conv;
41700         this_arg_conv.inner = untag_ptr(this_arg);
41701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41703         this_arg_conv.is_owned = false;
41704         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
41705 }
41706
41707 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) {
41708         LDKChannelManager this_arg_conv;
41709         this_arg_conv.inner = untag_ptr(this_arg);
41710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41712         this_arg_conv.is_owned = false;
41713         LDKRoute route_conv;
41714         route_conv.inner = untag_ptr(route);
41715         route_conv.is_owned = ptr_is_owned(route);
41716         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
41717         route_conv.is_owned = false;
41718         LDKThirtyTwoBytes payment_hash_ref;
41719         CHECK(payment_hash->arr_len == 32);
41720         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41721         LDKRecipientOnionFields recipient_onion_conv;
41722         recipient_onion_conv.inner = untag_ptr(recipient_onion);
41723         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
41725         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
41726         LDKThirtyTwoBytes payment_id_ref;
41727         CHECK(payment_id->arr_len == 32);
41728         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41729         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
41730         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
41731         return tag_ptr(ret_conv, true);
41732 }
41733
41734 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) {
41735         LDKChannelManager this_arg_conv;
41736         this_arg_conv.inner = untag_ptr(this_arg);
41737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41739         this_arg_conv.is_owned = false;
41740         LDKThirtyTwoBytes payment_hash_ref;
41741         CHECK(payment_hash->arr_len == 32);
41742         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41743         LDKRecipientOnionFields recipient_onion_conv;
41744         recipient_onion_conv.inner = untag_ptr(recipient_onion);
41745         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
41746         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
41747         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
41748         LDKThirtyTwoBytes payment_id_ref;
41749         CHECK(payment_id->arr_len == 32);
41750         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41751         LDKRouteParameters route_params_conv;
41752         route_params_conv.inner = untag_ptr(route_params);
41753         route_params_conv.is_owned = ptr_is_owned(route_params);
41754         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41755         route_params_conv = RouteParameters_clone(&route_params_conv);
41756         void* retry_strategy_ptr = untag_ptr(retry_strategy);
41757         CHECK_ACCESS(retry_strategy_ptr);
41758         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
41759         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
41760         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
41761         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
41762         return tag_ptr(ret_conv, true);
41763 }
41764
41765 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
41766         LDKChannelManager this_arg_conv;
41767         this_arg_conv.inner = untag_ptr(this_arg);
41768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41770         this_arg_conv.is_owned = false;
41771         LDKThirtyTwoBytes payment_id_ref;
41772         CHECK(payment_id->arr_len == 32);
41773         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41774         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
41775 }
41776
41777 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) {
41778         LDKChannelManager this_arg_conv;
41779         this_arg_conv.inner = untag_ptr(this_arg);
41780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41782         this_arg_conv.is_owned = false;
41783         LDKRoute route_conv;
41784         route_conv.inner = untag_ptr(route);
41785         route_conv.is_owned = ptr_is_owned(route);
41786         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
41787         route_conv.is_owned = false;
41788         void* payment_preimage_ptr = untag_ptr(payment_preimage);
41789         CHECK_ACCESS(payment_preimage_ptr);
41790         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
41791         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
41792         LDKRecipientOnionFields recipient_onion_conv;
41793         recipient_onion_conv.inner = untag_ptr(recipient_onion);
41794         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
41795         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
41796         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
41797         LDKThirtyTwoBytes payment_id_ref;
41798         CHECK(payment_id->arr_len == 32);
41799         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41800         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
41801         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
41802         return tag_ptr(ret_conv, true);
41803 }
41804
41805 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) {
41806         LDKChannelManager this_arg_conv;
41807         this_arg_conv.inner = untag_ptr(this_arg);
41808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41810         this_arg_conv.is_owned = false;
41811         void* payment_preimage_ptr = untag_ptr(payment_preimage);
41812         CHECK_ACCESS(payment_preimage_ptr);
41813         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
41814         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
41815         LDKRecipientOnionFields recipient_onion_conv;
41816         recipient_onion_conv.inner = untag_ptr(recipient_onion);
41817         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
41818         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
41819         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
41820         LDKThirtyTwoBytes payment_id_ref;
41821         CHECK(payment_id->arr_len == 32);
41822         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41823         LDKRouteParameters route_params_conv;
41824         route_params_conv.inner = untag_ptr(route_params);
41825         route_params_conv.is_owned = ptr_is_owned(route_params);
41826         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41827         route_params_conv = RouteParameters_clone(&route_params_conv);
41828         void* retry_strategy_ptr = untag_ptr(retry_strategy);
41829         CHECK_ACCESS(retry_strategy_ptr);
41830         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
41831         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
41832         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
41833         *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);
41834         return tag_ptr(ret_conv, true);
41835 }
41836
41837 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
41838         LDKChannelManager this_arg_conv;
41839         this_arg_conv.inner = untag_ptr(this_arg);
41840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41842         this_arg_conv.is_owned = false;
41843         LDKPath path_conv;
41844         path_conv.inner = untag_ptr(path);
41845         path_conv.is_owned = ptr_is_owned(path);
41846         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
41847         path_conv = Path_clone(&path_conv);
41848         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
41849         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
41850         return tag_ptr(ret_conv, true);
41851 }
41852
41853 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) {
41854         LDKChannelManager this_arg_conv;
41855         this_arg_conv.inner = untag_ptr(this_arg);
41856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41858         this_arg_conv.is_owned = false;
41859         LDKPublicKey node_id_ref;
41860         CHECK(node_id->arr_len == 33);
41861         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
41862         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
41863         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
41864         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
41865         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
41866         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
41867         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
41868         return tag_ptr(ret_conv, true);
41869 }
41870
41871 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) {
41872         LDKChannelManager this_arg_conv;
41873         this_arg_conv.inner = untag_ptr(this_arg);
41874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41876         this_arg_conv.is_owned = false;
41877         LDKRouteParameters route_params_conv;
41878         route_params_conv.inner = untag_ptr(route_params);
41879         route_params_conv.is_owned = ptr_is_owned(route_params);
41880         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
41881         route_params_conv = RouteParameters_clone(&route_params_conv);
41882         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
41883         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
41884         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
41885         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
41886         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
41887         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
41888         return tag_ptr(ret_conv, true);
41889 }
41890
41891 uint64_t  __attribute__((export_name("TS_ChannelManager_funding_transaction_generated"))) TS_ChannelManager_funding_transaction_generated(uint64_t this_arg, uint64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
41892         LDKChannelManager this_arg_conv;
41893         this_arg_conv.inner = untag_ptr(this_arg);
41894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41896         this_arg_conv.is_owned = false;
41897         LDKChannelId temporary_channel_id_conv;
41898         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
41899         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
41900         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
41901         temporary_channel_id_conv.is_owned = false;
41902         LDKPublicKey counterparty_node_id_ref;
41903         CHECK(counterparty_node_id->arr_len == 33);
41904         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41905         LDKTransaction funding_transaction_ref;
41906         funding_transaction_ref.datalen = funding_transaction->arr_len;
41907         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
41908         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
41909         funding_transaction_ref.data_is_owned = true;
41910         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41911         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
41912         return tag_ptr(ret_conv, true);
41913 }
41914
41915 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) {
41916         LDKChannelManager this_arg_conv;
41917         this_arg_conv.inner = untag_ptr(this_arg);
41918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41920         this_arg_conv.is_owned = false;
41921         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
41922         temporary_channels_constr.datalen = temporary_channels->arr_len;
41923         if (temporary_channels_constr.datalen > 0)
41924                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
41925         else
41926                 temporary_channels_constr.data = NULL;
41927         uint64_t* temporary_channels_vals = temporary_channels->elems;
41928         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
41929                 uint64_t temporary_channels_conv_30 = temporary_channels_vals[e];
41930                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
41931                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
41932                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
41933                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
41934                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
41935         }
41936         FREE(temporary_channels);
41937         LDKTransaction funding_transaction_ref;
41938         funding_transaction_ref.datalen = funding_transaction->arr_len;
41939         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
41940         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
41941         funding_transaction_ref.data_is_owned = true;
41942         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41943         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
41944         return tag_ptr(ret_conv, true);
41945 }
41946
41947 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, uint64_tArray channel_ids, uint64_t config_update) {
41948         LDKChannelManager this_arg_conv;
41949         this_arg_conv.inner = untag_ptr(this_arg);
41950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41952         this_arg_conv.is_owned = false;
41953         LDKPublicKey counterparty_node_id_ref;
41954         CHECK(counterparty_node_id->arr_len == 33);
41955         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41956         LDKCVec_ChannelIdZ channel_ids_constr;
41957         channel_ids_constr.datalen = channel_ids->arr_len;
41958         if (channel_ids_constr.datalen > 0)
41959                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
41960         else
41961                 channel_ids_constr.data = NULL;
41962         uint64_t* channel_ids_vals = channel_ids->elems;
41963         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
41964                 uint64_t channel_ids_conv_11 = channel_ids_vals[l];
41965                 LDKChannelId channel_ids_conv_11_conv;
41966                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
41967                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
41968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
41969                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
41970                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
41971         }
41972         FREE(channel_ids);
41973         LDKChannelConfigUpdate config_update_conv;
41974         config_update_conv.inner = untag_ptr(config_update);
41975         config_update_conv.is_owned = ptr_is_owned(config_update);
41976         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
41977         config_update_conv.is_owned = false;
41978         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
41979         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
41980         return tag_ptr(ret_conv, true);
41981 }
41982
41983 uint64_t  __attribute__((export_name("TS_ChannelManager_update_channel_config"))) TS_ChannelManager_update_channel_config(uint64_t this_arg, int8_tArray counterparty_node_id, uint64_tArray channel_ids, uint64_t config) {
41984         LDKChannelManager this_arg_conv;
41985         this_arg_conv.inner = untag_ptr(this_arg);
41986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41988         this_arg_conv.is_owned = false;
41989         LDKPublicKey counterparty_node_id_ref;
41990         CHECK(counterparty_node_id->arr_len == 33);
41991         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41992         LDKCVec_ChannelIdZ channel_ids_constr;
41993         channel_ids_constr.datalen = channel_ids->arr_len;
41994         if (channel_ids_constr.datalen > 0)
41995                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
41996         else
41997                 channel_ids_constr.data = NULL;
41998         uint64_t* channel_ids_vals = channel_ids->elems;
41999         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42000                 uint64_t channel_ids_conv_11 = channel_ids_vals[l];
42001                 LDKChannelId channel_ids_conv_11_conv;
42002                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42003                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42004                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42005                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42006                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42007         }
42008         FREE(channel_ids);
42009         LDKChannelConfig config_conv;
42010         config_conv.inner = untag_ptr(config);
42011         config_conv.is_owned = ptr_is_owned(config);
42012         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42013         config_conv.is_owned = false;
42014         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42015         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
42016         return tag_ptr(ret_conv, true);
42017 }
42018
42019 uint64_t  __attribute__((export_name("TS_ChannelManager_forward_intercepted_htlc"))) TS_ChannelManager_forward_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id, uint64_t next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
42020         LDKChannelManager this_arg_conv;
42021         this_arg_conv.inner = untag_ptr(this_arg);
42022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42024         this_arg_conv.is_owned = false;
42025         LDKThirtyTwoBytes intercept_id_ref;
42026         CHECK(intercept_id->arr_len == 32);
42027         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42028         LDKChannelId next_hop_channel_id_conv;
42029         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
42030         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
42031         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
42032         next_hop_channel_id_conv.is_owned = false;
42033         LDKPublicKey next_node_id_ref;
42034         CHECK(next_node_id->arr_len == 33);
42035         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
42036         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42037         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, &next_hop_channel_id_conv, next_node_id_ref, amt_to_forward_msat);
42038         return tag_ptr(ret_conv, true);
42039 }
42040
42041 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
42042         LDKChannelManager this_arg_conv;
42043         this_arg_conv.inner = untag_ptr(this_arg);
42044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42046         this_arg_conv.is_owned = false;
42047         LDKThirtyTwoBytes intercept_id_ref;
42048         CHECK(intercept_id->arr_len == 32);
42049         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42050         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42051         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
42052         return tag_ptr(ret_conv, true);
42053 }
42054
42055 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
42056         LDKChannelManager this_arg_conv;
42057         this_arg_conv.inner = untag_ptr(this_arg);
42058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42060         this_arg_conv.is_owned = false;
42061         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
42062 }
42063
42064 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
42065         LDKChannelManager this_arg_conv;
42066         this_arg_conv.inner = untag_ptr(this_arg);
42067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42069         this_arg_conv.is_owned = false;
42070         ChannelManager_timer_tick_occurred(&this_arg_conv);
42071 }
42072
42073 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
42074         LDKChannelManager this_arg_conv;
42075         this_arg_conv.inner = untag_ptr(this_arg);
42076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42078         this_arg_conv.is_owned = false;
42079         uint8_t payment_hash_arr[32];
42080         CHECK(payment_hash->arr_len == 32);
42081         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42082         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42083         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
42084 }
42085
42086 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) {
42087         LDKChannelManager this_arg_conv;
42088         this_arg_conv.inner = untag_ptr(this_arg);
42089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42091         this_arg_conv.is_owned = false;
42092         uint8_t payment_hash_arr[32];
42093         CHECK(payment_hash->arr_len == 32);
42094         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42095         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42096         void* failure_code_ptr = untag_ptr(failure_code);
42097         CHECK_ACCESS(failure_code_ptr);
42098         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
42099         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
42100         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
42101 }
42102
42103 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
42104         LDKChannelManager this_arg_conv;
42105         this_arg_conv.inner = untag_ptr(this_arg);
42106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42108         this_arg_conv.is_owned = false;
42109         LDKThirtyTwoBytes payment_preimage_ref;
42110         CHECK(payment_preimage->arr_len == 32);
42111         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42112         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
42113 }
42114
42115 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) {
42116         LDKChannelManager this_arg_conv;
42117         this_arg_conv.inner = untag_ptr(this_arg);
42118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42120         this_arg_conv.is_owned = false;
42121         LDKThirtyTwoBytes payment_preimage_ref;
42122         CHECK(payment_preimage->arr_len == 32);
42123         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42124         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
42125 }
42126
42127 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
42128         LDKChannelManager this_arg_conv;
42129         this_arg_conv.inner = untag_ptr(this_arg);
42130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42132         this_arg_conv.is_owned = false;
42133         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42134         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
42135         return ret_arr;
42136 }
42137
42138 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint64_t this_arg, uint64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
42139         LDKChannelManager this_arg_conv;
42140         this_arg_conv.inner = untag_ptr(this_arg);
42141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42143         this_arg_conv.is_owned = false;
42144         LDKChannelId temporary_channel_id_conv;
42145         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42146         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42147         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42148         temporary_channel_id_conv.is_owned = false;
42149         LDKPublicKey counterparty_node_id_ref;
42150         CHECK(counterparty_node_id->arr_len == 33);
42151         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42152         LDKU128 user_channel_id_ref;
42153         CHECK(user_channel_id->arr_len == 16);
42154         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42155         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42156         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
42157         return tag_ptr(ret_conv, true);
42158 }
42159
42160 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, uint64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
42161         LDKChannelManager this_arg_conv;
42162         this_arg_conv.inner = untag_ptr(this_arg);
42163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42165         this_arg_conv.is_owned = false;
42166         LDKChannelId temporary_channel_id_conv;
42167         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42168         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42170         temporary_channel_id_conv.is_owned = false;
42171         LDKPublicKey counterparty_node_id_ref;
42172         CHECK(counterparty_node_id->arr_len == 33);
42173         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42174         LDKU128 user_channel_id_ref;
42175         CHECK(user_channel_id->arr_len == 16);
42176         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42177         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42178         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
42179         return tag_ptr(ret_conv, true);
42180 }
42181
42182 uint64_t  __attribute__((export_name("TS_ChannelManager_create_offer_builder"))) TS_ChannelManager_create_offer_builder(uint64_t this_arg) {
42183         LDKChannelManager this_arg_conv;
42184         this_arg_conv.inner = untag_ptr(this_arg);
42185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42187         this_arg_conv.is_owned = false;
42188         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42189         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
42190         return tag_ptr(ret_conv, true);
42191 }
42192
42193 uint64_t  __attribute__((export_name("TS_ChannelManager_create_refund_builder"))) TS_ChannelManager_create_refund_builder(uint64_t this_arg, int64_t amount_msats, int64_t absolute_expiry, int8_tArray payment_id, uint64_t retry_strategy, uint64_t max_total_routing_fee_msat) {
42194         LDKChannelManager this_arg_conv;
42195         this_arg_conv.inner = untag_ptr(this_arg);
42196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42198         this_arg_conv.is_owned = false;
42199         LDKThirtyTwoBytes payment_id_ref;
42200         CHECK(payment_id->arr_len == 32);
42201         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42202         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42203         CHECK_ACCESS(retry_strategy_ptr);
42204         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42205         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42206         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42207         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42208         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42209         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42210         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42211         *ret_conv = ChannelManager_create_refund_builder(&this_arg_conv, amount_msats, absolute_expiry, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
42212         return tag_ptr(ret_conv, true);
42213 }
42214
42215 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) {
42216         LDKChannelManager this_arg_conv;
42217         this_arg_conv.inner = untag_ptr(this_arg);
42218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42220         this_arg_conv.is_owned = false;
42221         LDKOffer offer_conv;
42222         offer_conv.inner = untag_ptr(offer);
42223         offer_conv.is_owned = ptr_is_owned(offer);
42224         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
42225         offer_conv.is_owned = false;
42226         void* quantity_ptr = untag_ptr(quantity);
42227         CHECK_ACCESS(quantity_ptr);
42228         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
42229         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
42230         void* amount_msats_ptr = untag_ptr(amount_msats);
42231         CHECK_ACCESS(amount_msats_ptr);
42232         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
42233         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
42234         void* payer_note_ptr = untag_ptr(payer_note);
42235         CHECK_ACCESS(payer_note_ptr);
42236         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
42237         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
42238         LDKThirtyTwoBytes payment_id_ref;
42239         CHECK(payment_id->arr_len == 32);
42240         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42241         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42242         CHECK_ACCESS(retry_strategy_ptr);
42243         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42244         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42245         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42246         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42247         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42248         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42249         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
42250         *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);
42251         return tag_ptr(ret_conv, true);
42252 }
42253
42254 uint64_t  __attribute__((export_name("TS_ChannelManager_request_refund_payment"))) TS_ChannelManager_request_refund_payment(uint64_t this_arg, uint64_t refund) {
42255         LDKChannelManager this_arg_conv;
42256         this_arg_conv.inner = untag_ptr(this_arg);
42257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42259         this_arg_conv.is_owned = false;
42260         LDKRefund refund_conv;
42261         refund_conv.inner = untag_ptr(refund);
42262         refund_conv.is_owned = ptr_is_owned(refund);
42263         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
42264         refund_conv.is_owned = false;
42265         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
42266         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
42267         return tag_ptr(ret_conv, true);
42268 }
42269
42270 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) {
42271         LDKChannelManager this_arg_conv;
42272         this_arg_conv.inner = untag_ptr(this_arg);
42273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42275         this_arg_conv.is_owned = false;
42276         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42277         CHECK_ACCESS(min_value_msat_ptr);
42278         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42279         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42280         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42281         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42282         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42283         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42284         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
42285         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
42286         return tag_ptr(ret_conv, true);
42287 }
42288
42289 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) {
42290         LDKChannelManager this_arg_conv;
42291         this_arg_conv.inner = untag_ptr(this_arg);
42292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42294         this_arg_conv.is_owned = false;
42295         LDKThirtyTwoBytes payment_hash_ref;
42296         CHECK(payment_hash->arr_len == 32);
42297         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42298         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42299         CHECK_ACCESS(min_value_msat_ptr);
42300         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42301         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42302         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
42303         CHECK_ACCESS(min_final_cltv_expiry_ptr);
42304         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
42305         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
42306         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
42307         *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);
42308         return tag_ptr(ret_conv, true);
42309 }
42310
42311 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) {
42312         LDKChannelManager this_arg_conv;
42313         this_arg_conv.inner = untag_ptr(this_arg);
42314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42316         this_arg_conv.is_owned = false;
42317         LDKThirtyTwoBytes payment_hash_ref;
42318         CHECK(payment_hash->arr_len == 32);
42319         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42320         LDKThirtyTwoBytes payment_secret_ref;
42321         CHECK(payment_secret->arr_len == 32);
42322         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42323         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
42324         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
42325         return tag_ptr(ret_conv, true);
42326 }
42327
42328 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
42329         LDKChannelManager this_arg_conv;
42330         this_arg_conv.inner = untag_ptr(this_arg);
42331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42333         this_arg_conv.is_owned = false;
42334         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
42335         return ret_conv;
42336 }
42337
42338 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
42339         LDKChannelManager this_arg_conv;
42340         this_arg_conv.inner = untag_ptr(this_arg);
42341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42343         this_arg_conv.is_owned = false;
42344         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
42345         uint64_t ret_ref = 0;
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42348         return ret_ref;
42349 }
42350
42351 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
42352         LDKChannelManager this_arg_conv;
42353         this_arg_conv.inner = untag_ptr(this_arg);
42354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42356         this_arg_conv.is_owned = false;
42357         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
42358         return ret_conv;
42359 }
42360
42361 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
42362         LDKChannelManager this_arg_conv;
42363         this_arg_conv.inner = untag_ptr(this_arg);
42364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42366         this_arg_conv.is_owned = false;
42367         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
42368         uint64_t ret_ref = 0;
42369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42371         return ret_ref;
42372 }
42373
42374 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
42375         LDKChannelManager this_arg_conv;
42376         this_arg_conv.inner = untag_ptr(this_arg);
42377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42379         this_arg_conv.is_owned = false;
42380         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
42381         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
42382         return tag_ptr(ret_ret, true);
42383 }
42384
42385 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
42386         LDKChannelManager this_arg_conv;
42387         this_arg_conv.inner = untag_ptr(this_arg);
42388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42390         this_arg_conv.is_owned = false;
42391         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
42392         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
42393         return tag_ptr(ret_ret, true);
42394 }
42395
42396 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
42397         LDKChannelManager this_arg_conv;
42398         this_arg_conv.inner = untag_ptr(this_arg);
42399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42401         this_arg_conv.is_owned = false;
42402         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
42403         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
42404         return tag_ptr(ret_ret, true);
42405 }
42406
42407 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
42408         LDKChannelManager this_arg_conv;
42409         this_arg_conv.inner = untag_ptr(this_arg);
42410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42412         this_arg_conv.is_owned = false;
42413         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
42414         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
42415         return tag_ptr(ret_ret, true);
42416 }
42417
42418 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) {
42419         LDKChannelManager this_arg_conv;
42420         this_arg_conv.inner = untag_ptr(this_arg);
42421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42423         this_arg_conv.is_owned = false;
42424         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
42425         uint64_t ret_ref = 0;
42426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42428         return ret_ref;
42429 }
42430
42431 jboolean  __attribute__((export_name("TS_ChannelManager_get_and_clear_needs_persistence"))) TS_ChannelManager_get_and_clear_needs_persistence(uint64_t this_arg) {
42432         LDKChannelManager this_arg_conv;
42433         this_arg_conv.inner = untag_ptr(this_arg);
42434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42436         this_arg_conv.is_owned = false;
42437         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
42438         return ret_conv;
42439 }
42440
42441 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
42442         LDKChannelManager this_arg_conv;
42443         this_arg_conv.inner = untag_ptr(this_arg);
42444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42446         this_arg_conv.is_owned = false;
42447         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
42448         uint64_t ret_ref = 0;
42449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42451         return ret_ref;
42452 }
42453
42454 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
42455         LDKChannelManager this_arg_conv;
42456         this_arg_conv.inner = untag_ptr(this_arg);
42457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42459         this_arg_conv.is_owned = false;
42460         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
42461         uint64_t ret_ref = 0;
42462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42464         return ret_ref;
42465 }
42466
42467 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
42468         LDKChannelManager this_arg_conv;
42469         this_arg_conv.inner = untag_ptr(this_arg);
42470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42472         this_arg_conv.is_owned = false;
42473         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
42474         uint64_t ret_ref = 0;
42475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42477         return ret_ref;
42478 }
42479
42480 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
42481         LDKChannelManager this_arg_conv;
42482         this_arg_conv.inner = untag_ptr(this_arg);
42483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42485         this_arg_conv.is_owned = false;
42486         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
42487         uint64_t ret_ref = 0;
42488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42490         return ret_ref;
42491 }
42492
42493 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
42494         LDKChannelManager this_arg_conv;
42495         this_arg_conv.inner = untag_ptr(this_arg);
42496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42498         this_arg_conv.is_owned = false;
42499         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
42500         uint64_t ret_ref = 0;
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42503         return ret_ref;
42504 }
42505
42506 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
42507         LDKChannelManager this_arg_conv;
42508         this_arg_conv.inner = untag_ptr(this_arg);
42509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42511         this_arg_conv.is_owned = false;
42512         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
42513         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
42514         return tag_ptr(ret_ret, true);
42515 }
42516
42517 uint64_t  __attribute__((export_name("TS_ChannelManager_as_OffersMessageHandler"))) TS_ChannelManager_as_OffersMessageHandler(uint64_t this_arg) {
42518         LDKChannelManager this_arg_conv;
42519         this_arg_conv.inner = untag_ptr(this_arg);
42520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42522         this_arg_conv.is_owned = false;
42523         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
42524         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
42525         return tag_ptr(ret_ret, true);
42526 }
42527
42528 uint64_t  __attribute__((export_name("TS_ChannelManager_as_NodeIdLookUp"))) TS_ChannelManager_as_NodeIdLookUp(uint64_t this_arg) {
42529         LDKChannelManager this_arg_conv;
42530         this_arg_conv.inner = untag_ptr(this_arg);
42531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42533         this_arg_conv.is_owned = false;
42534         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
42535         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
42536         return tag_ptr(ret_ret, true);
42537 }
42538
42539 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
42540         LDKUserConfig config_conv;
42541         config_conv.inner = untag_ptr(config);
42542         config_conv.is_owned = ptr_is_owned(config);
42543         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42544         config_conv.is_owned = false;
42545         LDKInitFeatures ret_var = provided_init_features(&config_conv);
42546         uint64_t ret_ref = 0;
42547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42549         return ret_ref;
42550 }
42551
42552 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
42553         LDKPhantomRouteHints obj_conv;
42554         obj_conv.inner = untag_ptr(obj);
42555         obj_conv.is_owned = ptr_is_owned(obj);
42556         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42557         obj_conv.is_owned = false;
42558         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
42559         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42560         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42561         CVec_u8Z_free(ret_var);
42562         return ret_arr;
42563 }
42564
42565 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
42566         LDKu8slice ser_ref;
42567         ser_ref.datalen = ser->arr_len;
42568         ser_ref.data = ser->elems;
42569         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
42570         *ret_conv = PhantomRouteHints_read(ser_ref);
42571         FREE(ser);
42572         return tag_ptr(ret_conv, true);
42573 }
42574
42575 int8_tArray  __attribute__((export_name("TS_BlindedForward_write"))) TS_BlindedForward_write(uint64_t obj) {
42576         LDKBlindedForward obj_conv;
42577         obj_conv.inner = untag_ptr(obj);
42578         obj_conv.is_owned = ptr_is_owned(obj);
42579         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42580         obj_conv.is_owned = false;
42581         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
42582         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42583         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42584         CVec_u8Z_free(ret_var);
42585         return ret_arr;
42586 }
42587
42588 uint64_t  __attribute__((export_name("TS_BlindedForward_read"))) TS_BlindedForward_read(int8_tArray ser) {
42589         LDKu8slice ser_ref;
42590         ser_ref.datalen = ser->arr_len;
42591         ser_ref.data = ser->elems;
42592         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
42593         *ret_conv = BlindedForward_read(ser_ref);
42594         FREE(ser);
42595         return tag_ptr(ret_conv, true);
42596 }
42597
42598 int8_tArray  __attribute__((export_name("TS_PendingHTLCRouting_write"))) TS_PendingHTLCRouting_write(uint64_t obj) {
42599         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
42600         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
42601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42603         CVec_u8Z_free(ret_var);
42604         return ret_arr;
42605 }
42606
42607 uint64_t  __attribute__((export_name("TS_PendingHTLCRouting_read"))) TS_PendingHTLCRouting_read(int8_tArray ser) {
42608         LDKu8slice ser_ref;
42609         ser_ref.datalen = ser->arr_len;
42610         ser_ref.data = ser->elems;
42611         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
42612         *ret_conv = PendingHTLCRouting_read(ser_ref);
42613         FREE(ser);
42614         return tag_ptr(ret_conv, true);
42615 }
42616
42617 int8_tArray  __attribute__((export_name("TS_PendingHTLCInfo_write"))) TS_PendingHTLCInfo_write(uint64_t obj) {
42618         LDKPendingHTLCInfo obj_conv;
42619         obj_conv.inner = untag_ptr(obj);
42620         obj_conv.is_owned = ptr_is_owned(obj);
42621         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42622         obj_conv.is_owned = false;
42623         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
42624         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42625         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42626         CVec_u8Z_free(ret_var);
42627         return ret_arr;
42628 }
42629
42630 uint64_t  __attribute__((export_name("TS_PendingHTLCInfo_read"))) TS_PendingHTLCInfo_read(int8_tArray ser) {
42631         LDKu8slice ser_ref;
42632         ser_ref.datalen = ser->arr_len;
42633         ser_ref.data = ser->elems;
42634         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
42635         *ret_conv = PendingHTLCInfo_read(ser_ref);
42636         FREE(ser);
42637         return tag_ptr(ret_conv, true);
42638 }
42639
42640 int8_tArray  __attribute__((export_name("TS_BlindedFailure_write"))) TS_BlindedFailure_write(uint64_t obj) {
42641         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
42642         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
42643         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42644         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42645         CVec_u8Z_free(ret_var);
42646         return ret_arr;
42647 }
42648
42649 uint64_t  __attribute__((export_name("TS_BlindedFailure_read"))) TS_BlindedFailure_read(int8_tArray ser) {
42650         LDKu8slice ser_ref;
42651         ser_ref.datalen = ser->arr_len;
42652         ser_ref.data = ser->elems;
42653         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
42654         *ret_conv = BlindedFailure_read(ser_ref);
42655         FREE(ser);
42656         return tag_ptr(ret_conv, true);
42657 }
42658
42659 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
42660         LDKChannelManager obj_conv;
42661         obj_conv.inner = untag_ptr(obj);
42662         obj_conv.is_owned = ptr_is_owned(obj);
42663         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42664         obj_conv.is_owned = false;
42665         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
42666         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42667         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42668         CVec_u8Z_free(ret_var);
42669         return ret_arr;
42670 }
42671
42672 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
42673         LDKChannelManagerReadArgs this_obj_conv;
42674         this_obj_conv.inner = untag_ptr(this_obj);
42675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42677         ChannelManagerReadArgs_free(this_obj_conv);
42678 }
42679
42680 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
42681         LDKChannelManagerReadArgs this_ptr_conv;
42682         this_ptr_conv.inner = untag_ptr(this_ptr);
42683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42685         this_ptr_conv.is_owned = false;
42686         // WARNING: This object doesn't live past this scope, needs clone!
42687         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
42688         return ret_ret;
42689 }
42690
42691 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
42692         LDKChannelManagerReadArgs this_ptr_conv;
42693         this_ptr_conv.inner = untag_ptr(this_ptr);
42694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42696         this_ptr_conv.is_owned = false;
42697         void* val_ptr = untag_ptr(val);
42698         CHECK_ACCESS(val_ptr);
42699         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
42700         if (val_conv.free == LDKEntropySource_JCalls_free) {
42701                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42702                 LDKEntropySource_JCalls_cloned(&val_conv);
42703         }
42704         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
42705 }
42706
42707 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
42708         LDKChannelManagerReadArgs this_ptr_conv;
42709         this_ptr_conv.inner = untag_ptr(this_ptr);
42710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42712         this_ptr_conv.is_owned = false;
42713         // WARNING: This object doesn't live past this scope, needs clone!
42714         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
42715         return ret_ret;
42716 }
42717
42718 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
42719         LDKChannelManagerReadArgs this_ptr_conv;
42720         this_ptr_conv.inner = untag_ptr(this_ptr);
42721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42723         this_ptr_conv.is_owned = false;
42724         void* val_ptr = untag_ptr(val);
42725         CHECK_ACCESS(val_ptr);
42726         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
42727         if (val_conv.free == LDKNodeSigner_JCalls_free) {
42728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42729                 LDKNodeSigner_JCalls_cloned(&val_conv);
42730         }
42731         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
42732 }
42733
42734 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
42735         LDKChannelManagerReadArgs this_ptr_conv;
42736         this_ptr_conv.inner = untag_ptr(this_ptr);
42737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42739         this_ptr_conv.is_owned = false;
42740         // WARNING: This object doesn't live past this scope, needs clone!
42741         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
42742         return ret_ret;
42743 }
42744
42745 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
42746         LDKChannelManagerReadArgs this_ptr_conv;
42747         this_ptr_conv.inner = untag_ptr(this_ptr);
42748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42750         this_ptr_conv.is_owned = false;
42751         void* val_ptr = untag_ptr(val);
42752         CHECK_ACCESS(val_ptr);
42753         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
42754         if (val_conv.free == LDKSignerProvider_JCalls_free) {
42755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42756                 LDKSignerProvider_JCalls_cloned(&val_conv);
42757         }
42758         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
42759 }
42760
42761 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
42762         LDKChannelManagerReadArgs this_ptr_conv;
42763         this_ptr_conv.inner = untag_ptr(this_ptr);
42764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42766         this_ptr_conv.is_owned = false;
42767         // WARNING: This object doesn't live past this scope, needs clone!
42768         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
42769         return ret_ret;
42770 }
42771
42772 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
42773         LDKChannelManagerReadArgs this_ptr_conv;
42774         this_ptr_conv.inner = untag_ptr(this_ptr);
42775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42777         this_ptr_conv.is_owned = false;
42778         void* val_ptr = untag_ptr(val);
42779         CHECK_ACCESS(val_ptr);
42780         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
42781         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
42782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42783                 LDKFeeEstimator_JCalls_cloned(&val_conv);
42784         }
42785         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
42786 }
42787
42788 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
42789         LDKChannelManagerReadArgs this_ptr_conv;
42790         this_ptr_conv.inner = untag_ptr(this_ptr);
42791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42793         this_ptr_conv.is_owned = false;
42794         // WARNING: This object doesn't live past this scope, needs clone!
42795         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
42796         return ret_ret;
42797 }
42798
42799 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
42800         LDKChannelManagerReadArgs this_ptr_conv;
42801         this_ptr_conv.inner = untag_ptr(this_ptr);
42802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42804         this_ptr_conv.is_owned = false;
42805         void* val_ptr = untag_ptr(val);
42806         CHECK_ACCESS(val_ptr);
42807         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
42808         if (val_conv.free == LDKWatch_JCalls_free) {
42809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42810                 LDKWatch_JCalls_cloned(&val_conv);
42811         }
42812         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
42813 }
42814
42815 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
42816         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
42822         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
42823         return ret_ret;
42824 }
42825
42826 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
42827         LDKChannelManagerReadArgs this_ptr_conv;
42828         this_ptr_conv.inner = untag_ptr(this_ptr);
42829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42831         this_ptr_conv.is_owned = false;
42832         void* val_ptr = untag_ptr(val);
42833         CHECK_ACCESS(val_ptr);
42834         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
42835         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
42836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42837                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
42838         }
42839         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
42840 }
42841
42842 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
42843         LDKChannelManagerReadArgs this_ptr_conv;
42844         this_ptr_conv.inner = untag_ptr(this_ptr);
42845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42847         this_ptr_conv.is_owned = false;
42848         // WARNING: This object doesn't live past this scope, needs clone!
42849         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
42850         return ret_ret;
42851 }
42852
42853 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
42854         LDKChannelManagerReadArgs 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         void* val_ptr = untag_ptr(val);
42860         CHECK_ACCESS(val_ptr);
42861         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
42862         if (val_conv.free == LDKRouter_JCalls_free) {
42863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42864                 LDKRouter_JCalls_cloned(&val_conv);
42865         }
42866         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
42867 }
42868
42869 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
42870         LDKChannelManagerReadArgs this_ptr_conv;
42871         this_ptr_conv.inner = untag_ptr(this_ptr);
42872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42874         this_ptr_conv.is_owned = false;
42875         // WARNING: This object doesn't live past this scope, needs clone!
42876         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
42877         return ret_ret;
42878 }
42879
42880 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
42881         LDKChannelManagerReadArgs this_ptr_conv;
42882         this_ptr_conv.inner = untag_ptr(this_ptr);
42883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42885         this_ptr_conv.is_owned = false;
42886         void* val_ptr = untag_ptr(val);
42887         CHECK_ACCESS(val_ptr);
42888         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
42889         if (val_conv.free == LDKLogger_JCalls_free) {
42890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42891                 LDKLogger_JCalls_cloned(&val_conv);
42892         }
42893         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
42894 }
42895
42896 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
42897         LDKChannelManagerReadArgs this_ptr_conv;
42898         this_ptr_conv.inner = untag_ptr(this_ptr);
42899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42901         this_ptr_conv.is_owned = false;
42902         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
42903         uint64_t ret_ref = 0;
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42906         return ret_ref;
42907 }
42908
42909 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
42910         LDKChannelManagerReadArgs this_ptr_conv;
42911         this_ptr_conv.inner = untag_ptr(this_ptr);
42912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42914         this_ptr_conv.is_owned = false;
42915         LDKUserConfig val_conv;
42916         val_conv.inner = untag_ptr(val);
42917         val_conv.is_owned = ptr_is_owned(val);
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42919         val_conv = UserConfig_clone(&val_conv);
42920         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
42921 }
42922
42923 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) {
42924         void* entropy_source_ptr = untag_ptr(entropy_source);
42925         CHECK_ACCESS(entropy_source_ptr);
42926         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
42927         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
42928                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42929                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
42930         }
42931         void* node_signer_ptr = untag_ptr(node_signer);
42932         CHECK_ACCESS(node_signer_ptr);
42933         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
42934         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
42935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42936                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
42937         }
42938         void* signer_provider_ptr = untag_ptr(signer_provider);
42939         CHECK_ACCESS(signer_provider_ptr);
42940         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
42941         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
42942                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42943                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
42944         }
42945         void* fee_estimator_ptr = untag_ptr(fee_estimator);
42946         CHECK_ACCESS(fee_estimator_ptr);
42947         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
42948         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
42949                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42950                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
42951         }
42952         void* chain_monitor_ptr = untag_ptr(chain_monitor);
42953         CHECK_ACCESS(chain_monitor_ptr);
42954         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
42955         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
42956                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42957                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
42958         }
42959         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
42960         CHECK_ACCESS(tx_broadcaster_ptr);
42961         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
42962         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
42963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42964                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
42965         }
42966         void* router_ptr = untag_ptr(router);
42967         CHECK_ACCESS(router_ptr);
42968         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
42969         if (router_conv.free == LDKRouter_JCalls_free) {
42970                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42971                 LDKRouter_JCalls_cloned(&router_conv);
42972         }
42973         void* logger_ptr = untag_ptr(logger);
42974         CHECK_ACCESS(logger_ptr);
42975         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42976         if (logger_conv.free == LDKLogger_JCalls_free) {
42977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42978                 LDKLogger_JCalls_cloned(&logger_conv);
42979         }
42980         LDKUserConfig default_config_conv;
42981         default_config_conv.inner = untag_ptr(default_config);
42982         default_config_conv.is_owned = ptr_is_owned(default_config);
42983         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
42984         default_config_conv = UserConfig_clone(&default_config_conv);
42985         LDKCVec_ChannelMonitorZ channel_monitors_constr;
42986         channel_monitors_constr.datalen = channel_monitors->arr_len;
42987         if (channel_monitors_constr.datalen > 0)
42988                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
42989         else
42990                 channel_monitors_constr.data = NULL;
42991         uint64_t* channel_monitors_vals = channel_monitors->elems;
42992         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
42993                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
42994                 LDKChannelMonitor channel_monitors_conv_16_conv;
42995                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
42996                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
42997                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
42998                 channel_monitors_conv_16_conv.is_owned = false;
42999                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
43000         }
43001         FREE(channel_monitors);
43002         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);
43003         uint64_t ret_ref = 0;
43004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43006         return ret_ref;
43007 }
43008
43009 uint64_t  __attribute__((export_name("TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read"))) TS_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
43010         LDKu8slice ser_ref;
43011         ser_ref.datalen = ser->arr_len;
43012         ser_ref.data = ser->elems;
43013         LDKChannelManagerReadArgs arg_conv;
43014         arg_conv.inner = untag_ptr(arg);
43015         arg_conv.is_owned = ptr_is_owned(arg);
43016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43017         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
43018         
43019         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
43020         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
43021         FREE(ser);
43022         return tag_ptr(ret_conv, true);
43023 }
43024
43025 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_free"))) TS_DelayedPaymentBasepoint_free(uint64_t this_obj) {
43026         LDKDelayedPaymentBasepoint this_obj_conv;
43027         this_obj_conv.inner = untag_ptr(this_obj);
43028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43030         DelayedPaymentBasepoint_free(this_obj_conv);
43031 }
43032
43033 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_get_a"))) TS_DelayedPaymentBasepoint_get_a(uint64_t this_ptr) {
43034         LDKDelayedPaymentBasepoint this_ptr_conv;
43035         this_ptr_conv.inner = untag_ptr(this_ptr);
43036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43038         this_ptr_conv.is_owned = false;
43039         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43040         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43041         return ret_arr;
43042 }
43043
43044 void  __attribute__((export_name("TS_DelayedPaymentBasepoint_set_a"))) TS_DelayedPaymentBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43045         LDKDelayedPaymentBasepoint this_ptr_conv;
43046         this_ptr_conv.inner = untag_ptr(this_ptr);
43047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43049         this_ptr_conv.is_owned = false;
43050         LDKPublicKey val_ref;
43051         CHECK(val->arr_len == 33);
43052         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43053         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
43054 }
43055
43056 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_new"))) TS_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
43057         LDKPublicKey a_arg_ref;
43058         CHECK(a_arg->arr_len == 33);
43059         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43060         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
43061         uint64_t ret_ref = 0;
43062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43064         return ret_ref;
43065 }
43066
43067 jboolean  __attribute__((export_name("TS_DelayedPaymentBasepoint_eq"))) TS_DelayedPaymentBasepoint_eq(uint64_t a, uint64_t b) {
43068         LDKDelayedPaymentBasepoint a_conv;
43069         a_conv.inner = untag_ptr(a);
43070         a_conv.is_owned = ptr_is_owned(a);
43071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43072         a_conv.is_owned = false;
43073         LDKDelayedPaymentBasepoint b_conv;
43074         b_conv.inner = untag_ptr(b);
43075         b_conv.is_owned = ptr_is_owned(b);
43076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43077         b_conv.is_owned = false;
43078         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
43079         return ret_conv;
43080 }
43081
43082 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
43083         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
43084         uint64_t ret_ref = 0;
43085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43087         return ret_ref;
43088 }
43089 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone_ptr"))) TS_DelayedPaymentBasepoint_clone_ptr(uint64_t arg) {
43090         LDKDelayedPaymentBasepoint arg_conv;
43091         arg_conv.inner = untag_ptr(arg);
43092         arg_conv.is_owned = ptr_is_owned(arg);
43093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43094         arg_conv.is_owned = false;
43095         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
43096         return ret_conv;
43097 }
43098
43099 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_clone"))) TS_DelayedPaymentBasepoint_clone(uint64_t orig) {
43100         LDKDelayedPaymentBasepoint orig_conv;
43101         orig_conv.inner = untag_ptr(orig);
43102         orig_conv.is_owned = ptr_is_owned(orig);
43103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43104         orig_conv.is_owned = false;
43105         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
43106         uint64_t ret_ref = 0;
43107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43109         return ret_ref;
43110 }
43111
43112 int64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_hash"))) TS_DelayedPaymentBasepoint_hash(uint64_t o) {
43113         LDKDelayedPaymentBasepoint o_conv;
43114         o_conv.inner = untag_ptr(o);
43115         o_conv.is_owned = ptr_is_owned(o);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43117         o_conv.is_owned = false;
43118         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
43119         return ret_conv;
43120 }
43121
43122 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_to_public_key"))) TS_DelayedPaymentBasepoint_to_public_key(uint64_t this_arg) {
43123         LDKDelayedPaymentBasepoint this_arg_conv;
43124         this_arg_conv.inner = untag_ptr(this_arg);
43125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43127         this_arg_conv.is_owned = false;
43128         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43129         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43130         return ret_arr;
43131 }
43132
43133 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_derive_add_tweak"))) TS_DelayedPaymentBasepoint_derive_add_tweak(uint64_t this_arg, int8_tArray per_commitment_point) {
43134         LDKDelayedPaymentBasepoint this_arg_conv;
43135         this_arg_conv.inner = untag_ptr(this_arg);
43136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43138         this_arg_conv.is_owned = false;
43139         LDKPublicKey per_commitment_point_ref;
43140         CHECK(per_commitment_point->arr_len == 33);
43141         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43142         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43143         memcpy(ret_arr->elems, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43144         return ret_arr;
43145 }
43146
43147 int8_tArray  __attribute__((export_name("TS_DelayedPaymentBasepoint_write"))) TS_DelayedPaymentBasepoint_write(uint64_t obj) {
43148         LDKDelayedPaymentBasepoint obj_conv;
43149         obj_conv.inner = untag_ptr(obj);
43150         obj_conv.is_owned = ptr_is_owned(obj);
43151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43152         obj_conv.is_owned = false;
43153         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
43154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43156         CVec_u8Z_free(ret_var);
43157         return ret_arr;
43158 }
43159
43160 uint64_t  __attribute__((export_name("TS_DelayedPaymentBasepoint_read"))) TS_DelayedPaymentBasepoint_read(int8_tArray ser) {
43161         LDKu8slice ser_ref;
43162         ser_ref.datalen = ser->arr_len;
43163         ser_ref.data = ser->elems;
43164         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
43165         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
43166         FREE(ser);
43167         return tag_ptr(ret_conv, true);
43168 }
43169
43170 void  __attribute__((export_name("TS_DelayedPaymentKey_free"))) TS_DelayedPaymentKey_free(uint64_t this_obj) {
43171         LDKDelayedPaymentKey this_obj_conv;
43172         this_obj_conv.inner = untag_ptr(this_obj);
43173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43175         DelayedPaymentKey_free(this_obj_conv);
43176 }
43177
43178 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_get_a"))) TS_DelayedPaymentKey_get_a(uint64_t this_ptr) {
43179         LDKDelayedPaymentKey this_ptr_conv;
43180         this_ptr_conv.inner = untag_ptr(this_ptr);
43181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43183         this_ptr_conv.is_owned = false;
43184         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43185         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
43186         return ret_arr;
43187 }
43188
43189 void  __attribute__((export_name("TS_DelayedPaymentKey_set_a"))) TS_DelayedPaymentKey_set_a(uint64_t this_ptr, int8_tArray val) {
43190         LDKDelayedPaymentKey this_ptr_conv;
43191         this_ptr_conv.inner = untag_ptr(this_ptr);
43192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43194         this_ptr_conv.is_owned = false;
43195         LDKPublicKey val_ref;
43196         CHECK(val->arr_len == 33);
43197         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43198         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
43199 }
43200
43201 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_new"))) TS_DelayedPaymentKey_new(int8_tArray a_arg) {
43202         LDKPublicKey a_arg_ref;
43203         CHECK(a_arg->arr_len == 33);
43204         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43205         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
43206         uint64_t ret_ref = 0;
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43209         return ret_ref;
43210 }
43211
43212 jboolean  __attribute__((export_name("TS_DelayedPaymentKey_eq"))) TS_DelayedPaymentKey_eq(uint64_t a, uint64_t b) {
43213         LDKDelayedPaymentKey a_conv;
43214         a_conv.inner = untag_ptr(a);
43215         a_conv.is_owned = ptr_is_owned(a);
43216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43217         a_conv.is_owned = false;
43218         LDKDelayedPaymentKey b_conv;
43219         b_conv.inner = untag_ptr(b);
43220         b_conv.is_owned = ptr_is_owned(b);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43222         b_conv.is_owned = false;
43223         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
43224         return ret_conv;
43225 }
43226
43227 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
43228         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
43229         uint64_t ret_ref = 0;
43230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43232         return ret_ref;
43233 }
43234 int64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone_ptr"))) TS_DelayedPaymentKey_clone_ptr(uint64_t arg) {
43235         LDKDelayedPaymentKey arg_conv;
43236         arg_conv.inner = untag_ptr(arg);
43237         arg_conv.is_owned = ptr_is_owned(arg);
43238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43239         arg_conv.is_owned = false;
43240         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
43241         return ret_conv;
43242 }
43243
43244 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_clone"))) TS_DelayedPaymentKey_clone(uint64_t orig) {
43245         LDKDelayedPaymentKey orig_conv;
43246         orig_conv.inner = untag_ptr(orig);
43247         orig_conv.is_owned = ptr_is_owned(orig);
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43249         orig_conv.is_owned = false;
43250         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
43251         uint64_t ret_ref = 0;
43252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43254         return ret_ref;
43255 }
43256
43257 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_basepoint"))) TS_DelayedPaymentKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43258         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
43259         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43260         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43261         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43262         countersignatory_basepoint_conv.is_owned = false;
43263         LDKPublicKey per_commitment_point_ref;
43264         CHECK(per_commitment_point->arr_len == 33);
43265         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43266         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
43267         uint64_t ret_ref = 0;
43268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43270         return ret_ref;
43271 }
43272
43273 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_from_secret_key"))) TS_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
43274         uint8_t sk_arr[32];
43275         CHECK(sk->arr_len == 32);
43276         memcpy(sk_arr, sk->elems, 32); FREE(sk);
43277         uint8_t (*sk_ref)[32] = &sk_arr;
43278         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
43279         uint64_t ret_ref = 0;
43280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43282         return ret_ref;
43283 }
43284
43285 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_to_public_key"))) TS_DelayedPaymentKey_to_public_key(uint64_t this_arg) {
43286         LDKDelayedPaymentKey this_arg_conv;
43287         this_arg_conv.inner = untag_ptr(this_arg);
43288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43290         this_arg_conv.is_owned = false;
43291         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43292         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
43293         return ret_arr;
43294 }
43295
43296 int8_tArray  __attribute__((export_name("TS_DelayedPaymentKey_write"))) TS_DelayedPaymentKey_write(uint64_t obj) {
43297         LDKDelayedPaymentKey obj_conv;
43298         obj_conv.inner = untag_ptr(obj);
43299         obj_conv.is_owned = ptr_is_owned(obj);
43300         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43301         obj_conv.is_owned = false;
43302         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
43303         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43304         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43305         CVec_u8Z_free(ret_var);
43306         return ret_arr;
43307 }
43308
43309 uint64_t  __attribute__((export_name("TS_DelayedPaymentKey_read"))) TS_DelayedPaymentKey_read(int8_tArray ser) {
43310         LDKu8slice ser_ref;
43311         ser_ref.datalen = ser->arr_len;
43312         ser_ref.data = ser->elems;
43313         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
43314         *ret_conv = DelayedPaymentKey_read(ser_ref);
43315         FREE(ser);
43316         return tag_ptr(ret_conv, true);
43317 }
43318
43319 void  __attribute__((export_name("TS_HtlcBasepoint_free"))) TS_HtlcBasepoint_free(uint64_t this_obj) {
43320         LDKHtlcBasepoint this_obj_conv;
43321         this_obj_conv.inner = untag_ptr(this_obj);
43322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43324         HtlcBasepoint_free(this_obj_conv);
43325 }
43326
43327 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_get_a"))) TS_HtlcBasepoint_get_a(uint64_t this_ptr) {
43328         LDKHtlcBasepoint this_ptr_conv;
43329         this_ptr_conv.inner = untag_ptr(this_ptr);
43330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43332         this_ptr_conv.is_owned = false;
43333         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43334         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43335         return ret_arr;
43336 }
43337
43338 void  __attribute__((export_name("TS_HtlcBasepoint_set_a"))) TS_HtlcBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43339         LDKHtlcBasepoint this_ptr_conv;
43340         this_ptr_conv.inner = untag_ptr(this_ptr);
43341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43343         this_ptr_conv.is_owned = false;
43344         LDKPublicKey val_ref;
43345         CHECK(val->arr_len == 33);
43346         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43347         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
43348 }
43349
43350 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_new"))) TS_HtlcBasepoint_new(int8_tArray a_arg) {
43351         LDKPublicKey a_arg_ref;
43352         CHECK(a_arg->arr_len == 33);
43353         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43354         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
43355         uint64_t ret_ref = 0;
43356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43358         return ret_ref;
43359 }
43360
43361 jboolean  __attribute__((export_name("TS_HtlcBasepoint_eq"))) TS_HtlcBasepoint_eq(uint64_t a, uint64_t b) {
43362         LDKHtlcBasepoint a_conv;
43363         a_conv.inner = untag_ptr(a);
43364         a_conv.is_owned = ptr_is_owned(a);
43365         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43366         a_conv.is_owned = false;
43367         LDKHtlcBasepoint b_conv;
43368         b_conv.inner = untag_ptr(b);
43369         b_conv.is_owned = ptr_is_owned(b);
43370         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43371         b_conv.is_owned = false;
43372         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
43373         return ret_conv;
43374 }
43375
43376 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
43377         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
43378         uint64_t ret_ref = 0;
43379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43381         return ret_ref;
43382 }
43383 int64_t  __attribute__((export_name("TS_HtlcBasepoint_clone_ptr"))) TS_HtlcBasepoint_clone_ptr(uint64_t arg) {
43384         LDKHtlcBasepoint arg_conv;
43385         arg_conv.inner = untag_ptr(arg);
43386         arg_conv.is_owned = ptr_is_owned(arg);
43387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43388         arg_conv.is_owned = false;
43389         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
43390         return ret_conv;
43391 }
43392
43393 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_clone"))) TS_HtlcBasepoint_clone(uint64_t orig) {
43394         LDKHtlcBasepoint orig_conv;
43395         orig_conv.inner = untag_ptr(orig);
43396         orig_conv.is_owned = ptr_is_owned(orig);
43397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43398         orig_conv.is_owned = false;
43399         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
43400         uint64_t ret_ref = 0;
43401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43403         return ret_ref;
43404 }
43405
43406 int64_t  __attribute__((export_name("TS_HtlcBasepoint_hash"))) TS_HtlcBasepoint_hash(uint64_t o) {
43407         LDKHtlcBasepoint o_conv;
43408         o_conv.inner = untag_ptr(o);
43409         o_conv.is_owned = ptr_is_owned(o);
43410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43411         o_conv.is_owned = false;
43412         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
43413         return ret_conv;
43414 }
43415
43416 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_to_public_key"))) TS_HtlcBasepoint_to_public_key(uint64_t this_arg) {
43417         LDKHtlcBasepoint this_arg_conv;
43418         this_arg_conv.inner = untag_ptr(this_arg);
43419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43421         this_arg_conv.is_owned = false;
43422         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43423         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43424         return ret_arr;
43425 }
43426
43427 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_derive_add_tweak"))) TS_HtlcBasepoint_derive_add_tweak(uint64_t this_arg, int8_tArray per_commitment_point) {
43428         LDKHtlcBasepoint this_arg_conv;
43429         this_arg_conv.inner = untag_ptr(this_arg);
43430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43432         this_arg_conv.is_owned = false;
43433         LDKPublicKey per_commitment_point_ref;
43434         CHECK(per_commitment_point->arr_len == 33);
43435         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43436         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43437         memcpy(ret_arr->elems, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43438         return ret_arr;
43439 }
43440
43441 int8_tArray  __attribute__((export_name("TS_HtlcBasepoint_write"))) TS_HtlcBasepoint_write(uint64_t obj) {
43442         LDKHtlcBasepoint obj_conv;
43443         obj_conv.inner = untag_ptr(obj);
43444         obj_conv.is_owned = ptr_is_owned(obj);
43445         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43446         obj_conv.is_owned = false;
43447         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
43448         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43449         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43450         CVec_u8Z_free(ret_var);
43451         return ret_arr;
43452 }
43453
43454 uint64_t  __attribute__((export_name("TS_HtlcBasepoint_read"))) TS_HtlcBasepoint_read(int8_tArray ser) {
43455         LDKu8slice ser_ref;
43456         ser_ref.datalen = ser->arr_len;
43457         ser_ref.data = ser->elems;
43458         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
43459         *ret_conv = HtlcBasepoint_read(ser_ref);
43460         FREE(ser);
43461         return tag_ptr(ret_conv, true);
43462 }
43463
43464 void  __attribute__((export_name("TS_HtlcKey_free"))) TS_HtlcKey_free(uint64_t this_obj) {
43465         LDKHtlcKey this_obj_conv;
43466         this_obj_conv.inner = untag_ptr(this_obj);
43467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43469         HtlcKey_free(this_obj_conv);
43470 }
43471
43472 int8_tArray  __attribute__((export_name("TS_HtlcKey_get_a"))) TS_HtlcKey_get_a(uint64_t this_ptr) {
43473         LDKHtlcKey this_ptr_conv;
43474         this_ptr_conv.inner = untag_ptr(this_ptr);
43475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43477         this_ptr_conv.is_owned = false;
43478         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43479         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
43480         return ret_arr;
43481 }
43482
43483 void  __attribute__((export_name("TS_HtlcKey_set_a"))) TS_HtlcKey_set_a(uint64_t this_ptr, int8_tArray val) {
43484         LDKHtlcKey this_ptr_conv;
43485         this_ptr_conv.inner = untag_ptr(this_ptr);
43486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43488         this_ptr_conv.is_owned = false;
43489         LDKPublicKey val_ref;
43490         CHECK(val->arr_len == 33);
43491         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43492         HtlcKey_set_a(&this_ptr_conv, val_ref);
43493 }
43494
43495 uint64_t  __attribute__((export_name("TS_HtlcKey_new"))) TS_HtlcKey_new(int8_tArray a_arg) {
43496         LDKPublicKey a_arg_ref;
43497         CHECK(a_arg->arr_len == 33);
43498         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43499         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
43500         uint64_t ret_ref = 0;
43501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43503         return ret_ref;
43504 }
43505
43506 jboolean  __attribute__((export_name("TS_HtlcKey_eq"))) TS_HtlcKey_eq(uint64_t a, uint64_t b) {
43507         LDKHtlcKey a_conv;
43508         a_conv.inner = untag_ptr(a);
43509         a_conv.is_owned = ptr_is_owned(a);
43510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43511         a_conv.is_owned = false;
43512         LDKHtlcKey b_conv;
43513         b_conv.inner = untag_ptr(b);
43514         b_conv.is_owned = ptr_is_owned(b);
43515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43516         b_conv.is_owned = false;
43517         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
43518         return ret_conv;
43519 }
43520
43521 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
43522         LDKHtlcKey ret_var = HtlcKey_clone(arg);
43523         uint64_t ret_ref = 0;
43524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43526         return ret_ref;
43527 }
43528 int64_t  __attribute__((export_name("TS_HtlcKey_clone_ptr"))) TS_HtlcKey_clone_ptr(uint64_t arg) {
43529         LDKHtlcKey arg_conv;
43530         arg_conv.inner = untag_ptr(arg);
43531         arg_conv.is_owned = ptr_is_owned(arg);
43532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43533         arg_conv.is_owned = false;
43534         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
43535         return ret_conv;
43536 }
43537
43538 uint64_t  __attribute__((export_name("TS_HtlcKey_clone"))) TS_HtlcKey_clone(uint64_t orig) {
43539         LDKHtlcKey orig_conv;
43540         orig_conv.inner = untag_ptr(orig);
43541         orig_conv.is_owned = ptr_is_owned(orig);
43542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43543         orig_conv.is_owned = false;
43544         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
43545         uint64_t ret_ref = 0;
43546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43548         return ret_ref;
43549 }
43550
43551 uint64_t  __attribute__((export_name("TS_HtlcKey_from_basepoint"))) TS_HtlcKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43552         LDKHtlcBasepoint countersignatory_basepoint_conv;
43553         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43554         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43555         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43556         countersignatory_basepoint_conv.is_owned = false;
43557         LDKPublicKey per_commitment_point_ref;
43558         CHECK(per_commitment_point->arr_len == 33);
43559         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43560         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
43561         uint64_t ret_ref = 0;
43562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43564         return ret_ref;
43565 }
43566
43567 uint64_t  __attribute__((export_name("TS_HtlcKey_from_secret_key"))) TS_HtlcKey_from_secret_key(int8_tArray sk) {
43568         uint8_t sk_arr[32];
43569         CHECK(sk->arr_len == 32);
43570         memcpy(sk_arr, sk->elems, 32); FREE(sk);
43571         uint8_t (*sk_ref)[32] = &sk_arr;
43572         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
43573         uint64_t ret_ref = 0;
43574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43576         return ret_ref;
43577 }
43578
43579 int8_tArray  __attribute__((export_name("TS_HtlcKey_to_public_key"))) TS_HtlcKey_to_public_key(uint64_t this_arg) {
43580         LDKHtlcKey this_arg_conv;
43581         this_arg_conv.inner = untag_ptr(this_arg);
43582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43584         this_arg_conv.is_owned = false;
43585         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43586         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
43587         return ret_arr;
43588 }
43589
43590 int8_tArray  __attribute__((export_name("TS_HtlcKey_write"))) TS_HtlcKey_write(uint64_t obj) {
43591         LDKHtlcKey obj_conv;
43592         obj_conv.inner = untag_ptr(obj);
43593         obj_conv.is_owned = ptr_is_owned(obj);
43594         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43595         obj_conv.is_owned = false;
43596         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
43597         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43598         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43599         CVec_u8Z_free(ret_var);
43600         return ret_arr;
43601 }
43602
43603 uint64_t  __attribute__((export_name("TS_HtlcKey_read"))) TS_HtlcKey_read(int8_tArray ser) {
43604         LDKu8slice ser_ref;
43605         ser_ref.datalen = ser->arr_len;
43606         ser_ref.data = ser->elems;
43607         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
43608         *ret_conv = HtlcKey_read(ser_ref);
43609         FREE(ser);
43610         return tag_ptr(ret_conv, true);
43611 }
43612
43613 int8_tArray  __attribute__((export_name("TS_add_public_key_tweak"))) TS_add_public_key_tweak(int8_tArray base_point, int8_tArray tweak) {
43614         LDKPublicKey base_point_ref;
43615         CHECK(base_point->arr_len == 33);
43616         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
43617         uint8_t tweak_arr[32];
43618         CHECK(tweak->arr_len == 32);
43619         memcpy(tweak_arr, tweak->elems, 32); FREE(tweak);
43620         uint8_t (*tweak_ref)[32] = &tweak_arr;
43621         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43622         memcpy(ret_arr->elems, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form, 33);
43623         return ret_arr;
43624 }
43625
43626 void  __attribute__((export_name("TS_RevocationBasepoint_free"))) TS_RevocationBasepoint_free(uint64_t this_obj) {
43627         LDKRevocationBasepoint this_obj_conv;
43628         this_obj_conv.inner = untag_ptr(this_obj);
43629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43631         RevocationBasepoint_free(this_obj_conv);
43632 }
43633
43634 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_get_a"))) TS_RevocationBasepoint_get_a(uint64_t this_ptr) {
43635         LDKRevocationBasepoint this_ptr_conv;
43636         this_ptr_conv.inner = untag_ptr(this_ptr);
43637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43639         this_ptr_conv.is_owned = false;
43640         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43641         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43642         return ret_arr;
43643 }
43644
43645 void  __attribute__((export_name("TS_RevocationBasepoint_set_a"))) TS_RevocationBasepoint_set_a(uint64_t this_ptr, int8_tArray val) {
43646         LDKRevocationBasepoint this_ptr_conv;
43647         this_ptr_conv.inner = untag_ptr(this_ptr);
43648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43650         this_ptr_conv.is_owned = false;
43651         LDKPublicKey val_ref;
43652         CHECK(val->arr_len == 33);
43653         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43654         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
43655 }
43656
43657 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_new"))) TS_RevocationBasepoint_new(int8_tArray a_arg) {
43658         LDKPublicKey a_arg_ref;
43659         CHECK(a_arg->arr_len == 33);
43660         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43661         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
43662         uint64_t ret_ref = 0;
43663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43665         return ret_ref;
43666 }
43667
43668 jboolean  __attribute__((export_name("TS_RevocationBasepoint_eq"))) TS_RevocationBasepoint_eq(uint64_t a, uint64_t b) {
43669         LDKRevocationBasepoint a_conv;
43670         a_conv.inner = untag_ptr(a);
43671         a_conv.is_owned = ptr_is_owned(a);
43672         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43673         a_conv.is_owned = false;
43674         LDKRevocationBasepoint b_conv;
43675         b_conv.inner = untag_ptr(b);
43676         b_conv.is_owned = ptr_is_owned(b);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43678         b_conv.is_owned = false;
43679         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
43680         return ret_conv;
43681 }
43682
43683 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
43684         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
43685         uint64_t ret_ref = 0;
43686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43688         return ret_ref;
43689 }
43690 int64_t  __attribute__((export_name("TS_RevocationBasepoint_clone_ptr"))) TS_RevocationBasepoint_clone_ptr(uint64_t arg) {
43691         LDKRevocationBasepoint arg_conv;
43692         arg_conv.inner = untag_ptr(arg);
43693         arg_conv.is_owned = ptr_is_owned(arg);
43694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43695         arg_conv.is_owned = false;
43696         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
43697         return ret_conv;
43698 }
43699
43700 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_clone"))) TS_RevocationBasepoint_clone(uint64_t orig) {
43701         LDKRevocationBasepoint orig_conv;
43702         orig_conv.inner = untag_ptr(orig);
43703         orig_conv.is_owned = ptr_is_owned(orig);
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43705         orig_conv.is_owned = false;
43706         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
43707         uint64_t ret_ref = 0;
43708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43710         return ret_ref;
43711 }
43712
43713 int64_t  __attribute__((export_name("TS_RevocationBasepoint_hash"))) TS_RevocationBasepoint_hash(uint64_t o) {
43714         LDKRevocationBasepoint o_conv;
43715         o_conv.inner = untag_ptr(o);
43716         o_conv.is_owned = ptr_is_owned(o);
43717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43718         o_conv.is_owned = false;
43719         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
43720         return ret_conv;
43721 }
43722
43723 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_to_public_key"))) TS_RevocationBasepoint_to_public_key(uint64_t this_arg) {
43724         LDKRevocationBasepoint this_arg_conv;
43725         this_arg_conv.inner = untag_ptr(this_arg);
43726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43728         this_arg_conv.is_owned = false;
43729         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43730         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43731         return ret_arr;
43732 }
43733
43734 int8_tArray  __attribute__((export_name("TS_RevocationBasepoint_write"))) TS_RevocationBasepoint_write(uint64_t obj) {
43735         LDKRevocationBasepoint obj_conv;
43736         obj_conv.inner = untag_ptr(obj);
43737         obj_conv.is_owned = ptr_is_owned(obj);
43738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43739         obj_conv.is_owned = false;
43740         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
43741         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43742         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43743         CVec_u8Z_free(ret_var);
43744         return ret_arr;
43745 }
43746
43747 uint64_t  __attribute__((export_name("TS_RevocationBasepoint_read"))) TS_RevocationBasepoint_read(int8_tArray ser) {
43748         LDKu8slice ser_ref;
43749         ser_ref.datalen = ser->arr_len;
43750         ser_ref.data = ser->elems;
43751         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
43752         *ret_conv = RevocationBasepoint_read(ser_ref);
43753         FREE(ser);
43754         return tag_ptr(ret_conv, true);
43755 }
43756
43757 void  __attribute__((export_name("TS_RevocationKey_free"))) TS_RevocationKey_free(uint64_t this_obj) {
43758         LDKRevocationKey this_obj_conv;
43759         this_obj_conv.inner = untag_ptr(this_obj);
43760         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43762         RevocationKey_free(this_obj_conv);
43763 }
43764
43765 int8_tArray  __attribute__((export_name("TS_RevocationKey_get_a"))) TS_RevocationKey_get_a(uint64_t this_ptr) {
43766         LDKRevocationKey this_ptr_conv;
43767         this_ptr_conv.inner = untag_ptr(this_ptr);
43768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43770         this_ptr_conv.is_owned = false;
43771         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43772         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
43773         return ret_arr;
43774 }
43775
43776 void  __attribute__((export_name("TS_RevocationKey_set_a"))) TS_RevocationKey_set_a(uint64_t this_ptr, int8_tArray val) {
43777         LDKRevocationKey this_ptr_conv;
43778         this_ptr_conv.inner = untag_ptr(this_ptr);
43779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43781         this_ptr_conv.is_owned = false;
43782         LDKPublicKey val_ref;
43783         CHECK(val->arr_len == 33);
43784         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43785         RevocationKey_set_a(&this_ptr_conv, val_ref);
43786 }
43787
43788 uint64_t  __attribute__((export_name("TS_RevocationKey_new"))) TS_RevocationKey_new(int8_tArray a_arg) {
43789         LDKPublicKey a_arg_ref;
43790         CHECK(a_arg->arr_len == 33);
43791         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43792         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
43793         uint64_t ret_ref = 0;
43794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43796         return ret_ref;
43797 }
43798
43799 jboolean  __attribute__((export_name("TS_RevocationKey_eq"))) TS_RevocationKey_eq(uint64_t a, uint64_t b) {
43800         LDKRevocationKey a_conv;
43801         a_conv.inner = untag_ptr(a);
43802         a_conv.is_owned = ptr_is_owned(a);
43803         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43804         a_conv.is_owned = false;
43805         LDKRevocationKey b_conv;
43806         b_conv.inner = untag_ptr(b);
43807         b_conv.is_owned = ptr_is_owned(b);
43808         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43809         b_conv.is_owned = false;
43810         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
43811         return ret_conv;
43812 }
43813
43814 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
43815         LDKRevocationKey ret_var = RevocationKey_clone(arg);
43816         uint64_t ret_ref = 0;
43817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43819         return ret_ref;
43820 }
43821 int64_t  __attribute__((export_name("TS_RevocationKey_clone_ptr"))) TS_RevocationKey_clone_ptr(uint64_t arg) {
43822         LDKRevocationKey arg_conv;
43823         arg_conv.inner = untag_ptr(arg);
43824         arg_conv.is_owned = ptr_is_owned(arg);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43826         arg_conv.is_owned = false;
43827         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
43828         return ret_conv;
43829 }
43830
43831 uint64_t  __attribute__((export_name("TS_RevocationKey_clone"))) TS_RevocationKey_clone(uint64_t orig) {
43832         LDKRevocationKey orig_conv;
43833         orig_conv.inner = untag_ptr(orig);
43834         orig_conv.is_owned = ptr_is_owned(orig);
43835         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43836         orig_conv.is_owned = false;
43837         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
43838         uint64_t ret_ref = 0;
43839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43841         return ret_ref;
43842 }
43843
43844 int64_t  __attribute__((export_name("TS_RevocationKey_hash"))) TS_RevocationKey_hash(uint64_t o) {
43845         LDKRevocationKey o_conv;
43846         o_conv.inner = untag_ptr(o);
43847         o_conv.is_owned = ptr_is_owned(o);
43848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43849         o_conv.is_owned = false;
43850         int64_t ret_conv = RevocationKey_hash(&o_conv);
43851         return ret_conv;
43852 }
43853
43854 uint64_t  __attribute__((export_name("TS_RevocationKey_from_basepoint"))) TS_RevocationKey_from_basepoint(uint64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43855         LDKRevocationBasepoint countersignatory_basepoint_conv;
43856         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43857         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43858         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43859         countersignatory_basepoint_conv.is_owned = false;
43860         LDKPublicKey per_commitment_point_ref;
43861         CHECK(per_commitment_point->arr_len == 33);
43862         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43863         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
43864         uint64_t ret_ref = 0;
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43867         return ret_ref;
43868 }
43869
43870 int8_tArray  __attribute__((export_name("TS_RevocationKey_to_public_key"))) TS_RevocationKey_to_public_key(uint64_t this_arg) {
43871         LDKRevocationKey this_arg_conv;
43872         this_arg_conv.inner = untag_ptr(this_arg);
43873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43875         this_arg_conv.is_owned = false;
43876         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43877         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
43878         return ret_arr;
43879 }
43880
43881 int8_tArray  __attribute__((export_name("TS_RevocationKey_write"))) TS_RevocationKey_write(uint64_t obj) {
43882         LDKRevocationKey obj_conv;
43883         obj_conv.inner = untag_ptr(obj);
43884         obj_conv.is_owned = ptr_is_owned(obj);
43885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43886         obj_conv.is_owned = false;
43887         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
43888         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43889         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43890         CVec_u8Z_free(ret_var);
43891         return ret_arr;
43892 }
43893
43894 uint64_t  __attribute__((export_name("TS_RevocationKey_read"))) TS_RevocationKey_read(int8_tArray ser) {
43895         LDKu8slice ser_ref;
43896         ser_ref.datalen = ser->arr_len;
43897         ser_ref.data = ser->elems;
43898         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
43899         *ret_conv = RevocationKey_read(ser_ref);
43900         FREE(ser);
43901         return tag_ptr(ret_conv, true);
43902 }
43903
43904 uint32_t  __attribute__((export_name("TS_InboundHTLCStateDetails_clone"))) TS_InboundHTLCStateDetails_clone(uint64_t orig) {
43905         LDKInboundHTLCStateDetails* orig_conv = (LDKInboundHTLCStateDetails*)untag_ptr(orig);
43906         uint32_t ret_conv = LDKInboundHTLCStateDetails_to_js(InboundHTLCStateDetails_clone(orig_conv));
43907         return ret_conv;
43908 }
43909
43910 uint32_t  __attribute__((export_name("TS_InboundHTLCStateDetails_awaiting_remote_revoke_to_add"))) TS_InboundHTLCStateDetails_awaiting_remote_revoke_to_add() {
43911         uint32_t ret_conv = LDKInboundHTLCStateDetails_to_js(InboundHTLCStateDetails_awaiting_remote_revoke_to_add());
43912         return ret_conv;
43913 }
43914
43915 uint32_t  __attribute__((export_name("TS_InboundHTLCStateDetails_committed"))) TS_InboundHTLCStateDetails_committed() {
43916         uint32_t ret_conv = LDKInboundHTLCStateDetails_to_js(InboundHTLCStateDetails_committed());
43917         return ret_conv;
43918 }
43919
43920 uint32_t  __attribute__((export_name("TS_InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill"))) TS_InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill() {
43921         uint32_t ret_conv = LDKInboundHTLCStateDetails_to_js(InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill());
43922         return ret_conv;
43923 }
43924
43925 uint32_t  __attribute__((export_name("TS_InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail"))) TS_InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail() {
43926         uint32_t ret_conv = LDKInboundHTLCStateDetails_to_js(InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail());
43927         return ret_conv;
43928 }
43929
43930 int8_tArray  __attribute__((export_name("TS_InboundHTLCStateDetails_write"))) TS_InboundHTLCStateDetails_write(uint64_t obj) {
43931         LDKInboundHTLCStateDetails* obj_conv = (LDKInboundHTLCStateDetails*)untag_ptr(obj);
43932         LDKCVec_u8Z ret_var = InboundHTLCStateDetails_write(obj_conv);
43933         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43934         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43935         CVec_u8Z_free(ret_var);
43936         return ret_arr;
43937 }
43938
43939 uint64_t  __attribute__((export_name("TS_InboundHTLCStateDetails_read"))) TS_InboundHTLCStateDetails_read(int8_tArray ser) {
43940         LDKu8slice ser_ref;
43941         ser_ref.datalen = ser->arr_len;
43942         ser_ref.data = ser->elems;
43943         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
43944         *ret_conv = InboundHTLCStateDetails_read(ser_ref);
43945         FREE(ser);
43946         return tag_ptr(ret_conv, true);
43947 }
43948
43949 void  __attribute__((export_name("TS_InboundHTLCDetails_free"))) TS_InboundHTLCDetails_free(uint64_t this_obj) {
43950         LDKInboundHTLCDetails this_obj_conv;
43951         this_obj_conv.inner = untag_ptr(this_obj);
43952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43954         InboundHTLCDetails_free(this_obj_conv);
43955 }
43956
43957 int64_t  __attribute__((export_name("TS_InboundHTLCDetails_get_htlc_id"))) TS_InboundHTLCDetails_get_htlc_id(uint64_t this_ptr) {
43958         LDKInboundHTLCDetails this_ptr_conv;
43959         this_ptr_conv.inner = untag_ptr(this_ptr);
43960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43962         this_ptr_conv.is_owned = false;
43963         int64_t ret_conv = InboundHTLCDetails_get_htlc_id(&this_ptr_conv);
43964         return ret_conv;
43965 }
43966
43967 void  __attribute__((export_name("TS_InboundHTLCDetails_set_htlc_id"))) TS_InboundHTLCDetails_set_htlc_id(uint64_t this_ptr, int64_t val) {
43968         LDKInboundHTLCDetails this_ptr_conv;
43969         this_ptr_conv.inner = untag_ptr(this_ptr);
43970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43972         this_ptr_conv.is_owned = false;
43973         InboundHTLCDetails_set_htlc_id(&this_ptr_conv, val);
43974 }
43975
43976 int64_t  __attribute__((export_name("TS_InboundHTLCDetails_get_amount_msat"))) TS_InboundHTLCDetails_get_amount_msat(uint64_t this_ptr) {
43977         LDKInboundHTLCDetails this_ptr_conv;
43978         this_ptr_conv.inner = untag_ptr(this_ptr);
43979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43981         this_ptr_conv.is_owned = false;
43982         int64_t ret_conv = InboundHTLCDetails_get_amount_msat(&this_ptr_conv);
43983         return ret_conv;
43984 }
43985
43986 void  __attribute__((export_name("TS_InboundHTLCDetails_set_amount_msat"))) TS_InboundHTLCDetails_set_amount_msat(uint64_t this_ptr, int64_t val) {
43987         LDKInboundHTLCDetails this_ptr_conv;
43988         this_ptr_conv.inner = untag_ptr(this_ptr);
43989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43991         this_ptr_conv.is_owned = false;
43992         InboundHTLCDetails_set_amount_msat(&this_ptr_conv, val);
43993 }
43994
43995 int32_t  __attribute__((export_name("TS_InboundHTLCDetails_get_cltv_expiry"))) TS_InboundHTLCDetails_get_cltv_expiry(uint64_t this_ptr) {
43996         LDKInboundHTLCDetails this_ptr_conv;
43997         this_ptr_conv.inner = untag_ptr(this_ptr);
43998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44000         this_ptr_conv.is_owned = false;
44001         int32_t ret_conv = InboundHTLCDetails_get_cltv_expiry(&this_ptr_conv);
44002         return ret_conv;
44003 }
44004
44005 void  __attribute__((export_name("TS_InboundHTLCDetails_set_cltv_expiry"))) TS_InboundHTLCDetails_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
44006         LDKInboundHTLCDetails this_ptr_conv;
44007         this_ptr_conv.inner = untag_ptr(this_ptr);
44008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44010         this_ptr_conv.is_owned = false;
44011         InboundHTLCDetails_set_cltv_expiry(&this_ptr_conv, val);
44012 }
44013
44014 int8_tArray  __attribute__((export_name("TS_InboundHTLCDetails_get_payment_hash"))) TS_InboundHTLCDetails_get_payment_hash(uint64_t this_ptr) {
44015         LDKInboundHTLCDetails this_ptr_conv;
44016         this_ptr_conv.inner = untag_ptr(this_ptr);
44017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44019         this_ptr_conv.is_owned = false;
44020         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44021         memcpy(ret_arr->elems, *InboundHTLCDetails_get_payment_hash(&this_ptr_conv), 32);
44022         return ret_arr;
44023 }
44024
44025 void  __attribute__((export_name("TS_InboundHTLCDetails_set_payment_hash"))) TS_InboundHTLCDetails_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
44026         LDKInboundHTLCDetails this_ptr_conv;
44027         this_ptr_conv.inner = untag_ptr(this_ptr);
44028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44030         this_ptr_conv.is_owned = false;
44031         LDKThirtyTwoBytes val_ref;
44032         CHECK(val->arr_len == 32);
44033         memcpy(val_ref.data, val->elems, 32); FREE(val);
44034         InboundHTLCDetails_set_payment_hash(&this_ptr_conv, val_ref);
44035 }
44036
44037 uint64_t  __attribute__((export_name("TS_InboundHTLCDetails_get_state"))) TS_InboundHTLCDetails_get_state(uint64_t this_ptr) {
44038         LDKInboundHTLCDetails this_ptr_conv;
44039         this_ptr_conv.inner = untag_ptr(this_ptr);
44040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44042         this_ptr_conv.is_owned = false;
44043         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
44044         *ret_copy = InboundHTLCDetails_get_state(&this_ptr_conv);
44045         uint64_t ret_ref = tag_ptr(ret_copy, true);
44046         return ret_ref;
44047 }
44048
44049 void  __attribute__((export_name("TS_InboundHTLCDetails_set_state"))) TS_InboundHTLCDetails_set_state(uint64_t this_ptr, uint64_t val) {
44050         LDKInboundHTLCDetails this_ptr_conv;
44051         this_ptr_conv.inner = untag_ptr(this_ptr);
44052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44054         this_ptr_conv.is_owned = false;
44055         void* val_ptr = untag_ptr(val);
44056         CHECK_ACCESS(val_ptr);
44057         LDKCOption_InboundHTLCStateDetailsZ val_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(val_ptr);
44058         val_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(val));
44059         InboundHTLCDetails_set_state(&this_ptr_conv, val_conv);
44060 }
44061
44062 jboolean  __attribute__((export_name("TS_InboundHTLCDetails_get_is_dust"))) TS_InboundHTLCDetails_get_is_dust(uint64_t this_ptr) {
44063         LDKInboundHTLCDetails this_ptr_conv;
44064         this_ptr_conv.inner = untag_ptr(this_ptr);
44065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44067         this_ptr_conv.is_owned = false;
44068         jboolean ret_conv = InboundHTLCDetails_get_is_dust(&this_ptr_conv);
44069         return ret_conv;
44070 }
44071
44072 void  __attribute__((export_name("TS_InboundHTLCDetails_set_is_dust"))) TS_InboundHTLCDetails_set_is_dust(uint64_t this_ptr, jboolean val) {
44073         LDKInboundHTLCDetails this_ptr_conv;
44074         this_ptr_conv.inner = untag_ptr(this_ptr);
44075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44077         this_ptr_conv.is_owned = false;
44078         InboundHTLCDetails_set_is_dust(&this_ptr_conv, val);
44079 }
44080
44081 uint64_t  __attribute__((export_name("TS_InboundHTLCDetails_new"))) TS_InboundHTLCDetails_new(int64_t htlc_id_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, uint64_t state_arg, jboolean is_dust_arg) {
44082         LDKThirtyTwoBytes payment_hash_arg_ref;
44083         CHECK(payment_hash_arg->arr_len == 32);
44084         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
44085         void* state_arg_ptr = untag_ptr(state_arg);
44086         CHECK_ACCESS(state_arg_ptr);
44087         LDKCOption_InboundHTLCStateDetailsZ state_arg_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(state_arg_ptr);
44088         state_arg_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(state_arg));
44089         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_new(htlc_id_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, state_arg_conv, is_dust_arg);
44090         uint64_t ret_ref = 0;
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44093         return ret_ref;
44094 }
44095
44096 static inline uint64_t InboundHTLCDetails_clone_ptr(LDKInboundHTLCDetails *NONNULL_PTR arg) {
44097         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_clone(arg);
44098         uint64_t ret_ref = 0;
44099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44101         return ret_ref;
44102 }
44103 int64_t  __attribute__((export_name("TS_InboundHTLCDetails_clone_ptr"))) TS_InboundHTLCDetails_clone_ptr(uint64_t arg) {
44104         LDKInboundHTLCDetails arg_conv;
44105         arg_conv.inner = untag_ptr(arg);
44106         arg_conv.is_owned = ptr_is_owned(arg);
44107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44108         arg_conv.is_owned = false;
44109         int64_t ret_conv = InboundHTLCDetails_clone_ptr(&arg_conv);
44110         return ret_conv;
44111 }
44112
44113 uint64_t  __attribute__((export_name("TS_InboundHTLCDetails_clone"))) TS_InboundHTLCDetails_clone(uint64_t orig) {
44114         LDKInboundHTLCDetails orig_conv;
44115         orig_conv.inner = untag_ptr(orig);
44116         orig_conv.is_owned = ptr_is_owned(orig);
44117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44118         orig_conv.is_owned = false;
44119         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_clone(&orig_conv);
44120         uint64_t ret_ref = 0;
44121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44123         return ret_ref;
44124 }
44125
44126 int8_tArray  __attribute__((export_name("TS_InboundHTLCDetails_write"))) TS_InboundHTLCDetails_write(uint64_t obj) {
44127         LDKInboundHTLCDetails obj_conv;
44128         obj_conv.inner = untag_ptr(obj);
44129         obj_conv.is_owned = ptr_is_owned(obj);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44131         obj_conv.is_owned = false;
44132         LDKCVec_u8Z ret_var = InboundHTLCDetails_write(&obj_conv);
44133         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44134         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44135         CVec_u8Z_free(ret_var);
44136         return ret_arr;
44137 }
44138
44139 uint64_t  __attribute__((export_name("TS_InboundHTLCDetails_read"))) TS_InboundHTLCDetails_read(int8_tArray ser) {
44140         LDKu8slice ser_ref;
44141         ser_ref.datalen = ser->arr_len;
44142         ser_ref.data = ser->elems;
44143         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
44144         *ret_conv = InboundHTLCDetails_read(ser_ref);
44145         FREE(ser);
44146         return tag_ptr(ret_conv, true);
44147 }
44148
44149 uint32_t  __attribute__((export_name("TS_OutboundHTLCStateDetails_clone"))) TS_OutboundHTLCStateDetails_clone(uint64_t orig) {
44150         LDKOutboundHTLCStateDetails* orig_conv = (LDKOutboundHTLCStateDetails*)untag_ptr(orig);
44151         uint32_t ret_conv = LDKOutboundHTLCStateDetails_to_js(OutboundHTLCStateDetails_clone(orig_conv));
44152         return ret_conv;
44153 }
44154
44155 uint32_t  __attribute__((export_name("TS_OutboundHTLCStateDetails_awaiting_remote_revoke_to_add"))) TS_OutboundHTLCStateDetails_awaiting_remote_revoke_to_add() {
44156         uint32_t ret_conv = LDKOutboundHTLCStateDetails_to_js(OutboundHTLCStateDetails_awaiting_remote_revoke_to_add());
44157         return ret_conv;
44158 }
44159
44160 uint32_t  __attribute__((export_name("TS_OutboundHTLCStateDetails_committed"))) TS_OutboundHTLCStateDetails_committed() {
44161         uint32_t ret_conv = LDKOutboundHTLCStateDetails_to_js(OutboundHTLCStateDetails_committed());
44162         return ret_conv;
44163 }
44164
44165 uint32_t  __attribute__((export_name("TS_OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success"))) TS_OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success() {
44166         uint32_t ret_conv = LDKOutboundHTLCStateDetails_to_js(OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success());
44167         return ret_conv;
44168 }
44169
44170 uint32_t  __attribute__((export_name("TS_OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure"))) TS_OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure() {
44171         uint32_t ret_conv = LDKOutboundHTLCStateDetails_to_js(OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure());
44172         return ret_conv;
44173 }
44174
44175 int8_tArray  __attribute__((export_name("TS_OutboundHTLCStateDetails_write"))) TS_OutboundHTLCStateDetails_write(uint64_t obj) {
44176         LDKOutboundHTLCStateDetails* obj_conv = (LDKOutboundHTLCStateDetails*)untag_ptr(obj);
44177         LDKCVec_u8Z ret_var = OutboundHTLCStateDetails_write(obj_conv);
44178         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44179         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44180         CVec_u8Z_free(ret_var);
44181         return ret_arr;
44182 }
44183
44184 uint64_t  __attribute__((export_name("TS_OutboundHTLCStateDetails_read"))) TS_OutboundHTLCStateDetails_read(int8_tArray ser) {
44185         LDKu8slice ser_ref;
44186         ser_ref.datalen = ser->arr_len;
44187         ser_ref.data = ser->elems;
44188         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
44189         *ret_conv = OutboundHTLCStateDetails_read(ser_ref);
44190         FREE(ser);
44191         return tag_ptr(ret_conv, true);
44192 }
44193
44194 void  __attribute__((export_name("TS_OutboundHTLCDetails_free"))) TS_OutboundHTLCDetails_free(uint64_t this_obj) {
44195         LDKOutboundHTLCDetails this_obj_conv;
44196         this_obj_conv.inner = untag_ptr(this_obj);
44197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44199         OutboundHTLCDetails_free(this_obj_conv);
44200 }
44201
44202 uint64_t  __attribute__((export_name("TS_OutboundHTLCDetails_get_htlc_id"))) TS_OutboundHTLCDetails_get_htlc_id(uint64_t this_ptr) {
44203         LDKOutboundHTLCDetails this_ptr_conv;
44204         this_ptr_conv.inner = untag_ptr(this_ptr);
44205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44207         this_ptr_conv.is_owned = false;
44208         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44209         *ret_copy = OutboundHTLCDetails_get_htlc_id(&this_ptr_conv);
44210         uint64_t ret_ref = tag_ptr(ret_copy, true);
44211         return ret_ref;
44212 }
44213
44214 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_htlc_id"))) TS_OutboundHTLCDetails_set_htlc_id(uint64_t this_ptr, uint64_t val) {
44215         LDKOutboundHTLCDetails this_ptr_conv;
44216         this_ptr_conv.inner = untag_ptr(this_ptr);
44217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44219         this_ptr_conv.is_owned = false;
44220         void* val_ptr = untag_ptr(val);
44221         CHECK_ACCESS(val_ptr);
44222         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44223         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44224         OutboundHTLCDetails_set_htlc_id(&this_ptr_conv, val_conv);
44225 }
44226
44227 int64_t  __attribute__((export_name("TS_OutboundHTLCDetails_get_amount_msat"))) TS_OutboundHTLCDetails_get_amount_msat(uint64_t this_ptr) {
44228         LDKOutboundHTLCDetails this_ptr_conv;
44229         this_ptr_conv.inner = untag_ptr(this_ptr);
44230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44232         this_ptr_conv.is_owned = false;
44233         int64_t ret_conv = OutboundHTLCDetails_get_amount_msat(&this_ptr_conv);
44234         return ret_conv;
44235 }
44236
44237 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_amount_msat"))) TS_OutboundHTLCDetails_set_amount_msat(uint64_t this_ptr, int64_t val) {
44238         LDKOutboundHTLCDetails this_ptr_conv;
44239         this_ptr_conv.inner = untag_ptr(this_ptr);
44240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44242         this_ptr_conv.is_owned = false;
44243         OutboundHTLCDetails_set_amount_msat(&this_ptr_conv, val);
44244 }
44245
44246 int32_t  __attribute__((export_name("TS_OutboundHTLCDetails_get_cltv_expiry"))) TS_OutboundHTLCDetails_get_cltv_expiry(uint64_t this_ptr) {
44247         LDKOutboundHTLCDetails this_ptr_conv;
44248         this_ptr_conv.inner = untag_ptr(this_ptr);
44249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44251         this_ptr_conv.is_owned = false;
44252         int32_t ret_conv = OutboundHTLCDetails_get_cltv_expiry(&this_ptr_conv);
44253         return ret_conv;
44254 }
44255
44256 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_cltv_expiry"))) TS_OutboundHTLCDetails_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
44257         LDKOutboundHTLCDetails this_ptr_conv;
44258         this_ptr_conv.inner = untag_ptr(this_ptr);
44259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44261         this_ptr_conv.is_owned = false;
44262         OutboundHTLCDetails_set_cltv_expiry(&this_ptr_conv, val);
44263 }
44264
44265 int8_tArray  __attribute__((export_name("TS_OutboundHTLCDetails_get_payment_hash"))) TS_OutboundHTLCDetails_get_payment_hash(uint64_t this_ptr) {
44266         LDKOutboundHTLCDetails this_ptr_conv;
44267         this_ptr_conv.inner = untag_ptr(this_ptr);
44268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44270         this_ptr_conv.is_owned = false;
44271         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44272         memcpy(ret_arr->elems, *OutboundHTLCDetails_get_payment_hash(&this_ptr_conv), 32);
44273         return ret_arr;
44274 }
44275
44276 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_payment_hash"))) TS_OutboundHTLCDetails_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
44277         LDKOutboundHTLCDetails 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         LDKThirtyTwoBytes val_ref;
44283         CHECK(val->arr_len == 32);
44284         memcpy(val_ref.data, val->elems, 32); FREE(val);
44285         OutboundHTLCDetails_set_payment_hash(&this_ptr_conv, val_ref);
44286 }
44287
44288 uint64_t  __attribute__((export_name("TS_OutboundHTLCDetails_get_state"))) TS_OutboundHTLCDetails_get_state(uint64_t this_ptr) {
44289         LDKOutboundHTLCDetails this_ptr_conv;
44290         this_ptr_conv.inner = untag_ptr(this_ptr);
44291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44293         this_ptr_conv.is_owned = false;
44294         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
44295         *ret_copy = OutboundHTLCDetails_get_state(&this_ptr_conv);
44296         uint64_t ret_ref = tag_ptr(ret_copy, true);
44297         return ret_ref;
44298 }
44299
44300 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_state"))) TS_OutboundHTLCDetails_set_state(uint64_t this_ptr, uint64_t val) {
44301         LDKOutboundHTLCDetails this_ptr_conv;
44302         this_ptr_conv.inner = untag_ptr(this_ptr);
44303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44305         this_ptr_conv.is_owned = false;
44306         void* val_ptr = untag_ptr(val);
44307         CHECK_ACCESS(val_ptr);
44308         LDKCOption_OutboundHTLCStateDetailsZ val_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(val_ptr);
44309         val_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(val));
44310         OutboundHTLCDetails_set_state(&this_ptr_conv, val_conv);
44311 }
44312
44313 uint64_t  __attribute__((export_name("TS_OutboundHTLCDetails_get_skimmed_fee_msat"))) TS_OutboundHTLCDetails_get_skimmed_fee_msat(uint64_t this_ptr) {
44314         LDKOutboundHTLCDetails this_ptr_conv;
44315         this_ptr_conv.inner = untag_ptr(this_ptr);
44316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44318         this_ptr_conv.is_owned = false;
44319         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44320         *ret_copy = OutboundHTLCDetails_get_skimmed_fee_msat(&this_ptr_conv);
44321         uint64_t ret_ref = tag_ptr(ret_copy, true);
44322         return ret_ref;
44323 }
44324
44325 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_skimmed_fee_msat"))) TS_OutboundHTLCDetails_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
44326         LDKOutboundHTLCDetails this_ptr_conv;
44327         this_ptr_conv.inner = untag_ptr(this_ptr);
44328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44330         this_ptr_conv.is_owned = false;
44331         void* val_ptr = untag_ptr(val);
44332         CHECK_ACCESS(val_ptr);
44333         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44334         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44335         OutboundHTLCDetails_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
44336 }
44337
44338 jboolean  __attribute__((export_name("TS_OutboundHTLCDetails_get_is_dust"))) TS_OutboundHTLCDetails_get_is_dust(uint64_t this_ptr) {
44339         LDKOutboundHTLCDetails this_ptr_conv;
44340         this_ptr_conv.inner = untag_ptr(this_ptr);
44341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44343         this_ptr_conv.is_owned = false;
44344         jboolean ret_conv = OutboundHTLCDetails_get_is_dust(&this_ptr_conv);
44345         return ret_conv;
44346 }
44347
44348 void  __attribute__((export_name("TS_OutboundHTLCDetails_set_is_dust"))) TS_OutboundHTLCDetails_set_is_dust(uint64_t this_ptr, jboolean val) {
44349         LDKOutboundHTLCDetails this_ptr_conv;
44350         this_ptr_conv.inner = untag_ptr(this_ptr);
44351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44353         this_ptr_conv.is_owned = false;
44354         OutboundHTLCDetails_set_is_dust(&this_ptr_conv, val);
44355 }
44356
44357 uint64_t  __attribute__((export_name("TS_OutboundHTLCDetails_new"))) TS_OutboundHTLCDetails_new(uint64_t htlc_id_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, uint64_t state_arg, uint64_t skimmed_fee_msat_arg, jboolean is_dust_arg) {
44358         void* htlc_id_arg_ptr = untag_ptr(htlc_id_arg);
44359         CHECK_ACCESS(htlc_id_arg_ptr);
44360         LDKCOption_u64Z htlc_id_arg_conv = *(LDKCOption_u64Z*)(htlc_id_arg_ptr);
44361         htlc_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_id_arg));
44362         LDKThirtyTwoBytes payment_hash_arg_ref;
44363         CHECK(payment_hash_arg->arr_len == 32);
44364         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
44365         void* state_arg_ptr = untag_ptr(state_arg);
44366         CHECK_ACCESS(state_arg_ptr);
44367         LDKCOption_OutboundHTLCStateDetailsZ state_arg_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(state_arg_ptr);
44368         state_arg_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(state_arg));
44369         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
44370         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
44371         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
44372         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
44373         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_new(htlc_id_arg_conv, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, state_arg_conv, skimmed_fee_msat_arg_conv, is_dust_arg);
44374         uint64_t ret_ref = 0;
44375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44377         return ret_ref;
44378 }
44379
44380 static inline uint64_t OutboundHTLCDetails_clone_ptr(LDKOutboundHTLCDetails *NONNULL_PTR arg) {
44381         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_clone(arg);
44382         uint64_t ret_ref = 0;
44383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44385         return ret_ref;
44386 }
44387 int64_t  __attribute__((export_name("TS_OutboundHTLCDetails_clone_ptr"))) TS_OutboundHTLCDetails_clone_ptr(uint64_t arg) {
44388         LDKOutboundHTLCDetails arg_conv;
44389         arg_conv.inner = untag_ptr(arg);
44390         arg_conv.is_owned = ptr_is_owned(arg);
44391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44392         arg_conv.is_owned = false;
44393         int64_t ret_conv = OutboundHTLCDetails_clone_ptr(&arg_conv);
44394         return ret_conv;
44395 }
44396
44397 uint64_t  __attribute__((export_name("TS_OutboundHTLCDetails_clone"))) TS_OutboundHTLCDetails_clone(uint64_t orig) {
44398         LDKOutboundHTLCDetails orig_conv;
44399         orig_conv.inner = untag_ptr(orig);
44400         orig_conv.is_owned = ptr_is_owned(orig);
44401         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44402         orig_conv.is_owned = false;
44403         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_clone(&orig_conv);
44404         uint64_t ret_ref = 0;
44405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44407         return ret_ref;
44408 }
44409
44410 int8_tArray  __attribute__((export_name("TS_OutboundHTLCDetails_write"))) TS_OutboundHTLCDetails_write(uint64_t obj) {
44411         LDKOutboundHTLCDetails obj_conv;
44412         obj_conv.inner = untag_ptr(obj);
44413         obj_conv.is_owned = ptr_is_owned(obj);
44414         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44415         obj_conv.is_owned = false;
44416         LDKCVec_u8Z ret_var = OutboundHTLCDetails_write(&obj_conv);
44417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44419         CVec_u8Z_free(ret_var);
44420         return ret_arr;
44421 }
44422
44423 uint64_t  __attribute__((export_name("TS_OutboundHTLCDetails_read"))) TS_OutboundHTLCDetails_read(int8_tArray ser) {
44424         LDKu8slice ser_ref;
44425         ser_ref.datalen = ser->arr_len;
44426         ser_ref.data = ser->elems;
44427         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
44428         *ret_conv = OutboundHTLCDetails_read(ser_ref);
44429         FREE(ser);
44430         return tag_ptr(ret_conv, true);
44431 }
44432
44433 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
44434         LDKCounterpartyForwardingInfo this_obj_conv;
44435         this_obj_conv.inner = untag_ptr(this_obj);
44436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44438         CounterpartyForwardingInfo_free(this_obj_conv);
44439 }
44440
44441 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
44442         LDKCounterpartyForwardingInfo this_ptr_conv;
44443         this_ptr_conv.inner = untag_ptr(this_ptr);
44444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44446         this_ptr_conv.is_owned = false;
44447         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
44448         return ret_conv;
44449 }
44450
44451 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
44452         LDKCounterpartyForwardingInfo this_ptr_conv;
44453         this_ptr_conv.inner = untag_ptr(this_ptr);
44454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44456         this_ptr_conv.is_owned = false;
44457         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
44458 }
44459
44460 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
44461         LDKCounterpartyForwardingInfo this_ptr_conv;
44462         this_ptr_conv.inner = untag_ptr(this_ptr);
44463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44465         this_ptr_conv.is_owned = false;
44466         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
44467         return ret_conv;
44468 }
44469
44470 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
44471         LDKCounterpartyForwardingInfo this_ptr_conv;
44472         this_ptr_conv.inner = untag_ptr(this_ptr);
44473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44475         this_ptr_conv.is_owned = false;
44476         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
44477 }
44478
44479 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
44480         LDKCounterpartyForwardingInfo this_ptr_conv;
44481         this_ptr_conv.inner = untag_ptr(this_ptr);
44482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44484         this_ptr_conv.is_owned = false;
44485         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
44486         return ret_conv;
44487 }
44488
44489 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44490         LDKCounterpartyForwardingInfo this_ptr_conv;
44491         this_ptr_conv.inner = untag_ptr(this_ptr);
44492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44494         this_ptr_conv.is_owned = false;
44495         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
44496 }
44497
44498 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) {
44499         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
44500         uint64_t ret_ref = 0;
44501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44503         return ret_ref;
44504 }
44505
44506 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
44507         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
44508         uint64_t ret_ref = 0;
44509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44511         return ret_ref;
44512 }
44513 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
44514         LDKCounterpartyForwardingInfo arg_conv;
44515         arg_conv.inner = untag_ptr(arg);
44516         arg_conv.is_owned = ptr_is_owned(arg);
44517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44518         arg_conv.is_owned = false;
44519         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
44520         return ret_conv;
44521 }
44522
44523 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
44524         LDKCounterpartyForwardingInfo orig_conv;
44525         orig_conv.inner = untag_ptr(orig);
44526         orig_conv.is_owned = ptr_is_owned(orig);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44528         orig_conv.is_owned = false;
44529         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
44530         uint64_t ret_ref = 0;
44531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44533         return ret_ref;
44534 }
44535
44536 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
44537         LDKCounterpartyForwardingInfo obj_conv;
44538         obj_conv.inner = untag_ptr(obj);
44539         obj_conv.is_owned = ptr_is_owned(obj);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44541         obj_conv.is_owned = false;
44542         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
44543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44545         CVec_u8Z_free(ret_var);
44546         return ret_arr;
44547 }
44548
44549 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
44550         LDKu8slice ser_ref;
44551         ser_ref.datalen = ser->arr_len;
44552         ser_ref.data = ser->elems;
44553         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
44554         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
44555         FREE(ser);
44556         return tag_ptr(ret_conv, true);
44557 }
44558
44559 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
44560         LDKChannelCounterparty this_obj_conv;
44561         this_obj_conv.inner = untag_ptr(this_obj);
44562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44564         ChannelCounterparty_free(this_obj_conv);
44565 }
44566
44567 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
44568         LDKChannelCounterparty this_ptr_conv;
44569         this_ptr_conv.inner = untag_ptr(this_ptr);
44570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44572         this_ptr_conv.is_owned = false;
44573         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44574         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
44575         return ret_arr;
44576 }
44577
44578 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
44579         LDKChannelCounterparty this_ptr_conv;
44580         this_ptr_conv.inner = untag_ptr(this_ptr);
44581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44583         this_ptr_conv.is_owned = false;
44584         LDKPublicKey val_ref;
44585         CHECK(val->arr_len == 33);
44586         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44587         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
44588 }
44589
44590 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
44591         LDKChannelCounterparty this_ptr_conv;
44592         this_ptr_conv.inner = untag_ptr(this_ptr);
44593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44595         this_ptr_conv.is_owned = false;
44596         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
44597         uint64_t ret_ref = 0;
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44600         return ret_ref;
44601 }
44602
44603 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
44604         LDKChannelCounterparty this_ptr_conv;
44605         this_ptr_conv.inner = untag_ptr(this_ptr);
44606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44608         this_ptr_conv.is_owned = false;
44609         LDKInitFeatures val_conv;
44610         val_conv.inner = untag_ptr(val);
44611         val_conv.is_owned = ptr_is_owned(val);
44612         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44613         val_conv = InitFeatures_clone(&val_conv);
44614         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
44615 }
44616
44617 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
44618         LDKChannelCounterparty this_ptr_conv;
44619         this_ptr_conv.inner = untag_ptr(this_ptr);
44620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44622         this_ptr_conv.is_owned = false;
44623         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
44624         return ret_conv;
44625 }
44626
44627 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
44628         LDKChannelCounterparty 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         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
44634 }
44635
44636 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
44637         LDKChannelCounterparty this_ptr_conv;
44638         this_ptr_conv.inner = untag_ptr(this_ptr);
44639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44641         this_ptr_conv.is_owned = false;
44642         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
44643         uint64_t ret_ref = 0;
44644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44646         return ret_ref;
44647 }
44648
44649 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
44650         LDKChannelCounterparty this_ptr_conv;
44651         this_ptr_conv.inner = untag_ptr(this_ptr);
44652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44654         this_ptr_conv.is_owned = false;
44655         LDKCounterpartyForwardingInfo val_conv;
44656         val_conv.inner = untag_ptr(val);
44657         val_conv.is_owned = ptr_is_owned(val);
44658         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44659         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
44660         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
44661 }
44662
44663 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
44664         LDKChannelCounterparty this_ptr_conv;
44665         this_ptr_conv.inner = untag_ptr(this_ptr);
44666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44668         this_ptr_conv.is_owned = false;
44669         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44670         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
44671         uint64_t ret_ref = tag_ptr(ret_copy, true);
44672         return ret_ref;
44673 }
44674
44675 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) {
44676         LDKChannelCounterparty this_ptr_conv;
44677         this_ptr_conv.inner = untag_ptr(this_ptr);
44678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44680         this_ptr_conv.is_owned = false;
44681         void* val_ptr = untag_ptr(val);
44682         CHECK_ACCESS(val_ptr);
44683         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44684         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44685         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
44686 }
44687
44688 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
44689         LDKChannelCounterparty this_ptr_conv;
44690         this_ptr_conv.inner = untag_ptr(this_ptr);
44691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44693         this_ptr_conv.is_owned = false;
44694         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44695         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
44696         uint64_t ret_ref = tag_ptr(ret_copy, true);
44697         return ret_ref;
44698 }
44699
44700 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) {
44701         LDKChannelCounterparty this_ptr_conv;
44702         this_ptr_conv.inner = untag_ptr(this_ptr);
44703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44705         this_ptr_conv.is_owned = false;
44706         void* val_ptr = untag_ptr(val);
44707         CHECK_ACCESS(val_ptr);
44708         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44709         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44710         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
44711 }
44712
44713 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) {
44714         LDKPublicKey node_id_arg_ref;
44715         CHECK(node_id_arg->arr_len == 33);
44716         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
44717         LDKInitFeatures features_arg_conv;
44718         features_arg_conv.inner = untag_ptr(features_arg);
44719         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44720         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44721         features_arg_conv = InitFeatures_clone(&features_arg_conv);
44722         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
44723         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
44724         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
44725         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
44726         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
44727         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
44728         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
44729         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
44730         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
44731         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
44732         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
44733         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
44734         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
44735         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);
44736         uint64_t ret_ref = 0;
44737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44739         return ret_ref;
44740 }
44741
44742 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
44743         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
44744         uint64_t ret_ref = 0;
44745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44747         return ret_ref;
44748 }
44749 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
44750         LDKChannelCounterparty arg_conv;
44751         arg_conv.inner = untag_ptr(arg);
44752         arg_conv.is_owned = ptr_is_owned(arg);
44753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44754         arg_conv.is_owned = false;
44755         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
44756         return ret_conv;
44757 }
44758
44759 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
44760         LDKChannelCounterparty orig_conv;
44761         orig_conv.inner = untag_ptr(orig);
44762         orig_conv.is_owned = ptr_is_owned(orig);
44763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44764         orig_conv.is_owned = false;
44765         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
44766         uint64_t ret_ref = 0;
44767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44769         return ret_ref;
44770 }
44771
44772 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
44773         LDKChannelCounterparty obj_conv;
44774         obj_conv.inner = untag_ptr(obj);
44775         obj_conv.is_owned = ptr_is_owned(obj);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44777         obj_conv.is_owned = false;
44778         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
44779         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44780         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44781         CVec_u8Z_free(ret_var);
44782         return ret_arr;
44783 }
44784
44785 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
44786         LDKu8slice ser_ref;
44787         ser_ref.datalen = ser->arr_len;
44788         ser_ref.data = ser->elems;
44789         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
44790         *ret_conv = ChannelCounterparty_read(ser_ref);
44791         FREE(ser);
44792         return tag_ptr(ret_conv, true);
44793 }
44794
44795 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
44796         LDKChannelDetails this_obj_conv;
44797         this_obj_conv.inner = untag_ptr(this_obj);
44798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44800         ChannelDetails_free(this_obj_conv);
44801 }
44802
44803 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
44804         LDKChannelDetails this_ptr_conv;
44805         this_ptr_conv.inner = untag_ptr(this_ptr);
44806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44808         this_ptr_conv.is_owned = false;
44809         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
44810         uint64_t ret_ref = 0;
44811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44813         return ret_ref;
44814 }
44815
44816 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, uint64_t val) {
44817         LDKChannelDetails this_ptr_conv;
44818         this_ptr_conv.inner = untag_ptr(this_ptr);
44819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44821         this_ptr_conv.is_owned = false;
44822         LDKChannelId val_conv;
44823         val_conv.inner = untag_ptr(val);
44824         val_conv.is_owned = ptr_is_owned(val);
44825         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44826         val_conv = ChannelId_clone(&val_conv);
44827         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
44828 }
44829
44830 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
44831         LDKChannelDetails this_ptr_conv;
44832         this_ptr_conv.inner = untag_ptr(this_ptr);
44833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44835         this_ptr_conv.is_owned = false;
44836         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
44837         uint64_t ret_ref = 0;
44838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44840         return ret_ref;
44841 }
44842
44843 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
44844         LDKChannelDetails this_ptr_conv;
44845         this_ptr_conv.inner = untag_ptr(this_ptr);
44846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44848         this_ptr_conv.is_owned = false;
44849         LDKChannelCounterparty val_conv;
44850         val_conv.inner = untag_ptr(val);
44851         val_conv.is_owned = ptr_is_owned(val);
44852         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44853         val_conv = ChannelCounterparty_clone(&val_conv);
44854         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
44855 }
44856
44857 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
44858         LDKChannelDetails this_ptr_conv;
44859         this_ptr_conv.inner = untag_ptr(this_ptr);
44860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44862         this_ptr_conv.is_owned = false;
44863         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
44864         uint64_t ret_ref = 0;
44865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44867         return ret_ref;
44868 }
44869
44870 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
44871         LDKChannelDetails 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         LDKOutPoint val_conv;
44877         val_conv.inner = untag_ptr(val);
44878         val_conv.is_owned = ptr_is_owned(val);
44879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44880         val_conv = OutPoint_clone(&val_conv);
44881         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
44882 }
44883
44884 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
44885         LDKChannelDetails this_ptr_conv;
44886         this_ptr_conv.inner = untag_ptr(this_ptr);
44887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44889         this_ptr_conv.is_owned = false;
44890         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
44891         uint64_t ret_ref = 0;
44892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44894         return ret_ref;
44895 }
44896
44897 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
44898         LDKChannelDetails this_ptr_conv;
44899         this_ptr_conv.inner = untag_ptr(this_ptr);
44900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44902         this_ptr_conv.is_owned = false;
44903         LDKChannelTypeFeatures val_conv;
44904         val_conv.inner = untag_ptr(val);
44905         val_conv.is_owned = ptr_is_owned(val);
44906         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44907         val_conv = ChannelTypeFeatures_clone(&val_conv);
44908         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
44909 }
44910
44911 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
44912         LDKChannelDetails this_ptr_conv;
44913         this_ptr_conv.inner = untag_ptr(this_ptr);
44914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44916         this_ptr_conv.is_owned = false;
44917         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44918         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
44919         uint64_t ret_ref = tag_ptr(ret_copy, true);
44920         return ret_ref;
44921 }
44922
44923 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
44924         LDKChannelDetails this_ptr_conv;
44925         this_ptr_conv.inner = untag_ptr(this_ptr);
44926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44928         this_ptr_conv.is_owned = false;
44929         void* val_ptr = untag_ptr(val);
44930         CHECK_ACCESS(val_ptr);
44931         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44932         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44933         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
44934 }
44935
44936 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
44937         LDKChannelDetails this_ptr_conv;
44938         this_ptr_conv.inner = untag_ptr(this_ptr);
44939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44941         this_ptr_conv.is_owned = false;
44942         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44943         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
44944         uint64_t ret_ref = tag_ptr(ret_copy, true);
44945         return ret_ref;
44946 }
44947
44948 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
44949         LDKChannelDetails this_ptr_conv;
44950         this_ptr_conv.inner = untag_ptr(this_ptr);
44951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44953         this_ptr_conv.is_owned = false;
44954         void* val_ptr = untag_ptr(val);
44955         CHECK_ACCESS(val_ptr);
44956         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44957         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44958         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
44959 }
44960
44961 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
44962         LDKChannelDetails this_ptr_conv;
44963         this_ptr_conv.inner = untag_ptr(this_ptr);
44964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44966         this_ptr_conv.is_owned = false;
44967         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44968         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
44969         uint64_t ret_ref = tag_ptr(ret_copy, true);
44970         return ret_ref;
44971 }
44972
44973 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
44974         LDKChannelDetails this_ptr_conv;
44975         this_ptr_conv.inner = untag_ptr(this_ptr);
44976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44978         this_ptr_conv.is_owned = false;
44979         void* val_ptr = untag_ptr(val);
44980         CHECK_ACCESS(val_ptr);
44981         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44982         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44983         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
44984 }
44985
44986 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
44987         LDKChannelDetails this_ptr_conv;
44988         this_ptr_conv.inner = untag_ptr(this_ptr);
44989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44991         this_ptr_conv.is_owned = false;
44992         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
44993         return ret_conv;
44994 }
44995
44996 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
44997         LDKChannelDetails this_ptr_conv;
44998         this_ptr_conv.inner = untag_ptr(this_ptr);
44999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45001         this_ptr_conv.is_owned = false;
45002         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
45003 }
45004
45005 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
45006         LDKChannelDetails this_ptr_conv;
45007         this_ptr_conv.inner = untag_ptr(this_ptr);
45008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45010         this_ptr_conv.is_owned = false;
45011         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45012         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
45013         uint64_t ret_ref = tag_ptr(ret_copy, true);
45014         return ret_ref;
45015 }
45016
45017 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
45018         LDKChannelDetails this_ptr_conv;
45019         this_ptr_conv.inner = untag_ptr(this_ptr);
45020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45022         this_ptr_conv.is_owned = false;
45023         void* val_ptr = untag_ptr(val);
45024         CHECK_ACCESS(val_ptr);
45025         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45026         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45027         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
45028 }
45029
45030 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
45031         LDKChannelDetails this_ptr_conv;
45032         this_ptr_conv.inner = untag_ptr(this_ptr);
45033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45035         this_ptr_conv.is_owned = false;
45036         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
45037         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
45038         return ret_arr;
45039 }
45040
45041 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
45042         LDKChannelDetails this_ptr_conv;
45043         this_ptr_conv.inner = untag_ptr(this_ptr);
45044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45046         this_ptr_conv.is_owned = false;
45047         LDKU128 val_ref;
45048         CHECK(val->arr_len == 16);
45049         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
45050         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
45051 }
45052
45053 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) {
45054         LDKChannelDetails this_ptr_conv;
45055         this_ptr_conv.inner = untag_ptr(this_ptr);
45056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45058         this_ptr_conv.is_owned = false;
45059         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45060         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45061         uint64_t ret_ref = tag_ptr(ret_copy, true);
45062         return ret_ref;
45063 }
45064
45065 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) {
45066         LDKChannelDetails this_ptr_conv;
45067         this_ptr_conv.inner = untag_ptr(this_ptr);
45068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45070         this_ptr_conv.is_owned = false;
45071         void* val_ptr = untag_ptr(val);
45072         CHECK_ACCESS(val_ptr);
45073         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45074         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45075         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
45076 }
45077
45078 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
45079         LDKChannelDetails this_ptr_conv;
45080         this_ptr_conv.inner = untag_ptr(this_ptr);
45081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45083         this_ptr_conv.is_owned = false;
45084         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
45085         return ret_conv;
45086 }
45087
45088 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
45089         LDKChannelDetails this_ptr_conv;
45090         this_ptr_conv.inner = untag_ptr(this_ptr);
45091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45093         this_ptr_conv.is_owned = false;
45094         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
45095 }
45096
45097 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
45098         LDKChannelDetails this_ptr_conv;
45099         this_ptr_conv.inner = untag_ptr(this_ptr);
45100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45102         this_ptr_conv.is_owned = false;
45103         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
45104         return ret_conv;
45105 }
45106
45107 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
45108         LDKChannelDetails this_ptr_conv;
45109         this_ptr_conv.inner = untag_ptr(this_ptr);
45110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45112         this_ptr_conv.is_owned = false;
45113         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
45114 }
45115
45116 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) {
45117         LDKChannelDetails this_ptr_conv;
45118         this_ptr_conv.inner = untag_ptr(this_ptr);
45119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45121         this_ptr_conv.is_owned = false;
45122         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
45123         return ret_conv;
45124 }
45125
45126 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) {
45127         LDKChannelDetails this_ptr_conv;
45128         this_ptr_conv.inner = untag_ptr(this_ptr);
45129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45131         this_ptr_conv.is_owned = false;
45132         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
45133 }
45134
45135 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) {
45136         LDKChannelDetails this_ptr_conv;
45137         this_ptr_conv.inner = untag_ptr(this_ptr);
45138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45140         this_ptr_conv.is_owned = false;
45141         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
45142         return ret_conv;
45143 }
45144
45145 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) {
45146         LDKChannelDetails this_ptr_conv;
45147         this_ptr_conv.inner = untag_ptr(this_ptr);
45148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45150         this_ptr_conv.is_owned = false;
45151         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
45152 }
45153
45154 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
45155         LDKChannelDetails this_ptr_conv;
45156         this_ptr_conv.inner = untag_ptr(this_ptr);
45157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45159         this_ptr_conv.is_owned = false;
45160         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
45161         return ret_conv;
45162 }
45163
45164 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
45165         LDKChannelDetails this_ptr_conv;
45166         this_ptr_conv.inner = untag_ptr(this_ptr);
45167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45169         this_ptr_conv.is_owned = false;
45170         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
45171 }
45172
45173 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
45174         LDKChannelDetails this_ptr_conv;
45175         this_ptr_conv.inner = untag_ptr(this_ptr);
45176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45178         this_ptr_conv.is_owned = false;
45179         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45180         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
45181         uint64_t ret_ref = tag_ptr(ret_copy, true);
45182         return ret_ref;
45183 }
45184
45185 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
45186         LDKChannelDetails this_ptr_conv;
45187         this_ptr_conv.inner = untag_ptr(this_ptr);
45188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45190         this_ptr_conv.is_owned = false;
45191         void* val_ptr = untag_ptr(val);
45192         CHECK_ACCESS(val_ptr);
45193         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45194         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45195         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
45196 }
45197
45198 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
45199         LDKChannelDetails this_ptr_conv;
45200         this_ptr_conv.inner = untag_ptr(this_ptr);
45201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45203         this_ptr_conv.is_owned = false;
45204         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45205         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
45206         uint64_t ret_ref = tag_ptr(ret_copy, true);
45207         return ret_ref;
45208 }
45209
45210 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
45211         LDKChannelDetails this_ptr_conv;
45212         this_ptr_conv.inner = untag_ptr(this_ptr);
45213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45215         this_ptr_conv.is_owned = false;
45216         void* val_ptr = untag_ptr(val);
45217         CHECK_ACCESS(val_ptr);
45218         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45219         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45220         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
45221 }
45222
45223 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
45224         LDKChannelDetails this_ptr_conv;
45225         this_ptr_conv.inner = untag_ptr(this_ptr);
45226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45228         this_ptr_conv.is_owned = false;
45229         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
45230         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
45231         uint64_t ret_ref = tag_ptr(ret_copy, true);
45232         return ret_ref;
45233 }
45234
45235 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) {
45236         LDKChannelDetails this_ptr_conv;
45237         this_ptr_conv.inner = untag_ptr(this_ptr);
45238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45240         this_ptr_conv.is_owned = false;
45241         void* val_ptr = untag_ptr(val);
45242         CHECK_ACCESS(val_ptr);
45243         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
45244         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
45245         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
45246 }
45247
45248 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
45249         LDKChannelDetails this_ptr_conv;
45250         this_ptr_conv.inner = untag_ptr(this_ptr);
45251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45253         this_ptr_conv.is_owned = false;
45254         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
45255         return ret_conv;
45256 }
45257
45258 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
45259         LDKChannelDetails this_ptr_conv;
45260         this_ptr_conv.inner = untag_ptr(this_ptr);
45261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45263         this_ptr_conv.is_owned = false;
45264         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
45265 }
45266
45267 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
45268         LDKChannelDetails this_ptr_conv;
45269         this_ptr_conv.inner = untag_ptr(this_ptr);
45270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45272         this_ptr_conv.is_owned = false;
45273         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
45274         return ret_conv;
45275 }
45276
45277 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
45278         LDKChannelDetails this_ptr_conv;
45279         this_ptr_conv.inner = untag_ptr(this_ptr);
45280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45282         this_ptr_conv.is_owned = false;
45283         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
45284 }
45285
45286 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
45287         LDKChannelDetails this_ptr_conv;
45288         this_ptr_conv.inner = untag_ptr(this_ptr);
45289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45291         this_ptr_conv.is_owned = false;
45292         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
45293         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
45294         uint64_t ret_ref = tag_ptr(ret_copy, true);
45295         return ret_ref;
45296 }
45297
45298 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
45299         LDKChannelDetails this_ptr_conv;
45300         this_ptr_conv.inner = untag_ptr(this_ptr);
45301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45303         this_ptr_conv.is_owned = false;
45304         void* val_ptr = untag_ptr(val);
45305         CHECK_ACCESS(val_ptr);
45306         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
45307         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
45308         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
45309 }
45310
45311 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
45312         LDKChannelDetails this_ptr_conv;
45313         this_ptr_conv.inner = untag_ptr(this_ptr);
45314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45316         this_ptr_conv.is_owned = false;
45317         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
45318         return ret_conv;
45319 }
45320
45321 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
45322         LDKChannelDetails this_ptr_conv;
45323         this_ptr_conv.inner = untag_ptr(this_ptr);
45324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45326         this_ptr_conv.is_owned = false;
45327         ChannelDetails_set_is_usable(&this_ptr_conv, val);
45328 }
45329
45330 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
45331         LDKChannelDetails this_ptr_conv;
45332         this_ptr_conv.inner = untag_ptr(this_ptr);
45333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45335         this_ptr_conv.is_owned = false;
45336         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
45337         return ret_conv;
45338 }
45339
45340 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
45341         LDKChannelDetails this_ptr_conv;
45342         this_ptr_conv.inner = untag_ptr(this_ptr);
45343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45345         this_ptr_conv.is_owned = false;
45346         ChannelDetails_set_is_public(&this_ptr_conv, val);
45347 }
45348
45349 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
45350         LDKChannelDetails this_ptr_conv;
45351         this_ptr_conv.inner = untag_ptr(this_ptr);
45352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45354         this_ptr_conv.is_owned = false;
45355         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45356         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
45357         uint64_t ret_ref = tag_ptr(ret_copy, true);
45358         return ret_ref;
45359 }
45360
45361 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) {
45362         LDKChannelDetails this_ptr_conv;
45363         this_ptr_conv.inner = untag_ptr(this_ptr);
45364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45366         this_ptr_conv.is_owned = false;
45367         void* val_ptr = untag_ptr(val);
45368         CHECK_ACCESS(val_ptr);
45369         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45370         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45371         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
45372 }
45373
45374 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
45375         LDKChannelDetails this_ptr_conv;
45376         this_ptr_conv.inner = untag_ptr(this_ptr);
45377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45379         this_ptr_conv.is_owned = false;
45380         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45381         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
45382         uint64_t ret_ref = tag_ptr(ret_copy, true);
45383         return ret_ref;
45384 }
45385
45386 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) {
45387         LDKChannelDetails this_ptr_conv;
45388         this_ptr_conv.inner = untag_ptr(this_ptr);
45389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45391         this_ptr_conv.is_owned = false;
45392         void* val_ptr = untag_ptr(val);
45393         CHECK_ACCESS(val_ptr);
45394         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45395         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45396         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
45397 }
45398
45399 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
45400         LDKChannelDetails this_ptr_conv;
45401         this_ptr_conv.inner = untag_ptr(this_ptr);
45402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45404         this_ptr_conv.is_owned = false;
45405         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
45406         uint64_t ret_ref = 0;
45407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45409         return ret_ref;
45410 }
45411
45412 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
45413         LDKChannelDetails this_ptr_conv;
45414         this_ptr_conv.inner = untag_ptr(this_ptr);
45415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45417         this_ptr_conv.is_owned = false;
45418         LDKChannelConfig val_conv;
45419         val_conv.inner = untag_ptr(val);
45420         val_conv.is_owned = ptr_is_owned(val);
45421         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45422         val_conv = ChannelConfig_clone(&val_conv);
45423         ChannelDetails_set_config(&this_ptr_conv, val_conv);
45424 }
45425
45426 uint64_tArray  __attribute__((export_name("TS_ChannelDetails_get_pending_inbound_htlcs"))) TS_ChannelDetails_get_pending_inbound_htlcs(uint64_t this_ptr) {
45427         LDKChannelDetails this_ptr_conv;
45428         this_ptr_conv.inner = untag_ptr(this_ptr);
45429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45431         this_ptr_conv.is_owned = false;
45432         LDKCVec_InboundHTLCDetailsZ ret_var = ChannelDetails_get_pending_inbound_htlcs(&this_ptr_conv);
45433         uint64_tArray ret_arr = NULL;
45434         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45435         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45436         for (size_t u = 0; u < ret_var.datalen; u++) {
45437                 LDKInboundHTLCDetails ret_conv_20_var = ret_var.data[u];
45438                 uint64_t ret_conv_20_ref = 0;
45439                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_20_var);
45440                 ret_conv_20_ref = tag_ptr(ret_conv_20_var.inner, ret_conv_20_var.is_owned);
45441                 ret_arr_ptr[u] = ret_conv_20_ref;
45442         }
45443         
45444         FREE(ret_var.data);
45445         return ret_arr;
45446 }
45447
45448 void  __attribute__((export_name("TS_ChannelDetails_set_pending_inbound_htlcs"))) TS_ChannelDetails_set_pending_inbound_htlcs(uint64_t this_ptr, uint64_tArray val) {
45449         LDKChannelDetails this_ptr_conv;
45450         this_ptr_conv.inner = untag_ptr(this_ptr);
45451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45453         this_ptr_conv.is_owned = false;
45454         LDKCVec_InboundHTLCDetailsZ val_constr;
45455         val_constr.datalen = val->arr_len;
45456         if (val_constr.datalen > 0)
45457                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
45458         else
45459                 val_constr.data = NULL;
45460         uint64_t* val_vals = val->elems;
45461         for (size_t u = 0; u < val_constr.datalen; u++) {
45462                 uint64_t val_conv_20 = val_vals[u];
45463                 LDKInboundHTLCDetails val_conv_20_conv;
45464                 val_conv_20_conv.inner = untag_ptr(val_conv_20);
45465                 val_conv_20_conv.is_owned = ptr_is_owned(val_conv_20);
45466                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_20_conv);
45467                 val_conv_20_conv = InboundHTLCDetails_clone(&val_conv_20_conv);
45468                 val_constr.data[u] = val_conv_20_conv;
45469         }
45470         FREE(val);
45471         ChannelDetails_set_pending_inbound_htlcs(&this_ptr_conv, val_constr);
45472 }
45473
45474 uint64_tArray  __attribute__((export_name("TS_ChannelDetails_get_pending_outbound_htlcs"))) TS_ChannelDetails_get_pending_outbound_htlcs(uint64_t this_ptr) {
45475         LDKChannelDetails this_ptr_conv;
45476         this_ptr_conv.inner = untag_ptr(this_ptr);
45477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45479         this_ptr_conv.is_owned = false;
45480         LDKCVec_OutboundHTLCDetailsZ ret_var = ChannelDetails_get_pending_outbound_htlcs(&this_ptr_conv);
45481         uint64_tArray ret_arr = NULL;
45482         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45483         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45484         for (size_t v = 0; v < ret_var.datalen; v++) {
45485                 LDKOutboundHTLCDetails ret_conv_21_var = ret_var.data[v];
45486                 uint64_t ret_conv_21_ref = 0;
45487                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_21_var);
45488                 ret_conv_21_ref = tag_ptr(ret_conv_21_var.inner, ret_conv_21_var.is_owned);
45489                 ret_arr_ptr[v] = ret_conv_21_ref;
45490         }
45491         
45492         FREE(ret_var.data);
45493         return ret_arr;
45494 }
45495
45496 void  __attribute__((export_name("TS_ChannelDetails_set_pending_outbound_htlcs"))) TS_ChannelDetails_set_pending_outbound_htlcs(uint64_t this_ptr, uint64_tArray val) {
45497         LDKChannelDetails this_ptr_conv;
45498         this_ptr_conv.inner = untag_ptr(this_ptr);
45499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45501         this_ptr_conv.is_owned = false;
45502         LDKCVec_OutboundHTLCDetailsZ val_constr;
45503         val_constr.datalen = val->arr_len;
45504         if (val_constr.datalen > 0)
45505                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
45506         else
45507                 val_constr.data = NULL;
45508         uint64_t* val_vals = val->elems;
45509         for (size_t v = 0; v < val_constr.datalen; v++) {
45510                 uint64_t val_conv_21 = val_vals[v];
45511                 LDKOutboundHTLCDetails val_conv_21_conv;
45512                 val_conv_21_conv.inner = untag_ptr(val_conv_21);
45513                 val_conv_21_conv.is_owned = ptr_is_owned(val_conv_21);
45514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_21_conv);
45515                 val_conv_21_conv = OutboundHTLCDetails_clone(&val_conv_21_conv);
45516                 val_constr.data[v] = val_conv_21_conv;
45517         }
45518         FREE(val);
45519         ChannelDetails_set_pending_outbound_htlcs(&this_ptr_conv, val_constr);
45520 }
45521
45522 uint64_t  __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(uint64_t 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, uint64_tArray pending_inbound_htlcs_arg, uint64_tArray pending_outbound_htlcs_arg) {
45523         LDKChannelId channel_id_arg_conv;
45524         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
45525         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
45527         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
45528         LDKChannelCounterparty counterparty_arg_conv;
45529         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
45530         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
45531         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
45532         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
45533         LDKOutPoint funding_txo_arg_conv;
45534         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
45535         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
45536         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
45537         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
45538         LDKChannelTypeFeatures channel_type_arg_conv;
45539         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
45540         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
45541         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
45542         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
45543         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
45544         CHECK_ACCESS(short_channel_id_arg_ptr);
45545         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
45546         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
45547         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
45548         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
45549         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
45550         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
45551         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
45552         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
45553         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
45554         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
45555         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
45556         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
45557         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
45558         LDKU128 user_channel_id_arg_ref;
45559         CHECK(user_channel_id_arg->arr_len == 16);
45560         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
45561         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
45562         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
45563         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
45564         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
45565         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
45566         CHECK_ACCESS(confirmations_required_arg_ptr);
45567         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
45568         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
45569         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
45570         CHECK_ACCESS(confirmations_arg_ptr);
45571         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
45572         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
45573         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
45574         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
45575         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
45576         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
45577         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
45578         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
45579         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
45580         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
45581         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
45582         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
45583         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
45584         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
45585         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
45586         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
45587         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
45588         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
45589         LDKChannelConfig config_arg_conv;
45590         config_arg_conv.inner = untag_ptr(config_arg);
45591         config_arg_conv.is_owned = ptr_is_owned(config_arg);
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
45593         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
45594         LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg_constr;
45595         pending_inbound_htlcs_arg_constr.datalen = pending_inbound_htlcs_arg->arr_len;
45596         if (pending_inbound_htlcs_arg_constr.datalen > 0)
45597                 pending_inbound_htlcs_arg_constr.data = MALLOC(pending_inbound_htlcs_arg_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
45598         else
45599                 pending_inbound_htlcs_arg_constr.data = NULL;
45600         uint64_t* pending_inbound_htlcs_arg_vals = pending_inbound_htlcs_arg->elems;
45601         for (size_t u = 0; u < pending_inbound_htlcs_arg_constr.datalen; u++) {
45602                 uint64_t pending_inbound_htlcs_arg_conv_20 = pending_inbound_htlcs_arg_vals[u];
45603                 LDKInboundHTLCDetails pending_inbound_htlcs_arg_conv_20_conv;
45604                 pending_inbound_htlcs_arg_conv_20_conv.inner = untag_ptr(pending_inbound_htlcs_arg_conv_20);
45605                 pending_inbound_htlcs_arg_conv_20_conv.is_owned = ptr_is_owned(pending_inbound_htlcs_arg_conv_20);
45606                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_inbound_htlcs_arg_conv_20_conv);
45607                 pending_inbound_htlcs_arg_conv_20_conv = InboundHTLCDetails_clone(&pending_inbound_htlcs_arg_conv_20_conv);
45608                 pending_inbound_htlcs_arg_constr.data[u] = pending_inbound_htlcs_arg_conv_20_conv;
45609         }
45610         FREE(pending_inbound_htlcs_arg);
45611         LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg_constr;
45612         pending_outbound_htlcs_arg_constr.datalen = pending_outbound_htlcs_arg->arr_len;
45613         if (pending_outbound_htlcs_arg_constr.datalen > 0)
45614                 pending_outbound_htlcs_arg_constr.data = MALLOC(pending_outbound_htlcs_arg_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
45615         else
45616                 pending_outbound_htlcs_arg_constr.data = NULL;
45617         uint64_t* pending_outbound_htlcs_arg_vals = pending_outbound_htlcs_arg->elems;
45618         for (size_t v = 0; v < pending_outbound_htlcs_arg_constr.datalen; v++) {
45619                 uint64_t pending_outbound_htlcs_arg_conv_21 = pending_outbound_htlcs_arg_vals[v];
45620                 LDKOutboundHTLCDetails pending_outbound_htlcs_arg_conv_21_conv;
45621                 pending_outbound_htlcs_arg_conv_21_conv.inner = untag_ptr(pending_outbound_htlcs_arg_conv_21);
45622                 pending_outbound_htlcs_arg_conv_21_conv.is_owned = ptr_is_owned(pending_outbound_htlcs_arg_conv_21);
45623                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_outbound_htlcs_arg_conv_21_conv);
45624                 pending_outbound_htlcs_arg_conv_21_conv = OutboundHTLCDetails_clone(&pending_outbound_htlcs_arg_conv_21_conv);
45625                 pending_outbound_htlcs_arg_constr.data[v] = pending_outbound_htlcs_arg_conv_21_conv;
45626         }
45627         FREE(pending_outbound_htlcs_arg);
45628         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_conv, 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, pending_inbound_htlcs_arg_constr, pending_outbound_htlcs_arg_constr);
45629         uint64_t ret_ref = 0;
45630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45632         return ret_ref;
45633 }
45634
45635 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
45636         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
45637         uint64_t ret_ref = 0;
45638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45640         return ret_ref;
45641 }
45642 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
45643         LDKChannelDetails arg_conv;
45644         arg_conv.inner = untag_ptr(arg);
45645         arg_conv.is_owned = ptr_is_owned(arg);
45646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45647         arg_conv.is_owned = false;
45648         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
45649         return ret_conv;
45650 }
45651
45652 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
45653         LDKChannelDetails orig_conv;
45654         orig_conv.inner = untag_ptr(orig);
45655         orig_conv.is_owned = ptr_is_owned(orig);
45656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45657         orig_conv.is_owned = false;
45658         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
45659         uint64_t ret_ref = 0;
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45662         return ret_ref;
45663 }
45664
45665 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
45666         LDKChannelDetails this_arg_conv;
45667         this_arg_conv.inner = untag_ptr(this_arg);
45668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45670         this_arg_conv.is_owned = false;
45671         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45672         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
45673         uint64_t ret_ref = tag_ptr(ret_copy, true);
45674         return ret_ref;
45675 }
45676
45677 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
45678         LDKChannelDetails this_arg_conv;
45679         this_arg_conv.inner = untag_ptr(this_arg);
45680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45682         this_arg_conv.is_owned = false;
45683         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45684         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
45685         uint64_t ret_ref = tag_ptr(ret_copy, true);
45686         return ret_ref;
45687 }
45688
45689 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
45690         LDKChannelDetails obj_conv;
45691         obj_conv.inner = untag_ptr(obj);
45692         obj_conv.is_owned = ptr_is_owned(obj);
45693         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45694         obj_conv.is_owned = false;
45695         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
45696         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45697         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45698         CVec_u8Z_free(ret_var);
45699         return ret_arr;
45700 }
45701
45702 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
45703         LDKu8slice ser_ref;
45704         ser_ref.datalen = ser->arr_len;
45705         ser_ref.data = ser->elems;
45706         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
45707         *ret_conv = ChannelDetails_read(ser_ref);
45708         FREE(ser);
45709         return tag_ptr(ret_conv, true);
45710 }
45711
45712 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
45713         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
45714         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
45715         return ret_conv;
45716 }
45717
45718 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
45719         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
45720         return ret_conv;
45721 }
45722
45723 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
45724         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
45725         return ret_conv;
45726 }
45727
45728 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
45729         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
45730         return ret_conv;
45731 }
45732
45733 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
45734         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
45735         return ret_conv;
45736 }
45737
45738 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
45739         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
45740         return ret_conv;
45741 }
45742
45743 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
45744         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
45745         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
45746         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
45747         return ret_conv;
45748 }
45749
45750 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
45751         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
45752         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
45753         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45754         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45755         CVec_u8Z_free(ret_var);
45756         return ret_arr;
45757 }
45758
45759 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
45760         LDKu8slice ser_ref;
45761         ser_ref.datalen = ser->arr_len;
45762         ser_ref.data = ser->elems;
45763         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
45764         *ret_conv = ChannelShutdownState_read(ser_ref);
45765         FREE(ser);
45766         return tag_ptr(ret_conv, true);
45767 }
45768
45769 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
45770         LDKExpandedKey this_obj_conv;
45771         this_obj_conv.inner = untag_ptr(this_obj);
45772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45774         ExpandedKey_free(this_obj_conv);
45775 }
45776
45777 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
45778         uint8_t key_material_arr[32];
45779         CHECK(key_material->arr_len == 32);
45780         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
45781         uint8_t (*key_material_ref)[32] = &key_material_arr;
45782         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
45783         uint64_t ret_ref = 0;
45784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45786         return ret_ref;
45787 }
45788
45789 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) {
45790         LDKExpandedKey keys_conv;
45791         keys_conv.inner = untag_ptr(keys);
45792         keys_conv.is_owned = ptr_is_owned(keys);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
45794         keys_conv.is_owned = false;
45795         void* min_value_msat_ptr = untag_ptr(min_value_msat);
45796         CHECK_ACCESS(min_value_msat_ptr);
45797         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
45798         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
45799         void* entropy_source_ptr = untag_ptr(entropy_source);
45800         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
45801         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
45802         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
45803         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
45804         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
45805         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
45806         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
45807         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
45808         return tag_ptr(ret_conv, true);
45809 }
45810
45811 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) {
45812         LDKExpandedKey keys_conv;
45813         keys_conv.inner = untag_ptr(keys);
45814         keys_conv.is_owned = ptr_is_owned(keys);
45815         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
45816         keys_conv.is_owned = false;
45817         void* min_value_msat_ptr = untag_ptr(min_value_msat);
45818         CHECK_ACCESS(min_value_msat_ptr);
45819         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
45820         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
45821         LDKThirtyTwoBytes payment_hash_ref;
45822         CHECK(payment_hash->arr_len == 32);
45823         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
45824         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
45825         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
45826         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
45827         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
45828         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
45829         *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);
45830         return tag_ptr(ret_conv, true);
45831 }
45832
45833 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
45834         if (!ptr_is_owned(this_ptr)) return;
45835         void* this_ptr_ptr = untag_ptr(this_ptr);
45836         CHECK_ACCESS(this_ptr_ptr);
45837         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
45838         FREE(untag_ptr(this_ptr));
45839         DecodeError_free(this_ptr_conv);
45840 }
45841
45842 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
45843         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45844         *ret_copy = DecodeError_clone(arg);
45845         uint64_t ret_ref = tag_ptr(ret_copy, true);
45846         return ret_ref;
45847 }
45848 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
45849         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
45850         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
45851         return ret_conv;
45852 }
45853
45854 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
45855         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
45856         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45857         *ret_copy = DecodeError_clone(orig_conv);
45858         uint64_t ret_ref = tag_ptr(ret_copy, true);
45859         return ret_ref;
45860 }
45861
45862 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
45863         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45864         *ret_copy = DecodeError_unknown_version();
45865         uint64_t ret_ref = tag_ptr(ret_copy, true);
45866         return ret_ref;
45867 }
45868
45869 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
45870         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45871         *ret_copy = DecodeError_unknown_required_feature();
45872         uint64_t ret_ref = tag_ptr(ret_copy, true);
45873         return ret_ref;
45874 }
45875
45876 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
45877         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45878         *ret_copy = DecodeError_invalid_value();
45879         uint64_t ret_ref = tag_ptr(ret_copy, true);
45880         return ret_ref;
45881 }
45882
45883 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
45884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45885         *ret_copy = DecodeError_short_read();
45886         uint64_t ret_ref = tag_ptr(ret_copy, true);
45887         return ret_ref;
45888 }
45889
45890 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
45891         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45892         *ret_copy = DecodeError_bad_length_descriptor();
45893         uint64_t ret_ref = tag_ptr(ret_copy, true);
45894         return ret_ref;
45895 }
45896
45897 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
45898         LDKIOError a_conv = LDKIOError_from_js(a);
45899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45900         *ret_copy = DecodeError_io(a_conv);
45901         uint64_t ret_ref = tag_ptr(ret_copy, true);
45902         return ret_ref;
45903 }
45904
45905 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
45906         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45907         *ret_copy = DecodeError_unsupported_compression();
45908         uint64_t ret_ref = tag_ptr(ret_copy, true);
45909         return ret_ref;
45910 }
45911
45912 uint64_t  __attribute__((export_name("TS_DecodeError_dangerous_value"))) TS_DecodeError_dangerous_value() {
45913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
45914         *ret_copy = DecodeError_dangerous_value();
45915         uint64_t ret_ref = tag_ptr(ret_copy, true);
45916         return ret_ref;
45917 }
45918
45919 int64_t  __attribute__((export_name("TS_DecodeError_hash"))) TS_DecodeError_hash(uint64_t o) {
45920         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
45921         int64_t ret_conv = DecodeError_hash(o_conv);
45922         return ret_conv;
45923 }
45924
45925 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
45926         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
45927         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
45928         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
45929         return ret_conv;
45930 }
45931
45932 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
45933         LDKInit this_obj_conv;
45934         this_obj_conv.inner = untag_ptr(this_obj);
45935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45937         Init_free(this_obj_conv);
45938 }
45939
45940 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
45941         LDKInit this_ptr_conv;
45942         this_ptr_conv.inner = untag_ptr(this_ptr);
45943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45945         this_ptr_conv.is_owned = false;
45946         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
45947         uint64_t ret_ref = 0;
45948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45950         return ret_ref;
45951 }
45952
45953 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
45954         LDKInit this_ptr_conv;
45955         this_ptr_conv.inner = untag_ptr(this_ptr);
45956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45958         this_ptr_conv.is_owned = false;
45959         LDKInitFeatures val_conv;
45960         val_conv.inner = untag_ptr(val);
45961         val_conv.is_owned = ptr_is_owned(val);
45962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45963         val_conv = InitFeatures_clone(&val_conv);
45964         Init_set_features(&this_ptr_conv, val_conv);
45965 }
45966
45967 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
45968         LDKInit this_ptr_conv;
45969         this_ptr_conv.inner = untag_ptr(this_ptr);
45970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45972         this_ptr_conv.is_owned = false;
45973         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
45974         *ret_copy = Init_get_networks(&this_ptr_conv);
45975         uint64_t ret_ref = tag_ptr(ret_copy, true);
45976         return ret_ref;
45977 }
45978
45979 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
45980         LDKInit this_ptr_conv;
45981         this_ptr_conv.inner = untag_ptr(this_ptr);
45982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45984         this_ptr_conv.is_owned = false;
45985         void* val_ptr = untag_ptr(val);
45986         CHECK_ACCESS(val_ptr);
45987         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
45988         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
45989         Init_set_networks(&this_ptr_conv, val_conv);
45990 }
45991
45992 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
45993         LDKInit this_ptr_conv;
45994         this_ptr_conv.inner = untag_ptr(this_ptr);
45995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45997         this_ptr_conv.is_owned = false;
45998         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
45999         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
46000         uint64_t ret_ref = tag_ptr(ret_copy, true);
46001         return ret_ref;
46002 }
46003
46004 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
46005         LDKInit 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         void* val_ptr = untag_ptr(val);
46011         CHECK_ACCESS(val_ptr);
46012         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
46013         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
46014         Init_set_remote_network_address(&this_ptr_conv, val_conv);
46015 }
46016
46017 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) {
46018         LDKInitFeatures features_arg_conv;
46019         features_arg_conv.inner = untag_ptr(features_arg);
46020         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46021         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46022         features_arg_conv = InitFeatures_clone(&features_arg_conv);
46023         void* networks_arg_ptr = untag_ptr(networks_arg);
46024         CHECK_ACCESS(networks_arg_ptr);
46025         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
46026         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
46027         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
46028         CHECK_ACCESS(remote_network_address_arg_ptr);
46029         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
46030         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
46031         uint64_t ret_ref = 0;
46032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46034         return ret_ref;
46035 }
46036
46037 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
46038         LDKInit ret_var = Init_clone(arg);
46039         uint64_t ret_ref = 0;
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46042         return ret_ref;
46043 }
46044 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
46045         LDKInit arg_conv;
46046         arg_conv.inner = untag_ptr(arg);
46047         arg_conv.is_owned = ptr_is_owned(arg);
46048         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46049         arg_conv.is_owned = false;
46050         int64_t ret_conv = Init_clone_ptr(&arg_conv);
46051         return ret_conv;
46052 }
46053
46054 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
46055         LDKInit orig_conv;
46056         orig_conv.inner = untag_ptr(orig);
46057         orig_conv.is_owned = ptr_is_owned(orig);
46058         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46059         orig_conv.is_owned = false;
46060         LDKInit ret_var = Init_clone(&orig_conv);
46061         uint64_t ret_ref = 0;
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46064         return ret_ref;
46065 }
46066
46067 int64_t  __attribute__((export_name("TS_Init_hash"))) TS_Init_hash(uint64_t o) {
46068         LDKInit o_conv;
46069         o_conv.inner = untag_ptr(o);
46070         o_conv.is_owned = ptr_is_owned(o);
46071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46072         o_conv.is_owned = false;
46073         int64_t ret_conv = Init_hash(&o_conv);
46074         return ret_conv;
46075 }
46076
46077 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
46078         LDKInit a_conv;
46079         a_conv.inner = untag_ptr(a);
46080         a_conv.is_owned = ptr_is_owned(a);
46081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46082         a_conv.is_owned = false;
46083         LDKInit b_conv;
46084         b_conv.inner = untag_ptr(b);
46085         b_conv.is_owned = ptr_is_owned(b);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46087         b_conv.is_owned = false;
46088         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
46089         return ret_conv;
46090 }
46091
46092 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
46093         LDKErrorMessage this_obj_conv;
46094         this_obj_conv.inner = untag_ptr(this_obj);
46095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46097         ErrorMessage_free(this_obj_conv);
46098 }
46099
46100 uint64_t  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
46101         LDKErrorMessage this_ptr_conv;
46102         this_ptr_conv.inner = untag_ptr(this_ptr);
46103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46105         this_ptr_conv.is_owned = false;
46106         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
46107         uint64_t ret_ref = 0;
46108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46110         return ret_ref;
46111 }
46112
46113 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, uint64_t val) {
46114         LDKErrorMessage this_ptr_conv;
46115         this_ptr_conv.inner = untag_ptr(this_ptr);
46116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46118         this_ptr_conv.is_owned = false;
46119         LDKChannelId val_conv;
46120         val_conv.inner = untag_ptr(val);
46121         val_conv.is_owned = ptr_is_owned(val);
46122         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46123         val_conv = ChannelId_clone(&val_conv);
46124         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
46125 }
46126
46127 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
46128         LDKErrorMessage this_ptr_conv;
46129         this_ptr_conv.inner = untag_ptr(this_ptr);
46130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46132         this_ptr_conv.is_owned = false;
46133         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
46134         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46135         Str_free(ret_str);
46136         return ret_conv;
46137 }
46138
46139 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
46140         LDKErrorMessage this_ptr_conv;
46141         this_ptr_conv.inner = untag_ptr(this_ptr);
46142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46144         this_ptr_conv.is_owned = false;
46145         LDKStr val_conv = str_ref_to_owned_c(val);
46146         ErrorMessage_set_data(&this_ptr_conv, val_conv);
46147 }
46148
46149 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(uint64_t channel_id_arg, jstring data_arg) {
46150         LDKChannelId channel_id_arg_conv;
46151         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
46152         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
46153         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
46154         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
46155         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
46156         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
46157         uint64_t ret_ref = 0;
46158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46160         return ret_ref;
46161 }
46162
46163 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
46164         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
46165         uint64_t ret_ref = 0;
46166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46168         return ret_ref;
46169 }
46170 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
46171         LDKErrorMessage arg_conv;
46172         arg_conv.inner = untag_ptr(arg);
46173         arg_conv.is_owned = ptr_is_owned(arg);
46174         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46175         arg_conv.is_owned = false;
46176         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
46177         return ret_conv;
46178 }
46179
46180 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
46181         LDKErrorMessage orig_conv;
46182         orig_conv.inner = untag_ptr(orig);
46183         orig_conv.is_owned = ptr_is_owned(orig);
46184         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46185         orig_conv.is_owned = false;
46186         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
46187         uint64_t ret_ref = 0;
46188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46190         return ret_ref;
46191 }
46192
46193 int64_t  __attribute__((export_name("TS_ErrorMessage_hash"))) TS_ErrorMessage_hash(uint64_t o) {
46194         LDKErrorMessage o_conv;
46195         o_conv.inner = untag_ptr(o);
46196         o_conv.is_owned = ptr_is_owned(o);
46197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46198         o_conv.is_owned = false;
46199         int64_t ret_conv = ErrorMessage_hash(&o_conv);
46200         return ret_conv;
46201 }
46202
46203 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
46204         LDKErrorMessage a_conv;
46205         a_conv.inner = untag_ptr(a);
46206         a_conv.is_owned = ptr_is_owned(a);
46207         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46208         a_conv.is_owned = false;
46209         LDKErrorMessage b_conv;
46210         b_conv.inner = untag_ptr(b);
46211         b_conv.is_owned = ptr_is_owned(b);
46212         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46213         b_conv.is_owned = false;
46214         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
46215         return ret_conv;
46216 }
46217
46218 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
46219         LDKWarningMessage this_obj_conv;
46220         this_obj_conv.inner = untag_ptr(this_obj);
46221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46223         WarningMessage_free(this_obj_conv);
46224 }
46225
46226 uint64_t  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
46227         LDKWarningMessage this_ptr_conv;
46228         this_ptr_conv.inner = untag_ptr(this_ptr);
46229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46231         this_ptr_conv.is_owned = false;
46232         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
46233         uint64_t ret_ref = 0;
46234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46236         return ret_ref;
46237 }
46238
46239 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, uint64_t val) {
46240         LDKWarningMessage this_ptr_conv;
46241         this_ptr_conv.inner = untag_ptr(this_ptr);
46242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46244         this_ptr_conv.is_owned = false;
46245         LDKChannelId val_conv;
46246         val_conv.inner = untag_ptr(val);
46247         val_conv.is_owned = ptr_is_owned(val);
46248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46249         val_conv = ChannelId_clone(&val_conv);
46250         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
46251 }
46252
46253 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
46254         LDKWarningMessage this_ptr_conv;
46255         this_ptr_conv.inner = untag_ptr(this_ptr);
46256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46258         this_ptr_conv.is_owned = false;
46259         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
46260         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46261         Str_free(ret_str);
46262         return ret_conv;
46263 }
46264
46265 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
46266         LDKWarningMessage this_ptr_conv;
46267         this_ptr_conv.inner = untag_ptr(this_ptr);
46268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46270         this_ptr_conv.is_owned = false;
46271         LDKStr val_conv = str_ref_to_owned_c(val);
46272         WarningMessage_set_data(&this_ptr_conv, val_conv);
46273 }
46274
46275 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(uint64_t channel_id_arg, jstring data_arg) {
46276         LDKChannelId channel_id_arg_conv;
46277         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
46278         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
46279         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
46280         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
46281         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
46282         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
46283         uint64_t ret_ref = 0;
46284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46286         return ret_ref;
46287 }
46288
46289 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
46290         LDKWarningMessage ret_var = WarningMessage_clone(arg);
46291         uint64_t ret_ref = 0;
46292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46294         return ret_ref;
46295 }
46296 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
46297         LDKWarningMessage arg_conv;
46298         arg_conv.inner = untag_ptr(arg);
46299         arg_conv.is_owned = ptr_is_owned(arg);
46300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46301         arg_conv.is_owned = false;
46302         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
46303         return ret_conv;
46304 }
46305
46306 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
46307         LDKWarningMessage orig_conv;
46308         orig_conv.inner = untag_ptr(orig);
46309         orig_conv.is_owned = ptr_is_owned(orig);
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46311         orig_conv.is_owned = false;
46312         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
46313         uint64_t ret_ref = 0;
46314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46316         return ret_ref;
46317 }
46318
46319 int64_t  __attribute__((export_name("TS_WarningMessage_hash"))) TS_WarningMessage_hash(uint64_t o) {
46320         LDKWarningMessage o_conv;
46321         o_conv.inner = untag_ptr(o);
46322         o_conv.is_owned = ptr_is_owned(o);
46323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46324         o_conv.is_owned = false;
46325         int64_t ret_conv = WarningMessage_hash(&o_conv);
46326         return ret_conv;
46327 }
46328
46329 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
46330         LDKWarningMessage a_conv;
46331         a_conv.inner = untag_ptr(a);
46332         a_conv.is_owned = ptr_is_owned(a);
46333         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46334         a_conv.is_owned = false;
46335         LDKWarningMessage b_conv;
46336         b_conv.inner = untag_ptr(b);
46337         b_conv.is_owned = ptr_is_owned(b);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46339         b_conv.is_owned = false;
46340         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
46341         return ret_conv;
46342 }
46343
46344 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
46345         LDKPing this_obj_conv;
46346         this_obj_conv.inner = untag_ptr(this_obj);
46347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46349         Ping_free(this_obj_conv);
46350 }
46351
46352 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
46353         LDKPing this_ptr_conv;
46354         this_ptr_conv.inner = untag_ptr(this_ptr);
46355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46357         this_ptr_conv.is_owned = false;
46358         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
46359         return ret_conv;
46360 }
46361
46362 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
46363         LDKPing this_ptr_conv;
46364         this_ptr_conv.inner = untag_ptr(this_ptr);
46365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46367         this_ptr_conv.is_owned = false;
46368         Ping_set_ponglen(&this_ptr_conv, val);
46369 }
46370
46371 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
46372         LDKPing this_ptr_conv;
46373         this_ptr_conv.inner = untag_ptr(this_ptr);
46374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46376         this_ptr_conv.is_owned = false;
46377         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
46378         return ret_conv;
46379 }
46380
46381 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
46382         LDKPing this_ptr_conv;
46383         this_ptr_conv.inner = untag_ptr(this_ptr);
46384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46386         this_ptr_conv.is_owned = false;
46387         Ping_set_byteslen(&this_ptr_conv, val);
46388 }
46389
46390 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
46391         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
46392         uint64_t ret_ref = 0;
46393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46395         return ret_ref;
46396 }
46397
46398 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
46399         LDKPing ret_var = Ping_clone(arg);
46400         uint64_t ret_ref = 0;
46401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46403         return ret_ref;
46404 }
46405 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
46406         LDKPing arg_conv;
46407         arg_conv.inner = untag_ptr(arg);
46408         arg_conv.is_owned = ptr_is_owned(arg);
46409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46410         arg_conv.is_owned = false;
46411         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
46412         return ret_conv;
46413 }
46414
46415 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
46416         LDKPing orig_conv;
46417         orig_conv.inner = untag_ptr(orig);
46418         orig_conv.is_owned = ptr_is_owned(orig);
46419         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46420         orig_conv.is_owned = false;
46421         LDKPing ret_var = Ping_clone(&orig_conv);
46422         uint64_t ret_ref = 0;
46423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46425         return ret_ref;
46426 }
46427
46428 int64_t  __attribute__((export_name("TS_Ping_hash"))) TS_Ping_hash(uint64_t o) {
46429         LDKPing o_conv;
46430         o_conv.inner = untag_ptr(o);
46431         o_conv.is_owned = ptr_is_owned(o);
46432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46433         o_conv.is_owned = false;
46434         int64_t ret_conv = Ping_hash(&o_conv);
46435         return ret_conv;
46436 }
46437
46438 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
46439         LDKPing a_conv;
46440         a_conv.inner = untag_ptr(a);
46441         a_conv.is_owned = ptr_is_owned(a);
46442         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46443         a_conv.is_owned = false;
46444         LDKPing b_conv;
46445         b_conv.inner = untag_ptr(b);
46446         b_conv.is_owned = ptr_is_owned(b);
46447         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46448         b_conv.is_owned = false;
46449         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
46450         return ret_conv;
46451 }
46452
46453 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
46454         LDKPong this_obj_conv;
46455         this_obj_conv.inner = untag_ptr(this_obj);
46456         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46458         Pong_free(this_obj_conv);
46459 }
46460
46461 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
46462         LDKPong this_ptr_conv;
46463         this_ptr_conv.inner = untag_ptr(this_ptr);
46464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46466         this_ptr_conv.is_owned = false;
46467         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
46468         return ret_conv;
46469 }
46470
46471 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
46472         LDKPong this_ptr_conv;
46473         this_ptr_conv.inner = untag_ptr(this_ptr);
46474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46476         this_ptr_conv.is_owned = false;
46477         Pong_set_byteslen(&this_ptr_conv, val);
46478 }
46479
46480 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
46481         LDKPong ret_var = Pong_new(byteslen_arg);
46482         uint64_t ret_ref = 0;
46483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46485         return ret_ref;
46486 }
46487
46488 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
46489         LDKPong ret_var = Pong_clone(arg);
46490         uint64_t ret_ref = 0;
46491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46493         return ret_ref;
46494 }
46495 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
46496         LDKPong arg_conv;
46497         arg_conv.inner = untag_ptr(arg);
46498         arg_conv.is_owned = ptr_is_owned(arg);
46499         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46500         arg_conv.is_owned = false;
46501         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
46502         return ret_conv;
46503 }
46504
46505 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
46506         LDKPong orig_conv;
46507         orig_conv.inner = untag_ptr(orig);
46508         orig_conv.is_owned = ptr_is_owned(orig);
46509         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46510         orig_conv.is_owned = false;
46511         LDKPong ret_var = Pong_clone(&orig_conv);
46512         uint64_t ret_ref = 0;
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46515         return ret_ref;
46516 }
46517
46518 int64_t  __attribute__((export_name("TS_Pong_hash"))) TS_Pong_hash(uint64_t o) {
46519         LDKPong o_conv;
46520         o_conv.inner = untag_ptr(o);
46521         o_conv.is_owned = ptr_is_owned(o);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46523         o_conv.is_owned = false;
46524         int64_t ret_conv = Pong_hash(&o_conv);
46525         return ret_conv;
46526 }
46527
46528 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
46529         LDKPong a_conv;
46530         a_conv.inner = untag_ptr(a);
46531         a_conv.is_owned = ptr_is_owned(a);
46532         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46533         a_conv.is_owned = false;
46534         LDKPong b_conv;
46535         b_conv.inner = untag_ptr(b);
46536         b_conv.is_owned = ptr_is_owned(b);
46537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46538         b_conv.is_owned = false;
46539         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
46540         return ret_conv;
46541 }
46542
46543 void  __attribute__((export_name("TS_CommonOpenChannelFields_free"))) TS_CommonOpenChannelFields_free(uint64_t this_obj) {
46544         LDKCommonOpenChannelFields this_obj_conv;
46545         this_obj_conv.inner = untag_ptr(this_obj);
46546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46548         CommonOpenChannelFields_free(this_obj_conv);
46549 }
46550
46551 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_chain_hash"))) TS_CommonOpenChannelFields_get_chain_hash(uint64_t this_ptr) {
46552         LDKCommonOpenChannelFields this_ptr_conv;
46553         this_ptr_conv.inner = untag_ptr(this_ptr);
46554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46556         this_ptr_conv.is_owned = false;
46557         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46558         memcpy(ret_arr->elems, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv), 32);
46559         return ret_arr;
46560 }
46561
46562 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_chain_hash"))) TS_CommonOpenChannelFields_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
46563         LDKCommonOpenChannelFields this_ptr_conv;
46564         this_ptr_conv.inner = untag_ptr(this_ptr);
46565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46567         this_ptr_conv.is_owned = false;
46568         LDKThirtyTwoBytes val_ref;
46569         CHECK(val->arr_len == 32);
46570         memcpy(val_ref.data, val->elems, 32); FREE(val);
46571         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
46572 }
46573
46574 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_temporary_channel_id"))) TS_CommonOpenChannelFields_get_temporary_channel_id(uint64_t this_ptr) {
46575         LDKCommonOpenChannelFields this_ptr_conv;
46576         this_ptr_conv.inner = untag_ptr(this_ptr);
46577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46579         this_ptr_conv.is_owned = false;
46580         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
46581         uint64_t ret_ref = 0;
46582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46584         return ret_ref;
46585 }
46586
46587 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_temporary_channel_id"))) TS_CommonOpenChannelFields_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
46588         LDKCommonOpenChannelFields this_ptr_conv;
46589         this_ptr_conv.inner = untag_ptr(this_ptr);
46590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46592         this_ptr_conv.is_owned = false;
46593         LDKChannelId val_conv;
46594         val_conv.inner = untag_ptr(val);
46595         val_conv.is_owned = ptr_is_owned(val);
46596         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46597         val_conv = ChannelId_clone(&val_conv);
46598         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
46599 }
46600
46601 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_funding_satoshis"))) TS_CommonOpenChannelFields_get_funding_satoshis(uint64_t this_ptr) {
46602         LDKCommonOpenChannelFields this_ptr_conv;
46603         this_ptr_conv.inner = untag_ptr(this_ptr);
46604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46606         this_ptr_conv.is_owned = false;
46607         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
46608         return ret_conv;
46609 }
46610
46611 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_funding_satoshis"))) TS_CommonOpenChannelFields_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
46612         LDKCommonOpenChannelFields this_ptr_conv;
46613         this_ptr_conv.inner = untag_ptr(this_ptr);
46614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46616         this_ptr_conv.is_owned = false;
46617         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
46618 }
46619
46620 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_dust_limit_satoshis"))) TS_CommonOpenChannelFields_get_dust_limit_satoshis(uint64_t this_ptr) {
46621         LDKCommonOpenChannelFields this_ptr_conv;
46622         this_ptr_conv.inner = untag_ptr(this_ptr);
46623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46625         this_ptr_conv.is_owned = false;
46626         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
46627         return ret_conv;
46628 }
46629
46630 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_dust_limit_satoshis"))) TS_CommonOpenChannelFields_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
46631         LDKCommonOpenChannelFields this_ptr_conv;
46632         this_ptr_conv.inner = untag_ptr(this_ptr);
46633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46635         this_ptr_conv.is_owned = false;
46636         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
46637 }
46638
46639 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_max_htlc_value_in_flight_msat"))) TS_CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
46640         LDKCommonOpenChannelFields this_ptr_conv;
46641         this_ptr_conv.inner = untag_ptr(this_ptr);
46642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46644         this_ptr_conv.is_owned = false;
46645         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
46646         return ret_conv;
46647 }
46648
46649 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_max_htlc_value_in_flight_msat"))) TS_CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
46650         LDKCommonOpenChannelFields this_ptr_conv;
46651         this_ptr_conv.inner = untag_ptr(this_ptr);
46652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46654         this_ptr_conv.is_owned = false;
46655         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
46656 }
46657
46658 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_htlc_minimum_msat"))) TS_CommonOpenChannelFields_get_htlc_minimum_msat(uint64_t this_ptr) {
46659         LDKCommonOpenChannelFields this_ptr_conv;
46660         this_ptr_conv.inner = untag_ptr(this_ptr);
46661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46663         this_ptr_conv.is_owned = false;
46664         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
46665         return ret_conv;
46666 }
46667
46668 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_htlc_minimum_msat"))) TS_CommonOpenChannelFields_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
46669         LDKCommonOpenChannelFields this_ptr_conv;
46670         this_ptr_conv.inner = untag_ptr(this_ptr);
46671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46673         this_ptr_conv.is_owned = false;
46674         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
46675 }
46676
46677 int32_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight"))) TS_CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(uint64_t this_ptr) {
46678         LDKCommonOpenChannelFields this_ptr_conv;
46679         this_ptr_conv.inner = untag_ptr(this_ptr);
46680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46682         this_ptr_conv.is_owned = false;
46683         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
46684         return ret_conv;
46685 }
46686
46687 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight"))) TS_CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(uint64_t this_ptr, int32_t val) {
46688         LDKCommonOpenChannelFields this_ptr_conv;
46689         this_ptr_conv.inner = untag_ptr(this_ptr);
46690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46692         this_ptr_conv.is_owned = false;
46693         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
46694 }
46695
46696 int16_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_to_self_delay"))) TS_CommonOpenChannelFields_get_to_self_delay(uint64_t this_ptr) {
46697         LDKCommonOpenChannelFields this_ptr_conv;
46698         this_ptr_conv.inner = untag_ptr(this_ptr);
46699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46701         this_ptr_conv.is_owned = false;
46702         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
46703         return ret_conv;
46704 }
46705
46706 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_to_self_delay"))) TS_CommonOpenChannelFields_set_to_self_delay(uint64_t this_ptr, int16_t val) {
46707         LDKCommonOpenChannelFields this_ptr_conv;
46708         this_ptr_conv.inner = untag_ptr(this_ptr);
46709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46711         this_ptr_conv.is_owned = false;
46712         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
46713 }
46714
46715 int16_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_max_accepted_htlcs"))) TS_CommonOpenChannelFields_get_max_accepted_htlcs(uint64_t this_ptr) {
46716         LDKCommonOpenChannelFields this_ptr_conv;
46717         this_ptr_conv.inner = untag_ptr(this_ptr);
46718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46720         this_ptr_conv.is_owned = false;
46721         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
46722         return ret_conv;
46723 }
46724
46725 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_max_accepted_htlcs"))) TS_CommonOpenChannelFields_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
46726         LDKCommonOpenChannelFields this_ptr_conv;
46727         this_ptr_conv.inner = untag_ptr(this_ptr);
46728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46730         this_ptr_conv.is_owned = false;
46731         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
46732 }
46733
46734 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_funding_pubkey"))) TS_CommonOpenChannelFields_get_funding_pubkey(uint64_t this_ptr) {
46735         LDKCommonOpenChannelFields this_ptr_conv;
46736         this_ptr_conv.inner = untag_ptr(this_ptr);
46737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46739         this_ptr_conv.is_owned = false;
46740         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46741         memcpy(ret_arr->elems, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
46742         return ret_arr;
46743 }
46744
46745 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_funding_pubkey"))) TS_CommonOpenChannelFields_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
46746         LDKCommonOpenChannelFields this_ptr_conv;
46747         this_ptr_conv.inner = untag_ptr(this_ptr);
46748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46750         this_ptr_conv.is_owned = false;
46751         LDKPublicKey val_ref;
46752         CHECK(val->arr_len == 33);
46753         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46754         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
46755 }
46756
46757 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_revocation_basepoint"))) TS_CommonOpenChannelFields_get_revocation_basepoint(uint64_t this_ptr) {
46758         LDKCommonOpenChannelFields this_ptr_conv;
46759         this_ptr_conv.inner = untag_ptr(this_ptr);
46760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46762         this_ptr_conv.is_owned = false;
46763         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46764         memcpy(ret_arr->elems, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
46765         return ret_arr;
46766 }
46767
46768 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_revocation_basepoint"))) TS_CommonOpenChannelFields_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
46769         LDKCommonOpenChannelFields this_ptr_conv;
46770         this_ptr_conv.inner = untag_ptr(this_ptr);
46771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46773         this_ptr_conv.is_owned = false;
46774         LDKPublicKey val_ref;
46775         CHECK(val->arr_len == 33);
46776         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46777         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
46778 }
46779
46780 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_payment_basepoint"))) TS_CommonOpenChannelFields_get_payment_basepoint(uint64_t this_ptr) {
46781         LDKCommonOpenChannelFields this_ptr_conv;
46782         this_ptr_conv.inner = untag_ptr(this_ptr);
46783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46785         this_ptr_conv.is_owned = false;
46786         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46787         memcpy(ret_arr->elems, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46788         return ret_arr;
46789 }
46790
46791 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_payment_basepoint"))) TS_CommonOpenChannelFields_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
46792         LDKCommonOpenChannelFields this_ptr_conv;
46793         this_ptr_conv.inner = untag_ptr(this_ptr);
46794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46796         this_ptr_conv.is_owned = false;
46797         LDKPublicKey val_ref;
46798         CHECK(val->arr_len == 33);
46799         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46800         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
46801 }
46802
46803 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_delayed_payment_basepoint"))) TS_CommonOpenChannelFields_get_delayed_payment_basepoint(uint64_t this_ptr) {
46804         LDKCommonOpenChannelFields this_ptr_conv;
46805         this_ptr_conv.inner = untag_ptr(this_ptr);
46806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46808         this_ptr_conv.is_owned = false;
46809         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46810         memcpy(ret_arr->elems, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46811         return ret_arr;
46812 }
46813
46814 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_delayed_payment_basepoint"))) TS_CommonOpenChannelFields_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
46815         LDKCommonOpenChannelFields this_ptr_conv;
46816         this_ptr_conv.inner = untag_ptr(this_ptr);
46817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46819         this_ptr_conv.is_owned = false;
46820         LDKPublicKey val_ref;
46821         CHECK(val->arr_len == 33);
46822         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46823         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
46824 }
46825
46826 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_htlc_basepoint"))) TS_CommonOpenChannelFields_get_htlc_basepoint(uint64_t this_ptr) {
46827         LDKCommonOpenChannelFields this_ptr_conv;
46828         this_ptr_conv.inner = untag_ptr(this_ptr);
46829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46831         this_ptr_conv.is_owned = false;
46832         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46833         memcpy(ret_arr->elems, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
46834         return ret_arr;
46835 }
46836
46837 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_htlc_basepoint"))) TS_CommonOpenChannelFields_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
46838         LDKCommonOpenChannelFields this_ptr_conv;
46839         this_ptr_conv.inner = untag_ptr(this_ptr);
46840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46842         this_ptr_conv.is_owned = false;
46843         LDKPublicKey val_ref;
46844         CHECK(val->arr_len == 33);
46845         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46846         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
46847 }
46848
46849 int8_tArray  __attribute__((export_name("TS_CommonOpenChannelFields_get_first_per_commitment_point"))) TS_CommonOpenChannelFields_get_first_per_commitment_point(uint64_t this_ptr) {
46850         LDKCommonOpenChannelFields this_ptr_conv;
46851         this_ptr_conv.inner = untag_ptr(this_ptr);
46852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46854         this_ptr_conv.is_owned = false;
46855         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46856         memcpy(ret_arr->elems, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46857         return ret_arr;
46858 }
46859
46860 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_first_per_commitment_point"))) TS_CommonOpenChannelFields_set_first_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
46861         LDKCommonOpenChannelFields this_ptr_conv;
46862         this_ptr_conv.inner = untag_ptr(this_ptr);
46863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46865         this_ptr_conv.is_owned = false;
46866         LDKPublicKey val_ref;
46867         CHECK(val->arr_len == 33);
46868         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46869         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
46870 }
46871
46872 int8_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_channel_flags"))) TS_CommonOpenChannelFields_get_channel_flags(uint64_t this_ptr) {
46873         LDKCommonOpenChannelFields this_ptr_conv;
46874         this_ptr_conv.inner = untag_ptr(this_ptr);
46875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46877         this_ptr_conv.is_owned = false;
46878         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
46879         return ret_conv;
46880 }
46881
46882 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_channel_flags"))) TS_CommonOpenChannelFields_set_channel_flags(uint64_t this_ptr, int8_t val) {
46883         LDKCommonOpenChannelFields this_ptr_conv;
46884         this_ptr_conv.inner = untag_ptr(this_ptr);
46885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46887         this_ptr_conv.is_owned = false;
46888         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
46889 }
46890
46891 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_shutdown_scriptpubkey"))) TS_CommonOpenChannelFields_get_shutdown_scriptpubkey(uint64_t this_ptr) {
46892         LDKCommonOpenChannelFields this_ptr_conv;
46893         this_ptr_conv.inner = untag_ptr(this_ptr);
46894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46896         this_ptr_conv.is_owned = false;
46897         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
46898         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
46899         uint64_t ret_ref = tag_ptr(ret_copy, true);
46900         return ret_ref;
46901 }
46902
46903 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_shutdown_scriptpubkey"))) TS_CommonOpenChannelFields_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
46904         LDKCommonOpenChannelFields this_ptr_conv;
46905         this_ptr_conv.inner = untag_ptr(this_ptr);
46906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46908         this_ptr_conv.is_owned = false;
46909         void* val_ptr = untag_ptr(val);
46910         CHECK_ACCESS(val_ptr);
46911         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
46912         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
46913         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
46914 }
46915
46916 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_get_channel_type"))) TS_CommonOpenChannelFields_get_channel_type(uint64_t this_ptr) {
46917         LDKCommonOpenChannelFields this_ptr_conv;
46918         this_ptr_conv.inner = untag_ptr(this_ptr);
46919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46921         this_ptr_conv.is_owned = false;
46922         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
46923         uint64_t ret_ref = 0;
46924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46926         return ret_ref;
46927 }
46928
46929 void  __attribute__((export_name("TS_CommonOpenChannelFields_set_channel_type"))) TS_CommonOpenChannelFields_set_channel_type(uint64_t this_ptr, uint64_t val) {
46930         LDKCommonOpenChannelFields this_ptr_conv;
46931         this_ptr_conv.inner = untag_ptr(this_ptr);
46932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46934         this_ptr_conv.is_owned = false;
46935         LDKChannelTypeFeatures val_conv;
46936         val_conv.inner = untag_ptr(val);
46937         val_conv.is_owned = ptr_is_owned(val);
46938         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46939         val_conv = ChannelTypeFeatures_clone(&val_conv);
46940         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
46941 }
46942
46943 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_new"))) TS_CommonOpenChannelFields_new(int8_tArray chain_hash_arg, uint64_t 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 commitment_feerate_sat_per_1000_weight_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_t channel_flags_arg, uint64_t shutdown_scriptpubkey_arg, uint64_t channel_type_arg) {
46944         LDKThirtyTwoBytes chain_hash_arg_ref;
46945         CHECK(chain_hash_arg->arr_len == 32);
46946         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
46947         LDKChannelId temporary_channel_id_arg_conv;
46948         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46949         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46951         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46952         LDKPublicKey funding_pubkey_arg_ref;
46953         CHECK(funding_pubkey_arg->arr_len == 33);
46954         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
46955         LDKPublicKey revocation_basepoint_arg_ref;
46956         CHECK(revocation_basepoint_arg->arr_len == 33);
46957         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
46958         LDKPublicKey payment_basepoint_arg_ref;
46959         CHECK(payment_basepoint_arg->arr_len == 33);
46960         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
46961         LDKPublicKey delayed_payment_basepoint_arg_ref;
46962         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
46963         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
46964         LDKPublicKey htlc_basepoint_arg_ref;
46965         CHECK(htlc_basepoint_arg->arr_len == 33);
46966         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
46967         LDKPublicKey first_per_commitment_point_arg_ref;
46968         CHECK(first_per_commitment_point_arg->arr_len == 33);
46969         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
46970         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
46971         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
46972         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
46973         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
46974         LDKChannelTypeFeatures channel_type_arg_conv;
46975         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
46976         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
46977         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
46978         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
46979         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_new(chain_hash_arg_ref, temporary_channel_id_arg_conv, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_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, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
46980         uint64_t ret_ref = 0;
46981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46983         return ret_ref;
46984 }
46985
46986 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
46987         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
46988         uint64_t ret_ref = 0;
46989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46991         return ret_ref;
46992 }
46993 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_clone_ptr"))) TS_CommonOpenChannelFields_clone_ptr(uint64_t arg) {
46994         LDKCommonOpenChannelFields arg_conv;
46995         arg_conv.inner = untag_ptr(arg);
46996         arg_conv.is_owned = ptr_is_owned(arg);
46997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46998         arg_conv.is_owned = false;
46999         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
47000         return ret_conv;
47001 }
47002
47003 uint64_t  __attribute__((export_name("TS_CommonOpenChannelFields_clone"))) TS_CommonOpenChannelFields_clone(uint64_t orig) {
47004         LDKCommonOpenChannelFields orig_conv;
47005         orig_conv.inner = untag_ptr(orig);
47006         orig_conv.is_owned = ptr_is_owned(orig);
47007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47008         orig_conv.is_owned = false;
47009         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
47010         uint64_t ret_ref = 0;
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47013         return ret_ref;
47014 }
47015
47016 int64_t  __attribute__((export_name("TS_CommonOpenChannelFields_hash"))) TS_CommonOpenChannelFields_hash(uint64_t o) {
47017         LDKCommonOpenChannelFields o_conv;
47018         o_conv.inner = untag_ptr(o);
47019         o_conv.is_owned = ptr_is_owned(o);
47020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47021         o_conv.is_owned = false;
47022         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
47023         return ret_conv;
47024 }
47025
47026 jboolean  __attribute__((export_name("TS_CommonOpenChannelFields_eq"))) TS_CommonOpenChannelFields_eq(uint64_t a, uint64_t b) {
47027         LDKCommonOpenChannelFields a_conv;
47028         a_conv.inner = untag_ptr(a);
47029         a_conv.is_owned = ptr_is_owned(a);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47031         a_conv.is_owned = false;
47032         LDKCommonOpenChannelFields b_conv;
47033         b_conv.inner = untag_ptr(b);
47034         b_conv.is_owned = ptr_is_owned(b);
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47036         b_conv.is_owned = false;
47037         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
47038         return ret_conv;
47039 }
47040
47041 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
47042         LDKOpenChannel this_obj_conv;
47043         this_obj_conv.inner = untag_ptr(this_obj);
47044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47046         OpenChannel_free(this_obj_conv);
47047 }
47048
47049 uint64_t  __attribute__((export_name("TS_OpenChannel_get_common_fields"))) TS_OpenChannel_get_common_fields(uint64_t this_ptr) {
47050         LDKOpenChannel this_ptr_conv;
47051         this_ptr_conv.inner = untag_ptr(this_ptr);
47052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47054         this_ptr_conv.is_owned = false;
47055         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
47056         uint64_t ret_ref = 0;
47057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47059         return ret_ref;
47060 }
47061
47062 void  __attribute__((export_name("TS_OpenChannel_set_common_fields"))) TS_OpenChannel_set_common_fields(uint64_t this_ptr, uint64_t val) {
47063         LDKOpenChannel this_ptr_conv;
47064         this_ptr_conv.inner = untag_ptr(this_ptr);
47065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47067         this_ptr_conv.is_owned = false;
47068         LDKCommonOpenChannelFields val_conv;
47069         val_conv.inner = untag_ptr(val);
47070         val_conv.is_owned = ptr_is_owned(val);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47072         val_conv = CommonOpenChannelFields_clone(&val_conv);
47073         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
47074 }
47075
47076 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
47077         LDKOpenChannel this_ptr_conv;
47078         this_ptr_conv.inner = untag_ptr(this_ptr);
47079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47081         this_ptr_conv.is_owned = false;
47082         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
47083         return ret_conv;
47084 }
47085
47086 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
47087         LDKOpenChannel this_ptr_conv;
47088         this_ptr_conv.inner = untag_ptr(this_ptr);
47089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47091         this_ptr_conv.is_owned = false;
47092         OpenChannel_set_push_msat(&this_ptr_conv, val);
47093 }
47094
47095 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
47096         LDKOpenChannel this_ptr_conv;
47097         this_ptr_conv.inner = untag_ptr(this_ptr);
47098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47100         this_ptr_conv.is_owned = false;
47101         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
47102         return ret_conv;
47103 }
47104
47105 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
47106         LDKOpenChannel this_ptr_conv;
47107         this_ptr_conv.inner = untag_ptr(this_ptr);
47108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47110         this_ptr_conv.is_owned = false;
47111         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
47112 }
47113
47114 uint64_t  __attribute__((export_name("TS_OpenChannel_new"))) TS_OpenChannel_new(uint64_t common_fields_arg, int64_t push_msat_arg, int64_t channel_reserve_satoshis_arg) {
47115         LDKCommonOpenChannelFields common_fields_arg_conv;
47116         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
47117         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
47118         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
47119         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
47120         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
47121         uint64_t ret_ref = 0;
47122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47124         return ret_ref;
47125 }
47126
47127 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
47128         LDKOpenChannel ret_var = OpenChannel_clone(arg);
47129         uint64_t ret_ref = 0;
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47132         return ret_ref;
47133 }
47134 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
47135         LDKOpenChannel arg_conv;
47136         arg_conv.inner = untag_ptr(arg);
47137         arg_conv.is_owned = ptr_is_owned(arg);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47139         arg_conv.is_owned = false;
47140         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
47141         return ret_conv;
47142 }
47143
47144 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
47145         LDKOpenChannel orig_conv;
47146         orig_conv.inner = untag_ptr(orig);
47147         orig_conv.is_owned = ptr_is_owned(orig);
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47149         orig_conv.is_owned = false;
47150         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
47151         uint64_t ret_ref = 0;
47152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47154         return ret_ref;
47155 }
47156
47157 int64_t  __attribute__((export_name("TS_OpenChannel_hash"))) TS_OpenChannel_hash(uint64_t o) {
47158         LDKOpenChannel o_conv;
47159         o_conv.inner = untag_ptr(o);
47160         o_conv.is_owned = ptr_is_owned(o);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47162         o_conv.is_owned = false;
47163         int64_t ret_conv = OpenChannel_hash(&o_conv);
47164         return ret_conv;
47165 }
47166
47167 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
47168         LDKOpenChannel a_conv;
47169         a_conv.inner = untag_ptr(a);
47170         a_conv.is_owned = ptr_is_owned(a);
47171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47172         a_conv.is_owned = false;
47173         LDKOpenChannel b_conv;
47174         b_conv.inner = untag_ptr(b);
47175         b_conv.is_owned = ptr_is_owned(b);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47177         b_conv.is_owned = false;
47178         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
47179         return ret_conv;
47180 }
47181
47182 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
47183         LDKOpenChannelV2 this_obj_conv;
47184         this_obj_conv.inner = untag_ptr(this_obj);
47185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47187         OpenChannelV2_free(this_obj_conv);
47188 }
47189
47190 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_common_fields"))) TS_OpenChannelV2_get_common_fields(uint64_t this_ptr) {
47191         LDKOpenChannelV2 this_ptr_conv;
47192         this_ptr_conv.inner = untag_ptr(this_ptr);
47193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47195         this_ptr_conv.is_owned = false;
47196         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
47197         uint64_t ret_ref = 0;
47198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47200         return ret_ref;
47201 }
47202
47203 void  __attribute__((export_name("TS_OpenChannelV2_set_common_fields"))) TS_OpenChannelV2_set_common_fields(uint64_t this_ptr, uint64_t val) {
47204         LDKOpenChannelV2 this_ptr_conv;
47205         this_ptr_conv.inner = untag_ptr(this_ptr);
47206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47208         this_ptr_conv.is_owned = false;
47209         LDKCommonOpenChannelFields val_conv;
47210         val_conv.inner = untag_ptr(val);
47211         val_conv.is_owned = ptr_is_owned(val);
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47213         val_conv = CommonOpenChannelFields_clone(&val_conv);
47214         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
47215 }
47216
47217 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) {
47218         LDKOpenChannelV2 this_ptr_conv;
47219         this_ptr_conv.inner = untag_ptr(this_ptr);
47220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47222         this_ptr_conv.is_owned = false;
47223         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
47224         return ret_conv;
47225 }
47226
47227 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) {
47228         LDKOpenChannelV2 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         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47234 }
47235
47236 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
47237         LDKOpenChannelV2 this_ptr_conv;
47238         this_ptr_conv.inner = untag_ptr(this_ptr);
47239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47241         this_ptr_conv.is_owned = false;
47242         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
47243         return ret_conv;
47244 }
47245
47246 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
47247         LDKOpenChannelV2 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         OpenChannelV2_set_locktime(&this_ptr_conv, val);
47253 }
47254
47255 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
47256         LDKOpenChannelV2 this_ptr_conv;
47257         this_ptr_conv.inner = untag_ptr(this_ptr);
47258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47260         this_ptr_conv.is_owned = false;
47261         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47262         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47263         return ret_arr;
47264 }
47265
47266 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) {
47267         LDKOpenChannelV2 this_ptr_conv;
47268         this_ptr_conv.inner = untag_ptr(this_ptr);
47269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47271         this_ptr_conv.is_owned = false;
47272         LDKPublicKey val_ref;
47273         CHECK(val->arr_len == 33);
47274         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47275         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
47276 }
47277
47278 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
47279         LDKOpenChannelV2 this_ptr_conv;
47280         this_ptr_conv.inner = untag_ptr(this_ptr);
47281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47283         this_ptr_conv.is_owned = false;
47284         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
47285         return ret_conv;
47286 }
47287
47288 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
47289         LDKOpenChannelV2 this_ptr_conv;
47290         this_ptr_conv.inner = untag_ptr(this_ptr);
47291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47293         this_ptr_conv.is_owned = false;
47294         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
47295         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
47296 }
47297
47298 uint64_t  __attribute__((export_name("TS_OpenChannelV2_new"))) TS_OpenChannelV2_new(uint64_t common_fields_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t locktime_arg, int8_tArray second_per_commitment_point_arg, uint32_t require_confirmed_inputs_arg) {
47299         LDKCommonOpenChannelFields common_fields_arg_conv;
47300         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
47301         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
47303         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
47304         LDKPublicKey second_per_commitment_point_arg_ref;
47305         CHECK(second_per_commitment_point_arg->arr_len == 33);
47306         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
47307         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
47308         LDKOpenChannelV2 ret_var = OpenChannelV2_new(common_fields_arg_conv, funding_feerate_sat_per_1000_weight_arg, locktime_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
47309         uint64_t ret_ref = 0;
47310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47312         return ret_ref;
47313 }
47314
47315 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
47316         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
47317         uint64_t ret_ref = 0;
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47320         return ret_ref;
47321 }
47322 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
47323         LDKOpenChannelV2 arg_conv;
47324         arg_conv.inner = untag_ptr(arg);
47325         arg_conv.is_owned = ptr_is_owned(arg);
47326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47327         arg_conv.is_owned = false;
47328         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
47329         return ret_conv;
47330 }
47331
47332 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
47333         LDKOpenChannelV2 orig_conv;
47334         orig_conv.inner = untag_ptr(orig);
47335         orig_conv.is_owned = ptr_is_owned(orig);
47336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47337         orig_conv.is_owned = false;
47338         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
47339         uint64_t ret_ref = 0;
47340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47342         return ret_ref;
47343 }
47344
47345 int64_t  __attribute__((export_name("TS_OpenChannelV2_hash"))) TS_OpenChannelV2_hash(uint64_t o) {
47346         LDKOpenChannelV2 o_conv;
47347         o_conv.inner = untag_ptr(o);
47348         o_conv.is_owned = ptr_is_owned(o);
47349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47350         o_conv.is_owned = false;
47351         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
47352         return ret_conv;
47353 }
47354
47355 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
47356         LDKOpenChannelV2 a_conv;
47357         a_conv.inner = untag_ptr(a);
47358         a_conv.is_owned = ptr_is_owned(a);
47359         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47360         a_conv.is_owned = false;
47361         LDKOpenChannelV2 b_conv;
47362         b_conv.inner = untag_ptr(b);
47363         b_conv.is_owned = ptr_is_owned(b);
47364         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47365         b_conv.is_owned = false;
47366         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
47367         return ret_conv;
47368 }
47369
47370 void  __attribute__((export_name("TS_CommonAcceptChannelFields_free"))) TS_CommonAcceptChannelFields_free(uint64_t this_obj) {
47371         LDKCommonAcceptChannelFields this_obj_conv;
47372         this_obj_conv.inner = untag_ptr(this_obj);
47373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47375         CommonAcceptChannelFields_free(this_obj_conv);
47376 }
47377
47378 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_temporary_channel_id"))) TS_CommonAcceptChannelFields_get_temporary_channel_id(uint64_t this_ptr) {
47379         LDKCommonAcceptChannelFields this_ptr_conv;
47380         this_ptr_conv.inner = untag_ptr(this_ptr);
47381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47383         this_ptr_conv.is_owned = false;
47384         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
47385         uint64_t ret_ref = 0;
47386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47388         return ret_ref;
47389 }
47390
47391 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_temporary_channel_id"))) TS_CommonAcceptChannelFields_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
47392         LDKCommonAcceptChannelFields this_ptr_conv;
47393         this_ptr_conv.inner = untag_ptr(this_ptr);
47394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47396         this_ptr_conv.is_owned = false;
47397         LDKChannelId val_conv;
47398         val_conv.inner = untag_ptr(val);
47399         val_conv.is_owned = ptr_is_owned(val);
47400         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47401         val_conv = ChannelId_clone(&val_conv);
47402         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
47403 }
47404
47405 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_dust_limit_satoshis"))) TS_CommonAcceptChannelFields_get_dust_limit_satoshis(uint64_t this_ptr) {
47406         LDKCommonAcceptChannelFields this_ptr_conv;
47407         this_ptr_conv.inner = untag_ptr(this_ptr);
47408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47410         this_ptr_conv.is_owned = false;
47411         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
47412         return ret_conv;
47413 }
47414
47415 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_dust_limit_satoshis"))) TS_CommonAcceptChannelFields_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
47416         LDKCommonAcceptChannelFields this_ptr_conv;
47417         this_ptr_conv.inner = untag_ptr(this_ptr);
47418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47420         this_ptr_conv.is_owned = false;
47421         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
47422 }
47423
47424 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat"))) TS_CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(uint64_t this_ptr) {
47425         LDKCommonAcceptChannelFields 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 = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
47431         return ret_conv;
47432 }
47433
47434 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat"))) TS_CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(uint64_t this_ptr, int64_t val) {
47435         LDKCommonAcceptChannelFields 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         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
47441 }
47442
47443 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_htlc_minimum_msat"))) TS_CommonAcceptChannelFields_get_htlc_minimum_msat(uint64_t this_ptr) {
47444         LDKCommonAcceptChannelFields 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         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
47450         return ret_conv;
47451 }
47452
47453 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_htlc_minimum_msat"))) TS_CommonAcceptChannelFields_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
47454         LDKCommonAcceptChannelFields this_ptr_conv;
47455         this_ptr_conv.inner = untag_ptr(this_ptr);
47456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47458         this_ptr_conv.is_owned = false;
47459         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
47460 }
47461
47462 int32_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_minimum_depth"))) TS_CommonAcceptChannelFields_get_minimum_depth(uint64_t this_ptr) {
47463         LDKCommonAcceptChannelFields this_ptr_conv;
47464         this_ptr_conv.inner = untag_ptr(this_ptr);
47465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47467         this_ptr_conv.is_owned = false;
47468         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
47469         return ret_conv;
47470 }
47471
47472 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_minimum_depth"))) TS_CommonAcceptChannelFields_set_minimum_depth(uint64_t this_ptr, int32_t val) {
47473         LDKCommonAcceptChannelFields this_ptr_conv;
47474         this_ptr_conv.inner = untag_ptr(this_ptr);
47475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47477         this_ptr_conv.is_owned = false;
47478         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
47479 }
47480
47481 int16_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_to_self_delay"))) TS_CommonAcceptChannelFields_get_to_self_delay(uint64_t this_ptr) {
47482         LDKCommonAcceptChannelFields this_ptr_conv;
47483         this_ptr_conv.inner = untag_ptr(this_ptr);
47484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47486         this_ptr_conv.is_owned = false;
47487         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
47488         return ret_conv;
47489 }
47490
47491 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_to_self_delay"))) TS_CommonAcceptChannelFields_set_to_self_delay(uint64_t this_ptr, int16_t val) {
47492         LDKCommonAcceptChannelFields this_ptr_conv;
47493         this_ptr_conv.inner = untag_ptr(this_ptr);
47494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47496         this_ptr_conv.is_owned = false;
47497         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
47498 }
47499
47500 int16_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_max_accepted_htlcs"))) TS_CommonAcceptChannelFields_get_max_accepted_htlcs(uint64_t this_ptr) {
47501         LDKCommonAcceptChannelFields this_ptr_conv;
47502         this_ptr_conv.inner = untag_ptr(this_ptr);
47503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47505         this_ptr_conv.is_owned = false;
47506         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
47507         return ret_conv;
47508 }
47509
47510 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_max_accepted_htlcs"))) TS_CommonAcceptChannelFields_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
47511         LDKCommonAcceptChannelFields this_ptr_conv;
47512         this_ptr_conv.inner = untag_ptr(this_ptr);
47513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47515         this_ptr_conv.is_owned = false;
47516         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
47517 }
47518
47519 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_funding_pubkey"))) TS_CommonAcceptChannelFields_get_funding_pubkey(uint64_t this_ptr) {
47520         LDKCommonAcceptChannelFields this_ptr_conv;
47521         this_ptr_conv.inner = untag_ptr(this_ptr);
47522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47524         this_ptr_conv.is_owned = false;
47525         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47526         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47527         return ret_arr;
47528 }
47529
47530 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_funding_pubkey"))) TS_CommonAcceptChannelFields_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
47531         LDKCommonAcceptChannelFields this_ptr_conv;
47532         this_ptr_conv.inner = untag_ptr(this_ptr);
47533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47535         this_ptr_conv.is_owned = false;
47536         LDKPublicKey val_ref;
47537         CHECK(val->arr_len == 33);
47538         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47539         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
47540 }
47541
47542 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_revocation_basepoint"))) TS_CommonAcceptChannelFields_get_revocation_basepoint(uint64_t this_ptr) {
47543         LDKCommonAcceptChannelFields this_ptr_conv;
47544         this_ptr_conv.inner = untag_ptr(this_ptr);
47545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47547         this_ptr_conv.is_owned = false;
47548         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47549         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47550         return ret_arr;
47551 }
47552
47553 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_revocation_basepoint"))) TS_CommonAcceptChannelFields_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
47554         LDKCommonAcceptChannelFields this_ptr_conv;
47555         this_ptr_conv.inner = untag_ptr(this_ptr);
47556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47558         this_ptr_conv.is_owned = false;
47559         LDKPublicKey val_ref;
47560         CHECK(val->arr_len == 33);
47561         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47562         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
47563 }
47564
47565 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_payment_basepoint"))) TS_CommonAcceptChannelFields_get_payment_basepoint(uint64_t this_ptr) {
47566         LDKCommonAcceptChannelFields this_ptr_conv;
47567         this_ptr_conv.inner = untag_ptr(this_ptr);
47568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47570         this_ptr_conv.is_owned = false;
47571         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47572         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47573         return ret_arr;
47574 }
47575
47576 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_payment_basepoint"))) TS_CommonAcceptChannelFields_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
47577         LDKCommonAcceptChannelFields this_ptr_conv;
47578         this_ptr_conv.inner = untag_ptr(this_ptr);
47579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47581         this_ptr_conv.is_owned = false;
47582         LDKPublicKey val_ref;
47583         CHECK(val->arr_len == 33);
47584         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47585         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
47586 }
47587
47588 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_delayed_payment_basepoint"))) TS_CommonAcceptChannelFields_get_delayed_payment_basepoint(uint64_t this_ptr) {
47589         LDKCommonAcceptChannelFields this_ptr_conv;
47590         this_ptr_conv.inner = untag_ptr(this_ptr);
47591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47593         this_ptr_conv.is_owned = false;
47594         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47595         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47596         return ret_arr;
47597 }
47598
47599 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_delayed_payment_basepoint"))) TS_CommonAcceptChannelFields_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
47600         LDKCommonAcceptChannelFields this_ptr_conv;
47601         this_ptr_conv.inner = untag_ptr(this_ptr);
47602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47604         this_ptr_conv.is_owned = false;
47605         LDKPublicKey val_ref;
47606         CHECK(val->arr_len == 33);
47607         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47608         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47609 }
47610
47611 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_htlc_basepoint"))) TS_CommonAcceptChannelFields_get_htlc_basepoint(uint64_t this_ptr) {
47612         LDKCommonAcceptChannelFields this_ptr_conv;
47613         this_ptr_conv.inner = untag_ptr(this_ptr);
47614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47616         this_ptr_conv.is_owned = false;
47617         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47618         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
47619         return ret_arr;
47620 }
47621
47622 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_htlc_basepoint"))) TS_CommonAcceptChannelFields_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
47623         LDKCommonAcceptChannelFields this_ptr_conv;
47624         this_ptr_conv.inner = untag_ptr(this_ptr);
47625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47627         this_ptr_conv.is_owned = false;
47628         LDKPublicKey val_ref;
47629         CHECK(val->arr_len == 33);
47630         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47631         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
47632 }
47633
47634 int8_tArray  __attribute__((export_name("TS_CommonAcceptChannelFields_get_first_per_commitment_point"))) TS_CommonAcceptChannelFields_get_first_per_commitment_point(uint64_t this_ptr) {
47635         LDKCommonAcceptChannelFields this_ptr_conv;
47636         this_ptr_conv.inner = untag_ptr(this_ptr);
47637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47639         this_ptr_conv.is_owned = false;
47640         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47641         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47642         return ret_arr;
47643 }
47644
47645 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_first_per_commitment_point"))) TS_CommonAcceptChannelFields_set_first_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
47646         LDKCommonAcceptChannelFields this_ptr_conv;
47647         this_ptr_conv.inner = untag_ptr(this_ptr);
47648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47650         this_ptr_conv.is_owned = false;
47651         LDKPublicKey val_ref;
47652         CHECK(val->arr_len == 33);
47653         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47654         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
47655 }
47656
47657 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_shutdown_scriptpubkey"))) TS_CommonAcceptChannelFields_get_shutdown_scriptpubkey(uint64_t this_ptr) {
47658         LDKCommonAcceptChannelFields this_ptr_conv;
47659         this_ptr_conv.inner = untag_ptr(this_ptr);
47660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47662         this_ptr_conv.is_owned = false;
47663         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
47664         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
47665         uint64_t ret_ref = tag_ptr(ret_copy, true);
47666         return ret_ref;
47667 }
47668
47669 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_shutdown_scriptpubkey"))) TS_CommonAcceptChannelFields_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
47670         LDKCommonAcceptChannelFields this_ptr_conv;
47671         this_ptr_conv.inner = untag_ptr(this_ptr);
47672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47674         this_ptr_conv.is_owned = false;
47675         void* val_ptr = untag_ptr(val);
47676         CHECK_ACCESS(val_ptr);
47677         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
47678         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
47679         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
47680 }
47681
47682 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_get_channel_type"))) TS_CommonAcceptChannelFields_get_channel_type(uint64_t this_ptr) {
47683         LDKCommonAcceptChannelFields this_ptr_conv;
47684         this_ptr_conv.inner = untag_ptr(this_ptr);
47685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47687         this_ptr_conv.is_owned = false;
47688         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
47689         uint64_t ret_ref = 0;
47690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47692         return ret_ref;
47693 }
47694
47695 void  __attribute__((export_name("TS_CommonAcceptChannelFields_set_channel_type"))) TS_CommonAcceptChannelFields_set_channel_type(uint64_t this_ptr, uint64_t val) {
47696         LDKCommonAcceptChannelFields this_ptr_conv;
47697         this_ptr_conv.inner = untag_ptr(this_ptr);
47698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47700         this_ptr_conv.is_owned = false;
47701         LDKChannelTypeFeatures val_conv;
47702         val_conv.inner = untag_ptr(val);
47703         val_conv.is_owned = ptr_is_owned(val);
47704         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47705         val_conv = ChannelTypeFeatures_clone(&val_conv);
47706         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
47707 }
47708
47709 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_new"))) TS_CommonAcceptChannelFields_new(uint64_t temporary_channel_id_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, uint64_t shutdown_scriptpubkey_arg, uint64_t channel_type_arg) {
47710         LDKChannelId temporary_channel_id_arg_conv;
47711         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
47712         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
47714         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
47715         LDKPublicKey funding_pubkey_arg_ref;
47716         CHECK(funding_pubkey_arg->arr_len == 33);
47717         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47718         LDKPublicKey revocation_basepoint_arg_ref;
47719         CHECK(revocation_basepoint_arg->arr_len == 33);
47720         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
47721         LDKPublicKey payment_basepoint_arg_ref;
47722         CHECK(payment_basepoint_arg->arr_len == 33);
47723         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
47724         LDKPublicKey delayed_payment_basepoint_arg_ref;
47725         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
47726         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
47727         LDKPublicKey htlc_basepoint_arg_ref;
47728         CHECK(htlc_basepoint_arg->arr_len == 33);
47729         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
47730         LDKPublicKey first_per_commitment_point_arg_ref;
47731         CHECK(first_per_commitment_point_arg->arr_len == 33);
47732         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
47733         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
47734         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
47735         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
47736         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
47737         LDKChannelTypeFeatures channel_type_arg_conv;
47738         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
47739         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
47740         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
47741         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
47742         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_new(temporary_channel_id_arg_conv, 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, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
47743         uint64_t ret_ref = 0;
47744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47746         return ret_ref;
47747 }
47748
47749 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
47750         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
47751         uint64_t ret_ref = 0;
47752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47754         return ret_ref;
47755 }
47756 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_clone_ptr"))) TS_CommonAcceptChannelFields_clone_ptr(uint64_t arg) {
47757         LDKCommonAcceptChannelFields arg_conv;
47758         arg_conv.inner = untag_ptr(arg);
47759         arg_conv.is_owned = ptr_is_owned(arg);
47760         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47761         arg_conv.is_owned = false;
47762         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
47763         return ret_conv;
47764 }
47765
47766 uint64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_clone"))) TS_CommonAcceptChannelFields_clone(uint64_t orig) {
47767         LDKCommonAcceptChannelFields orig_conv;
47768         orig_conv.inner = untag_ptr(orig);
47769         orig_conv.is_owned = ptr_is_owned(orig);
47770         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47771         orig_conv.is_owned = false;
47772         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
47773         uint64_t ret_ref = 0;
47774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47776         return ret_ref;
47777 }
47778
47779 int64_t  __attribute__((export_name("TS_CommonAcceptChannelFields_hash"))) TS_CommonAcceptChannelFields_hash(uint64_t o) {
47780         LDKCommonAcceptChannelFields o_conv;
47781         o_conv.inner = untag_ptr(o);
47782         o_conv.is_owned = ptr_is_owned(o);
47783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47784         o_conv.is_owned = false;
47785         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
47786         return ret_conv;
47787 }
47788
47789 jboolean  __attribute__((export_name("TS_CommonAcceptChannelFields_eq"))) TS_CommonAcceptChannelFields_eq(uint64_t a, uint64_t b) {
47790         LDKCommonAcceptChannelFields a_conv;
47791         a_conv.inner = untag_ptr(a);
47792         a_conv.is_owned = ptr_is_owned(a);
47793         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47794         a_conv.is_owned = false;
47795         LDKCommonAcceptChannelFields b_conv;
47796         b_conv.inner = untag_ptr(b);
47797         b_conv.is_owned = ptr_is_owned(b);
47798         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47799         b_conv.is_owned = false;
47800         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
47801         return ret_conv;
47802 }
47803
47804 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
47805         LDKAcceptChannel this_obj_conv;
47806         this_obj_conv.inner = untag_ptr(this_obj);
47807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47809         AcceptChannel_free(this_obj_conv);
47810 }
47811
47812 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_common_fields"))) TS_AcceptChannel_get_common_fields(uint64_t this_ptr) {
47813         LDKAcceptChannel this_ptr_conv;
47814         this_ptr_conv.inner = untag_ptr(this_ptr);
47815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47817         this_ptr_conv.is_owned = false;
47818         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
47819         uint64_t ret_ref = 0;
47820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47822         return ret_ref;
47823 }
47824
47825 void  __attribute__((export_name("TS_AcceptChannel_set_common_fields"))) TS_AcceptChannel_set_common_fields(uint64_t this_ptr, uint64_t val) {
47826         LDKAcceptChannel this_ptr_conv;
47827         this_ptr_conv.inner = untag_ptr(this_ptr);
47828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47830         this_ptr_conv.is_owned = false;
47831         LDKCommonAcceptChannelFields val_conv;
47832         val_conv.inner = untag_ptr(val);
47833         val_conv.is_owned = ptr_is_owned(val);
47834         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47835         val_conv = CommonAcceptChannelFields_clone(&val_conv);
47836         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
47837 }
47838
47839 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
47840         LDKAcceptChannel this_ptr_conv;
47841         this_ptr_conv.inner = untag_ptr(this_ptr);
47842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47844         this_ptr_conv.is_owned = false;
47845         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
47846         return ret_conv;
47847 }
47848
47849 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
47850         LDKAcceptChannel this_ptr_conv;
47851         this_ptr_conv.inner = untag_ptr(this_ptr);
47852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47854         this_ptr_conv.is_owned = false;
47855         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
47856 }
47857
47858 uint64_t  __attribute__((export_name("TS_AcceptChannel_new"))) TS_AcceptChannel_new(uint64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
47859         LDKCommonAcceptChannelFields common_fields_arg_conv;
47860         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
47861         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
47863         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
47864         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
47865         uint64_t ret_ref = 0;
47866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47868         return ret_ref;
47869 }
47870
47871 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
47872         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
47873         uint64_t ret_ref = 0;
47874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47876         return ret_ref;
47877 }
47878 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
47879         LDKAcceptChannel arg_conv;
47880         arg_conv.inner = untag_ptr(arg);
47881         arg_conv.is_owned = ptr_is_owned(arg);
47882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47883         arg_conv.is_owned = false;
47884         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
47885         return ret_conv;
47886 }
47887
47888 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
47889         LDKAcceptChannel orig_conv;
47890         orig_conv.inner = untag_ptr(orig);
47891         orig_conv.is_owned = ptr_is_owned(orig);
47892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47893         orig_conv.is_owned = false;
47894         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
47895         uint64_t ret_ref = 0;
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47898         return ret_ref;
47899 }
47900
47901 int64_t  __attribute__((export_name("TS_AcceptChannel_hash"))) TS_AcceptChannel_hash(uint64_t o) {
47902         LDKAcceptChannel o_conv;
47903         o_conv.inner = untag_ptr(o);
47904         o_conv.is_owned = ptr_is_owned(o);
47905         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47906         o_conv.is_owned = false;
47907         int64_t ret_conv = AcceptChannel_hash(&o_conv);
47908         return ret_conv;
47909 }
47910
47911 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
47912         LDKAcceptChannel a_conv;
47913         a_conv.inner = untag_ptr(a);
47914         a_conv.is_owned = ptr_is_owned(a);
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47916         a_conv.is_owned = false;
47917         LDKAcceptChannel b_conv;
47918         b_conv.inner = untag_ptr(b);
47919         b_conv.is_owned = ptr_is_owned(b);
47920         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47921         b_conv.is_owned = false;
47922         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
47923         return ret_conv;
47924 }
47925
47926 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
47927         LDKAcceptChannelV2 this_obj_conv;
47928         this_obj_conv.inner = untag_ptr(this_obj);
47929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47931         AcceptChannelV2_free(this_obj_conv);
47932 }
47933
47934 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_common_fields"))) TS_AcceptChannelV2_get_common_fields(uint64_t this_ptr) {
47935         LDKAcceptChannelV2 this_ptr_conv;
47936         this_ptr_conv.inner = untag_ptr(this_ptr);
47937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47939         this_ptr_conv.is_owned = false;
47940         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
47941         uint64_t ret_ref = 0;
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47944         return ret_ref;
47945 }
47946
47947 void  __attribute__((export_name("TS_AcceptChannelV2_set_common_fields"))) TS_AcceptChannelV2_set_common_fields(uint64_t this_ptr, uint64_t val) {
47948         LDKAcceptChannelV2 this_ptr_conv;
47949         this_ptr_conv.inner = untag_ptr(this_ptr);
47950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47952         this_ptr_conv.is_owned = false;
47953         LDKCommonAcceptChannelFields val_conv;
47954         val_conv.inner = untag_ptr(val);
47955         val_conv.is_owned = ptr_is_owned(val);
47956         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47957         val_conv = CommonAcceptChannelFields_clone(&val_conv);
47958         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
47959 }
47960
47961 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
47962         LDKAcceptChannelV2 this_ptr_conv;
47963         this_ptr_conv.inner = untag_ptr(this_ptr);
47964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47966         this_ptr_conv.is_owned = false;
47967         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
47968         return ret_conv;
47969 }
47970
47971 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
47972         LDKAcceptChannelV2 this_ptr_conv;
47973         this_ptr_conv.inner = untag_ptr(this_ptr);
47974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47976         this_ptr_conv.is_owned = false;
47977         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
47978 }
47979
47980 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
47981         LDKAcceptChannelV2 this_ptr_conv;
47982         this_ptr_conv.inner = untag_ptr(this_ptr);
47983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47985         this_ptr_conv.is_owned = false;
47986         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47987         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47988         return ret_arr;
47989 }
47990
47991 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) {
47992         LDKAcceptChannelV2 this_ptr_conv;
47993         this_ptr_conv.inner = untag_ptr(this_ptr);
47994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47996         this_ptr_conv.is_owned = false;
47997         LDKPublicKey val_ref;
47998         CHECK(val->arr_len == 33);
47999         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48000         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
48001 }
48002
48003 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
48004         LDKAcceptChannelV2 this_ptr_conv;
48005         this_ptr_conv.inner = untag_ptr(this_ptr);
48006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48008         this_ptr_conv.is_owned = false;
48009         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
48010         return ret_conv;
48011 }
48012
48013 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
48014         LDKAcceptChannelV2 this_ptr_conv;
48015         this_ptr_conv.inner = untag_ptr(this_ptr);
48016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48018         this_ptr_conv.is_owned = false;
48019         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
48020         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
48021 }
48022
48023 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_new"))) TS_AcceptChannelV2_new(uint64_t common_fields_arg, int64_t funding_satoshis_arg, int8_tArray second_per_commitment_point_arg, uint32_t require_confirmed_inputs_arg) {
48024         LDKCommonAcceptChannelFields common_fields_arg_conv;
48025         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
48026         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
48027         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
48028         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
48029         LDKPublicKey second_per_commitment_point_arg_ref;
48030         CHECK(second_per_commitment_point_arg->arr_len == 33);
48031         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
48032         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
48033         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
48034         uint64_t ret_ref = 0;
48035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48037         return ret_ref;
48038 }
48039
48040 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
48041         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
48042         uint64_t ret_ref = 0;
48043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48045         return ret_ref;
48046 }
48047 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
48048         LDKAcceptChannelV2 arg_conv;
48049         arg_conv.inner = untag_ptr(arg);
48050         arg_conv.is_owned = ptr_is_owned(arg);
48051         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48052         arg_conv.is_owned = false;
48053         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
48054         return ret_conv;
48055 }
48056
48057 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
48058         LDKAcceptChannelV2 orig_conv;
48059         orig_conv.inner = untag_ptr(orig);
48060         orig_conv.is_owned = ptr_is_owned(orig);
48061         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48062         orig_conv.is_owned = false;
48063         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
48064         uint64_t ret_ref = 0;
48065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48067         return ret_ref;
48068 }
48069
48070 int64_t  __attribute__((export_name("TS_AcceptChannelV2_hash"))) TS_AcceptChannelV2_hash(uint64_t o) {
48071         LDKAcceptChannelV2 o_conv;
48072         o_conv.inner = untag_ptr(o);
48073         o_conv.is_owned = ptr_is_owned(o);
48074         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48075         o_conv.is_owned = false;
48076         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
48077         return ret_conv;
48078 }
48079
48080 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
48081         LDKAcceptChannelV2 a_conv;
48082         a_conv.inner = untag_ptr(a);
48083         a_conv.is_owned = ptr_is_owned(a);
48084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48085         a_conv.is_owned = false;
48086         LDKAcceptChannelV2 b_conv;
48087         b_conv.inner = untag_ptr(b);
48088         b_conv.is_owned = ptr_is_owned(b);
48089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48090         b_conv.is_owned = false;
48091         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
48092         return ret_conv;
48093 }
48094
48095 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
48096         LDKFundingCreated this_obj_conv;
48097         this_obj_conv.inner = untag_ptr(this_obj);
48098         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48100         FundingCreated_free(this_obj_conv);
48101 }
48102
48103 uint64_t  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
48104         LDKFundingCreated this_ptr_conv;
48105         this_ptr_conv.inner = untag_ptr(this_ptr);
48106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48108         this_ptr_conv.is_owned = false;
48109         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
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
48116 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, uint64_t val) {
48117         LDKFundingCreated this_ptr_conv;
48118         this_ptr_conv.inner = untag_ptr(this_ptr);
48119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48121         this_ptr_conv.is_owned = false;
48122         LDKChannelId val_conv;
48123         val_conv.inner = untag_ptr(val);
48124         val_conv.is_owned = ptr_is_owned(val);
48125         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48126         val_conv = ChannelId_clone(&val_conv);
48127         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
48128 }
48129
48130 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
48131         LDKFundingCreated this_ptr_conv;
48132         this_ptr_conv.inner = untag_ptr(this_ptr);
48133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48135         this_ptr_conv.is_owned = false;
48136         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48137         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
48138         return ret_arr;
48139 }
48140
48141 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
48142         LDKFundingCreated this_ptr_conv;
48143         this_ptr_conv.inner = untag_ptr(this_ptr);
48144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48146         this_ptr_conv.is_owned = false;
48147         LDKThirtyTwoBytes val_ref;
48148         CHECK(val->arr_len == 32);
48149         memcpy(val_ref.data, val->elems, 32); FREE(val);
48150         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
48151 }
48152
48153 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
48154         LDKFundingCreated this_ptr_conv;
48155         this_ptr_conv.inner = untag_ptr(this_ptr);
48156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48158         this_ptr_conv.is_owned = false;
48159         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
48160         return ret_conv;
48161 }
48162
48163 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
48164         LDKFundingCreated this_ptr_conv;
48165         this_ptr_conv.inner = untag_ptr(this_ptr);
48166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48168         this_ptr_conv.is_owned = false;
48169         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
48170 }
48171
48172 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
48173         LDKFundingCreated this_ptr_conv;
48174         this_ptr_conv.inner = untag_ptr(this_ptr);
48175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48177         this_ptr_conv.is_owned = false;
48178         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48179         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
48180         return ret_arr;
48181 }
48182
48183 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
48184         LDKFundingCreated this_ptr_conv;
48185         this_ptr_conv.inner = untag_ptr(this_ptr);
48186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48188         this_ptr_conv.is_owned = false;
48189         LDKECDSASignature val_ref;
48190         CHECK(val->arr_len == 64);
48191         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48192         FundingCreated_set_signature(&this_ptr_conv, val_ref);
48193 }
48194
48195 uint64_t  __attribute__((export_name("TS_FundingCreated_new"))) TS_FundingCreated_new(uint64_t temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
48196         LDKChannelId temporary_channel_id_arg_conv;
48197         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
48198         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
48200         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
48201         LDKThirtyTwoBytes funding_txid_arg_ref;
48202         CHECK(funding_txid_arg->arr_len == 32);
48203         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
48204         LDKECDSASignature signature_arg_ref;
48205         CHECK(signature_arg->arr_len == 64);
48206         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48207         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
48208         uint64_t ret_ref = 0;
48209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48211         return ret_ref;
48212 }
48213
48214 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
48215         LDKFundingCreated ret_var = FundingCreated_clone(arg);
48216         uint64_t ret_ref = 0;
48217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48219         return ret_ref;
48220 }
48221 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
48222         LDKFundingCreated arg_conv;
48223         arg_conv.inner = untag_ptr(arg);
48224         arg_conv.is_owned = ptr_is_owned(arg);
48225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48226         arg_conv.is_owned = false;
48227         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
48228         return ret_conv;
48229 }
48230
48231 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
48232         LDKFundingCreated orig_conv;
48233         orig_conv.inner = untag_ptr(orig);
48234         orig_conv.is_owned = ptr_is_owned(orig);
48235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48236         orig_conv.is_owned = false;
48237         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
48238         uint64_t ret_ref = 0;
48239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48241         return ret_ref;
48242 }
48243
48244 int64_t  __attribute__((export_name("TS_FundingCreated_hash"))) TS_FundingCreated_hash(uint64_t o) {
48245         LDKFundingCreated o_conv;
48246         o_conv.inner = untag_ptr(o);
48247         o_conv.is_owned = ptr_is_owned(o);
48248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48249         o_conv.is_owned = false;
48250         int64_t ret_conv = FundingCreated_hash(&o_conv);
48251         return ret_conv;
48252 }
48253
48254 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
48255         LDKFundingCreated a_conv;
48256         a_conv.inner = untag_ptr(a);
48257         a_conv.is_owned = ptr_is_owned(a);
48258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48259         a_conv.is_owned = false;
48260         LDKFundingCreated b_conv;
48261         b_conv.inner = untag_ptr(b);
48262         b_conv.is_owned = ptr_is_owned(b);
48263         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48264         b_conv.is_owned = false;
48265         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
48266         return ret_conv;
48267 }
48268
48269 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
48270         LDKFundingSigned this_obj_conv;
48271         this_obj_conv.inner = untag_ptr(this_obj);
48272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48274         FundingSigned_free(this_obj_conv);
48275 }
48276
48277 uint64_t  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
48278         LDKFundingSigned this_ptr_conv;
48279         this_ptr_conv.inner = untag_ptr(this_ptr);
48280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48282         this_ptr_conv.is_owned = false;
48283         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
48284         uint64_t ret_ref = 0;
48285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48287         return ret_ref;
48288 }
48289
48290 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
48291         LDKFundingSigned this_ptr_conv;
48292         this_ptr_conv.inner = untag_ptr(this_ptr);
48293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48295         this_ptr_conv.is_owned = false;
48296         LDKChannelId val_conv;
48297         val_conv.inner = untag_ptr(val);
48298         val_conv.is_owned = ptr_is_owned(val);
48299         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48300         val_conv = ChannelId_clone(&val_conv);
48301         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
48302 }
48303
48304 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
48305         LDKFundingSigned this_ptr_conv;
48306         this_ptr_conv.inner = untag_ptr(this_ptr);
48307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48309         this_ptr_conv.is_owned = false;
48310         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48311         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
48312         return ret_arr;
48313 }
48314
48315 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
48316         LDKFundingSigned this_ptr_conv;
48317         this_ptr_conv.inner = untag_ptr(this_ptr);
48318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48320         this_ptr_conv.is_owned = false;
48321         LDKECDSASignature val_ref;
48322         CHECK(val->arr_len == 64);
48323         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48324         FundingSigned_set_signature(&this_ptr_conv, val_ref);
48325 }
48326
48327 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(uint64_t channel_id_arg, int8_tArray signature_arg) {
48328         LDKChannelId channel_id_arg_conv;
48329         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48330         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48331         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48332         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48333         LDKECDSASignature signature_arg_ref;
48334         CHECK(signature_arg->arr_len == 64);
48335         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48336         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
48337         uint64_t ret_ref = 0;
48338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48340         return ret_ref;
48341 }
48342
48343 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
48344         LDKFundingSigned ret_var = FundingSigned_clone(arg);
48345         uint64_t ret_ref = 0;
48346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48348         return ret_ref;
48349 }
48350 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
48351         LDKFundingSigned arg_conv;
48352         arg_conv.inner = untag_ptr(arg);
48353         arg_conv.is_owned = ptr_is_owned(arg);
48354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48355         arg_conv.is_owned = false;
48356         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
48357         return ret_conv;
48358 }
48359
48360 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
48361         LDKFundingSigned orig_conv;
48362         orig_conv.inner = untag_ptr(orig);
48363         orig_conv.is_owned = ptr_is_owned(orig);
48364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48365         orig_conv.is_owned = false;
48366         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
48367         uint64_t ret_ref = 0;
48368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48370         return ret_ref;
48371 }
48372
48373 int64_t  __attribute__((export_name("TS_FundingSigned_hash"))) TS_FundingSigned_hash(uint64_t o) {
48374         LDKFundingSigned o_conv;
48375         o_conv.inner = untag_ptr(o);
48376         o_conv.is_owned = ptr_is_owned(o);
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48378         o_conv.is_owned = false;
48379         int64_t ret_conv = FundingSigned_hash(&o_conv);
48380         return ret_conv;
48381 }
48382
48383 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
48384         LDKFundingSigned a_conv;
48385         a_conv.inner = untag_ptr(a);
48386         a_conv.is_owned = ptr_is_owned(a);
48387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48388         a_conv.is_owned = false;
48389         LDKFundingSigned b_conv;
48390         b_conv.inner = untag_ptr(b);
48391         b_conv.is_owned = ptr_is_owned(b);
48392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48393         b_conv.is_owned = false;
48394         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
48395         return ret_conv;
48396 }
48397
48398 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
48399         LDKChannelReady this_obj_conv;
48400         this_obj_conv.inner = untag_ptr(this_obj);
48401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48403         ChannelReady_free(this_obj_conv);
48404 }
48405
48406 uint64_t  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
48407         LDKChannelReady this_ptr_conv;
48408         this_ptr_conv.inner = untag_ptr(this_ptr);
48409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48411         this_ptr_conv.is_owned = false;
48412         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
48413         uint64_t ret_ref = 0;
48414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48416         return ret_ref;
48417 }
48418
48419 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, uint64_t val) {
48420         LDKChannelReady this_ptr_conv;
48421         this_ptr_conv.inner = untag_ptr(this_ptr);
48422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48424         this_ptr_conv.is_owned = false;
48425         LDKChannelId val_conv;
48426         val_conv.inner = untag_ptr(val);
48427         val_conv.is_owned = ptr_is_owned(val);
48428         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48429         val_conv = ChannelId_clone(&val_conv);
48430         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
48431 }
48432
48433 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
48434         LDKChannelReady this_ptr_conv;
48435         this_ptr_conv.inner = untag_ptr(this_ptr);
48436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48438         this_ptr_conv.is_owned = false;
48439         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48440         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
48441         return ret_arr;
48442 }
48443
48444 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) {
48445         LDKChannelReady this_ptr_conv;
48446         this_ptr_conv.inner = untag_ptr(this_ptr);
48447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48449         this_ptr_conv.is_owned = false;
48450         LDKPublicKey val_ref;
48451         CHECK(val->arr_len == 33);
48452         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48453         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
48454 }
48455
48456 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
48457         LDKChannelReady this_ptr_conv;
48458         this_ptr_conv.inner = untag_ptr(this_ptr);
48459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48461         this_ptr_conv.is_owned = false;
48462         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
48463         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
48464         uint64_t ret_ref = tag_ptr(ret_copy, true);
48465         return ret_ref;
48466 }
48467
48468 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) {
48469         LDKChannelReady this_ptr_conv;
48470         this_ptr_conv.inner = untag_ptr(this_ptr);
48471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48473         this_ptr_conv.is_owned = false;
48474         void* val_ptr = untag_ptr(val);
48475         CHECK_ACCESS(val_ptr);
48476         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
48477         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
48478         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
48479 }
48480
48481 uint64_t  __attribute__((export_name("TS_ChannelReady_new"))) TS_ChannelReady_new(uint64_t channel_id_arg, int8_tArray next_per_commitment_point_arg, uint64_t short_channel_id_alias_arg) {
48482         LDKChannelId channel_id_arg_conv;
48483         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48484         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48485         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48486         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48487         LDKPublicKey next_per_commitment_point_arg_ref;
48488         CHECK(next_per_commitment_point_arg->arr_len == 33);
48489         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
48490         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
48491         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
48492         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
48493         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
48494         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
48495         uint64_t ret_ref = 0;
48496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48498         return ret_ref;
48499 }
48500
48501 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
48502         LDKChannelReady ret_var = ChannelReady_clone(arg);
48503         uint64_t ret_ref = 0;
48504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48506         return ret_ref;
48507 }
48508 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
48509         LDKChannelReady arg_conv;
48510         arg_conv.inner = untag_ptr(arg);
48511         arg_conv.is_owned = ptr_is_owned(arg);
48512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48513         arg_conv.is_owned = false;
48514         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
48515         return ret_conv;
48516 }
48517
48518 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
48519         LDKChannelReady orig_conv;
48520         orig_conv.inner = untag_ptr(orig);
48521         orig_conv.is_owned = ptr_is_owned(orig);
48522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48523         orig_conv.is_owned = false;
48524         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
48525         uint64_t ret_ref = 0;
48526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48528         return ret_ref;
48529 }
48530
48531 int64_t  __attribute__((export_name("TS_ChannelReady_hash"))) TS_ChannelReady_hash(uint64_t o) {
48532         LDKChannelReady o_conv;
48533         o_conv.inner = untag_ptr(o);
48534         o_conv.is_owned = ptr_is_owned(o);
48535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48536         o_conv.is_owned = false;
48537         int64_t ret_conv = ChannelReady_hash(&o_conv);
48538         return ret_conv;
48539 }
48540
48541 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
48542         LDKChannelReady a_conv;
48543         a_conv.inner = untag_ptr(a);
48544         a_conv.is_owned = ptr_is_owned(a);
48545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48546         a_conv.is_owned = false;
48547         LDKChannelReady b_conv;
48548         b_conv.inner = untag_ptr(b);
48549         b_conv.is_owned = ptr_is_owned(b);
48550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48551         b_conv.is_owned = false;
48552         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
48553         return ret_conv;
48554 }
48555
48556 void  __attribute__((export_name("TS_Stfu_free"))) TS_Stfu_free(uint64_t this_obj) {
48557         LDKStfu this_obj_conv;
48558         this_obj_conv.inner = untag_ptr(this_obj);
48559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48561         Stfu_free(this_obj_conv);
48562 }
48563
48564 uint64_t  __attribute__((export_name("TS_Stfu_get_channel_id"))) TS_Stfu_get_channel_id(uint64_t this_ptr) {
48565         LDKStfu this_ptr_conv;
48566         this_ptr_conv.inner = untag_ptr(this_ptr);
48567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48569         this_ptr_conv.is_owned = false;
48570         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
48571         uint64_t ret_ref = 0;
48572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48574         return ret_ref;
48575 }
48576
48577 void  __attribute__((export_name("TS_Stfu_set_channel_id"))) TS_Stfu_set_channel_id(uint64_t this_ptr, uint64_t val) {
48578         LDKStfu this_ptr_conv;
48579         this_ptr_conv.inner = untag_ptr(this_ptr);
48580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48582         this_ptr_conv.is_owned = false;
48583         LDKChannelId val_conv;
48584         val_conv.inner = untag_ptr(val);
48585         val_conv.is_owned = ptr_is_owned(val);
48586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48587         val_conv = ChannelId_clone(&val_conv);
48588         Stfu_set_channel_id(&this_ptr_conv, val_conv);
48589 }
48590
48591 int8_t  __attribute__((export_name("TS_Stfu_get_initiator"))) TS_Stfu_get_initiator(uint64_t this_ptr) {
48592         LDKStfu this_ptr_conv;
48593         this_ptr_conv.inner = untag_ptr(this_ptr);
48594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48596         this_ptr_conv.is_owned = false;
48597         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
48598         return ret_conv;
48599 }
48600
48601 void  __attribute__((export_name("TS_Stfu_set_initiator"))) TS_Stfu_set_initiator(uint64_t this_ptr, int8_t val) {
48602         LDKStfu this_ptr_conv;
48603         this_ptr_conv.inner = untag_ptr(this_ptr);
48604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48606         this_ptr_conv.is_owned = false;
48607         Stfu_set_initiator(&this_ptr_conv, val);
48608 }
48609
48610 uint64_t  __attribute__((export_name("TS_Stfu_new"))) TS_Stfu_new(uint64_t channel_id_arg, int8_t initiator_arg) {
48611         LDKChannelId channel_id_arg_conv;
48612         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48613         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48614         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48615         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48616         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
48617         uint64_t ret_ref = 0;
48618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48620         return ret_ref;
48621 }
48622
48623 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
48624         LDKStfu ret_var = Stfu_clone(arg);
48625         uint64_t ret_ref = 0;
48626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48628         return ret_ref;
48629 }
48630 int64_t  __attribute__((export_name("TS_Stfu_clone_ptr"))) TS_Stfu_clone_ptr(uint64_t arg) {
48631         LDKStfu arg_conv;
48632         arg_conv.inner = untag_ptr(arg);
48633         arg_conv.is_owned = ptr_is_owned(arg);
48634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48635         arg_conv.is_owned = false;
48636         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
48637         return ret_conv;
48638 }
48639
48640 uint64_t  __attribute__((export_name("TS_Stfu_clone"))) TS_Stfu_clone(uint64_t orig) {
48641         LDKStfu orig_conv;
48642         orig_conv.inner = untag_ptr(orig);
48643         orig_conv.is_owned = ptr_is_owned(orig);
48644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48645         orig_conv.is_owned = false;
48646         LDKStfu ret_var = Stfu_clone(&orig_conv);
48647         uint64_t ret_ref = 0;
48648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48650         return ret_ref;
48651 }
48652
48653 jboolean  __attribute__((export_name("TS_Stfu_eq"))) TS_Stfu_eq(uint64_t a, uint64_t b) {
48654         LDKStfu a_conv;
48655         a_conv.inner = untag_ptr(a);
48656         a_conv.is_owned = ptr_is_owned(a);
48657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48658         a_conv.is_owned = false;
48659         LDKStfu b_conv;
48660         b_conv.inner = untag_ptr(b);
48661         b_conv.is_owned = ptr_is_owned(b);
48662         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48663         b_conv.is_owned = false;
48664         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
48665         return ret_conv;
48666 }
48667
48668 void  __attribute__((export_name("TS_Splice_free"))) TS_Splice_free(uint64_t this_obj) {
48669         LDKSplice this_obj_conv;
48670         this_obj_conv.inner = untag_ptr(this_obj);
48671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48673         Splice_free(this_obj_conv);
48674 }
48675
48676 uint64_t  __attribute__((export_name("TS_Splice_get_channel_id"))) TS_Splice_get_channel_id(uint64_t this_ptr) {
48677         LDKSplice this_ptr_conv;
48678         this_ptr_conv.inner = untag_ptr(this_ptr);
48679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48681         this_ptr_conv.is_owned = false;
48682         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
48683         uint64_t ret_ref = 0;
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48686         return ret_ref;
48687 }
48688
48689 void  __attribute__((export_name("TS_Splice_set_channel_id"))) TS_Splice_set_channel_id(uint64_t this_ptr, uint64_t val) {
48690         LDKSplice this_ptr_conv;
48691         this_ptr_conv.inner = untag_ptr(this_ptr);
48692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48694         this_ptr_conv.is_owned = false;
48695         LDKChannelId val_conv;
48696         val_conv.inner = untag_ptr(val);
48697         val_conv.is_owned = ptr_is_owned(val);
48698         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48699         val_conv = ChannelId_clone(&val_conv);
48700         Splice_set_channel_id(&this_ptr_conv, val_conv);
48701 }
48702
48703 int8_tArray  __attribute__((export_name("TS_Splice_get_chain_hash"))) TS_Splice_get_chain_hash(uint64_t this_ptr) {
48704         LDKSplice this_ptr_conv;
48705         this_ptr_conv.inner = untag_ptr(this_ptr);
48706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48708         this_ptr_conv.is_owned = false;
48709         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48710         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
48711         return ret_arr;
48712 }
48713
48714 void  __attribute__((export_name("TS_Splice_set_chain_hash"))) TS_Splice_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
48715         LDKSplice this_ptr_conv;
48716         this_ptr_conv.inner = untag_ptr(this_ptr);
48717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48719         this_ptr_conv.is_owned = false;
48720         LDKThirtyTwoBytes val_ref;
48721         CHECK(val->arr_len == 32);
48722         memcpy(val_ref.data, val->elems, 32); FREE(val);
48723         Splice_set_chain_hash(&this_ptr_conv, val_ref);
48724 }
48725
48726 int64_t  __attribute__((export_name("TS_Splice_get_relative_satoshis"))) TS_Splice_get_relative_satoshis(uint64_t this_ptr) {
48727         LDKSplice 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         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
48733         return ret_conv;
48734 }
48735
48736 void  __attribute__((export_name("TS_Splice_set_relative_satoshis"))) TS_Splice_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
48737         LDKSplice 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         Splice_set_relative_satoshis(&this_ptr_conv, val);
48743 }
48744
48745 int32_t  __attribute__((export_name("TS_Splice_get_funding_feerate_perkw"))) TS_Splice_get_funding_feerate_perkw(uint64_t this_ptr) {
48746         LDKSplice 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         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
48752         return ret_conv;
48753 }
48754
48755 void  __attribute__((export_name("TS_Splice_set_funding_feerate_perkw"))) TS_Splice_set_funding_feerate_perkw(uint64_t this_ptr, int32_t val) {
48756         LDKSplice 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         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
48762 }
48763
48764 int32_t  __attribute__((export_name("TS_Splice_get_locktime"))) TS_Splice_get_locktime(uint64_t this_ptr) {
48765         LDKSplice 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         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
48771         return ret_conv;
48772 }
48773
48774 void  __attribute__((export_name("TS_Splice_set_locktime"))) TS_Splice_set_locktime(uint64_t this_ptr, int32_t val) {
48775         LDKSplice 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         Splice_set_locktime(&this_ptr_conv, val);
48781 }
48782
48783 int8_tArray  __attribute__((export_name("TS_Splice_get_funding_pubkey"))) TS_Splice_get_funding_pubkey(uint64_t this_ptr) {
48784         LDKSplice 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48790         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
48791         return ret_arr;
48792 }
48793
48794 void  __attribute__((export_name("TS_Splice_set_funding_pubkey"))) TS_Splice_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
48795         LDKSplice this_ptr_conv;
48796         this_ptr_conv.inner = untag_ptr(this_ptr);
48797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48799         this_ptr_conv.is_owned = false;
48800         LDKPublicKey val_ref;
48801         CHECK(val->arr_len == 33);
48802         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48803         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
48804 }
48805
48806 uint64_t  __attribute__((export_name("TS_Splice_new"))) TS_Splice_new(uint64_t 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) {
48807         LDKChannelId channel_id_arg_conv;
48808         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48809         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48810         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48811         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48812         LDKThirtyTwoBytes chain_hash_arg_ref;
48813         CHECK(chain_hash_arg->arr_len == 32);
48814         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48815         LDKPublicKey funding_pubkey_arg_ref;
48816         CHECK(funding_pubkey_arg->arr_len == 33);
48817         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
48818         LDKSplice ret_var = Splice_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
48819         uint64_t ret_ref = 0;
48820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48822         return ret_ref;
48823 }
48824
48825 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
48826         LDKSplice ret_var = Splice_clone(arg);
48827         uint64_t ret_ref = 0;
48828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48830         return ret_ref;
48831 }
48832 int64_t  __attribute__((export_name("TS_Splice_clone_ptr"))) TS_Splice_clone_ptr(uint64_t arg) {
48833         LDKSplice arg_conv;
48834         arg_conv.inner = untag_ptr(arg);
48835         arg_conv.is_owned = ptr_is_owned(arg);
48836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48837         arg_conv.is_owned = false;
48838         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
48839         return ret_conv;
48840 }
48841
48842 uint64_t  __attribute__((export_name("TS_Splice_clone"))) TS_Splice_clone(uint64_t orig) {
48843         LDKSplice orig_conv;
48844         orig_conv.inner = untag_ptr(orig);
48845         orig_conv.is_owned = ptr_is_owned(orig);
48846         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48847         orig_conv.is_owned = false;
48848         LDKSplice ret_var = Splice_clone(&orig_conv);
48849         uint64_t ret_ref = 0;
48850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48852         return ret_ref;
48853 }
48854
48855 jboolean  __attribute__((export_name("TS_Splice_eq"))) TS_Splice_eq(uint64_t a, uint64_t b) {
48856         LDKSplice a_conv;
48857         a_conv.inner = untag_ptr(a);
48858         a_conv.is_owned = ptr_is_owned(a);
48859         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48860         a_conv.is_owned = false;
48861         LDKSplice b_conv;
48862         b_conv.inner = untag_ptr(b);
48863         b_conv.is_owned = ptr_is_owned(b);
48864         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48865         b_conv.is_owned = false;
48866         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
48867         return ret_conv;
48868 }
48869
48870 void  __attribute__((export_name("TS_SpliceAck_free"))) TS_SpliceAck_free(uint64_t this_obj) {
48871         LDKSpliceAck this_obj_conv;
48872         this_obj_conv.inner = untag_ptr(this_obj);
48873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48875         SpliceAck_free(this_obj_conv);
48876 }
48877
48878 uint64_t  __attribute__((export_name("TS_SpliceAck_get_channel_id"))) TS_SpliceAck_get_channel_id(uint64_t this_ptr) {
48879         LDKSpliceAck this_ptr_conv;
48880         this_ptr_conv.inner = untag_ptr(this_ptr);
48881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48883         this_ptr_conv.is_owned = false;
48884         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
48885         uint64_t ret_ref = 0;
48886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48888         return ret_ref;
48889 }
48890
48891 void  __attribute__((export_name("TS_SpliceAck_set_channel_id"))) TS_SpliceAck_set_channel_id(uint64_t this_ptr, uint64_t val) {
48892         LDKSpliceAck this_ptr_conv;
48893         this_ptr_conv.inner = untag_ptr(this_ptr);
48894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48896         this_ptr_conv.is_owned = false;
48897         LDKChannelId val_conv;
48898         val_conv.inner = untag_ptr(val);
48899         val_conv.is_owned = ptr_is_owned(val);
48900         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48901         val_conv = ChannelId_clone(&val_conv);
48902         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
48903 }
48904
48905 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_chain_hash"))) TS_SpliceAck_get_chain_hash(uint64_t this_ptr) {
48906         LDKSpliceAck this_ptr_conv;
48907         this_ptr_conv.inner = untag_ptr(this_ptr);
48908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48910         this_ptr_conv.is_owned = false;
48911         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48912         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
48913         return ret_arr;
48914 }
48915
48916 void  __attribute__((export_name("TS_SpliceAck_set_chain_hash"))) TS_SpliceAck_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
48917         LDKSpliceAck this_ptr_conv;
48918         this_ptr_conv.inner = untag_ptr(this_ptr);
48919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48921         this_ptr_conv.is_owned = false;
48922         LDKThirtyTwoBytes val_ref;
48923         CHECK(val->arr_len == 32);
48924         memcpy(val_ref.data, val->elems, 32); FREE(val);
48925         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
48926 }
48927
48928 int64_t  __attribute__((export_name("TS_SpliceAck_get_relative_satoshis"))) TS_SpliceAck_get_relative_satoshis(uint64_t this_ptr) {
48929         LDKSpliceAck this_ptr_conv;
48930         this_ptr_conv.inner = untag_ptr(this_ptr);
48931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48933         this_ptr_conv.is_owned = false;
48934         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
48935         return ret_conv;
48936 }
48937
48938 void  __attribute__((export_name("TS_SpliceAck_set_relative_satoshis"))) TS_SpliceAck_set_relative_satoshis(uint64_t this_ptr, int64_t val) {
48939         LDKSpliceAck this_ptr_conv;
48940         this_ptr_conv.inner = untag_ptr(this_ptr);
48941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48943         this_ptr_conv.is_owned = false;
48944         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
48945 }
48946
48947 int8_tArray  __attribute__((export_name("TS_SpliceAck_get_funding_pubkey"))) TS_SpliceAck_get_funding_pubkey(uint64_t this_ptr) {
48948         LDKSpliceAck this_ptr_conv;
48949         this_ptr_conv.inner = untag_ptr(this_ptr);
48950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48952         this_ptr_conv.is_owned = false;
48953         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48954         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
48955         return ret_arr;
48956 }
48957
48958 void  __attribute__((export_name("TS_SpliceAck_set_funding_pubkey"))) TS_SpliceAck_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
48959         LDKSpliceAck this_ptr_conv;
48960         this_ptr_conv.inner = untag_ptr(this_ptr);
48961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48963         this_ptr_conv.is_owned = false;
48964         LDKPublicKey val_ref;
48965         CHECK(val->arr_len == 33);
48966         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48967         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
48968 }
48969
48970 uint64_t  __attribute__((export_name("TS_SpliceAck_new"))) TS_SpliceAck_new(uint64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
48971         LDKChannelId channel_id_arg_conv;
48972         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48973         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48974         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48975         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48976         LDKThirtyTwoBytes chain_hash_arg_ref;
48977         CHECK(chain_hash_arg->arr_len == 32);
48978         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48979         LDKPublicKey funding_pubkey_arg_ref;
48980         CHECK(funding_pubkey_arg->arr_len == 33);
48981         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
48982         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
48983         uint64_t ret_ref = 0;
48984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48986         return ret_ref;
48987 }
48988
48989 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
48990         LDKSpliceAck ret_var = SpliceAck_clone(arg);
48991         uint64_t ret_ref = 0;
48992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48994         return ret_ref;
48995 }
48996 int64_t  __attribute__((export_name("TS_SpliceAck_clone_ptr"))) TS_SpliceAck_clone_ptr(uint64_t arg) {
48997         LDKSpliceAck arg_conv;
48998         arg_conv.inner = untag_ptr(arg);
48999         arg_conv.is_owned = ptr_is_owned(arg);
49000         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49001         arg_conv.is_owned = false;
49002         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
49003         return ret_conv;
49004 }
49005
49006 uint64_t  __attribute__((export_name("TS_SpliceAck_clone"))) TS_SpliceAck_clone(uint64_t orig) {
49007         LDKSpliceAck orig_conv;
49008         orig_conv.inner = untag_ptr(orig);
49009         orig_conv.is_owned = ptr_is_owned(orig);
49010         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49011         orig_conv.is_owned = false;
49012         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
49013         uint64_t ret_ref = 0;
49014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49016         return ret_ref;
49017 }
49018
49019 jboolean  __attribute__((export_name("TS_SpliceAck_eq"))) TS_SpliceAck_eq(uint64_t a, uint64_t b) {
49020         LDKSpliceAck a_conv;
49021         a_conv.inner = untag_ptr(a);
49022         a_conv.is_owned = ptr_is_owned(a);
49023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49024         a_conv.is_owned = false;
49025         LDKSpliceAck b_conv;
49026         b_conv.inner = untag_ptr(b);
49027         b_conv.is_owned = ptr_is_owned(b);
49028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49029         b_conv.is_owned = false;
49030         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
49031         return ret_conv;
49032 }
49033
49034 void  __attribute__((export_name("TS_SpliceLocked_free"))) TS_SpliceLocked_free(uint64_t this_obj) {
49035         LDKSpliceLocked this_obj_conv;
49036         this_obj_conv.inner = untag_ptr(this_obj);
49037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49039         SpliceLocked_free(this_obj_conv);
49040 }
49041
49042 uint64_t  __attribute__((export_name("TS_SpliceLocked_get_channel_id"))) TS_SpliceLocked_get_channel_id(uint64_t this_ptr) {
49043         LDKSpliceLocked this_ptr_conv;
49044         this_ptr_conv.inner = untag_ptr(this_ptr);
49045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49047         this_ptr_conv.is_owned = false;
49048         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
49049         uint64_t ret_ref = 0;
49050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49052         return ret_ref;
49053 }
49054
49055 void  __attribute__((export_name("TS_SpliceLocked_set_channel_id"))) TS_SpliceLocked_set_channel_id(uint64_t this_ptr, uint64_t val) {
49056         LDKSpliceLocked this_ptr_conv;
49057         this_ptr_conv.inner = untag_ptr(this_ptr);
49058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49060         this_ptr_conv.is_owned = false;
49061         LDKChannelId val_conv;
49062         val_conv.inner = untag_ptr(val);
49063         val_conv.is_owned = ptr_is_owned(val);
49064         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49065         val_conv = ChannelId_clone(&val_conv);
49066         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
49067 }
49068
49069 uint64_t  __attribute__((export_name("TS_SpliceLocked_new"))) TS_SpliceLocked_new(uint64_t channel_id_arg) {
49070         LDKChannelId channel_id_arg_conv;
49071         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49072         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49073         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49074         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49075         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
49076         uint64_t ret_ref = 0;
49077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49079         return ret_ref;
49080 }
49081
49082 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
49083         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
49084         uint64_t ret_ref = 0;
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49087         return ret_ref;
49088 }
49089 int64_t  __attribute__((export_name("TS_SpliceLocked_clone_ptr"))) TS_SpliceLocked_clone_ptr(uint64_t arg) {
49090         LDKSpliceLocked arg_conv;
49091         arg_conv.inner = untag_ptr(arg);
49092         arg_conv.is_owned = ptr_is_owned(arg);
49093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49094         arg_conv.is_owned = false;
49095         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
49096         return ret_conv;
49097 }
49098
49099 uint64_t  __attribute__((export_name("TS_SpliceLocked_clone"))) TS_SpliceLocked_clone(uint64_t orig) {
49100         LDKSpliceLocked orig_conv;
49101         orig_conv.inner = untag_ptr(orig);
49102         orig_conv.is_owned = ptr_is_owned(orig);
49103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49104         orig_conv.is_owned = false;
49105         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
49106         uint64_t ret_ref = 0;
49107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49109         return ret_ref;
49110 }
49111
49112 jboolean  __attribute__((export_name("TS_SpliceLocked_eq"))) TS_SpliceLocked_eq(uint64_t a, uint64_t b) {
49113         LDKSpliceLocked a_conv;
49114         a_conv.inner = untag_ptr(a);
49115         a_conv.is_owned = ptr_is_owned(a);
49116         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49117         a_conv.is_owned = false;
49118         LDKSpliceLocked b_conv;
49119         b_conv.inner = untag_ptr(b);
49120         b_conv.is_owned = ptr_is_owned(b);
49121         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49122         b_conv.is_owned = false;
49123         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
49124         return ret_conv;
49125 }
49126
49127 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
49128         LDKTxAddInput this_obj_conv;
49129         this_obj_conv.inner = untag_ptr(this_obj);
49130         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49132         TxAddInput_free(this_obj_conv);
49133 }
49134
49135 uint64_t  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
49136         LDKTxAddInput this_ptr_conv;
49137         this_ptr_conv.inner = untag_ptr(this_ptr);
49138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49140         this_ptr_conv.is_owned = false;
49141         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
49142         uint64_t ret_ref = 0;
49143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49145         return ret_ref;
49146 }
49147
49148 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, uint64_t val) {
49149         LDKTxAddInput this_ptr_conv;
49150         this_ptr_conv.inner = untag_ptr(this_ptr);
49151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49153         this_ptr_conv.is_owned = false;
49154         LDKChannelId val_conv;
49155         val_conv.inner = untag_ptr(val);
49156         val_conv.is_owned = ptr_is_owned(val);
49157         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49158         val_conv = ChannelId_clone(&val_conv);
49159         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
49160 }
49161
49162 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
49163         LDKTxAddInput this_ptr_conv;
49164         this_ptr_conv.inner = untag_ptr(this_ptr);
49165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49167         this_ptr_conv.is_owned = false;
49168         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
49169         return ret_conv;
49170 }
49171
49172 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
49173         LDKTxAddInput this_ptr_conv;
49174         this_ptr_conv.inner = untag_ptr(this_ptr);
49175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49177         this_ptr_conv.is_owned = false;
49178         TxAddInput_set_serial_id(&this_ptr_conv, val);
49179 }
49180
49181 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
49182         LDKTxAddInput this_ptr_conv;
49183         this_ptr_conv.inner = untag_ptr(this_ptr);
49184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49186         this_ptr_conv.is_owned = false;
49187         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_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 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
49195         LDKTxAddInput this_ptr_conv;
49196         this_ptr_conv.inner = untag_ptr(this_ptr);
49197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49199         this_ptr_conv.is_owned = false;
49200         LDKTransactionU16LenLimited val_conv;
49201         val_conv.inner = untag_ptr(val);
49202         val_conv.is_owned = ptr_is_owned(val);
49203         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49204         val_conv = TransactionU16LenLimited_clone(&val_conv);
49205         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
49206 }
49207
49208 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
49209         LDKTxAddInput this_ptr_conv;
49210         this_ptr_conv.inner = untag_ptr(this_ptr);
49211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49213         this_ptr_conv.is_owned = false;
49214         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
49215         return ret_conv;
49216 }
49217
49218 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
49219         LDKTxAddInput this_ptr_conv;
49220         this_ptr_conv.inner = untag_ptr(this_ptr);
49221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49223         this_ptr_conv.is_owned = false;
49224         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
49225 }
49226
49227 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
49228         LDKTxAddInput 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         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
49234         return ret_conv;
49235 }
49236
49237 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
49238         LDKTxAddInput this_ptr_conv;
49239         this_ptr_conv.inner = untag_ptr(this_ptr);
49240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49242         this_ptr_conv.is_owned = false;
49243         TxAddInput_set_sequence(&this_ptr_conv, val);
49244 }
49245
49246 uint64_t  __attribute__((export_name("TS_TxAddInput_new"))) TS_TxAddInput_new(uint64_t channel_id_arg, int64_t serial_id_arg, uint64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
49247         LDKChannelId channel_id_arg_conv;
49248         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49249         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49250         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49251         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49252         LDKTransactionU16LenLimited prevtx_arg_conv;
49253         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
49254         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
49255         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
49256         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
49257         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
49258         uint64_t ret_ref = 0;
49259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49261         return ret_ref;
49262 }
49263
49264 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
49265         LDKTxAddInput ret_var = TxAddInput_clone(arg);
49266         uint64_t ret_ref = 0;
49267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49269         return ret_ref;
49270 }
49271 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
49272         LDKTxAddInput arg_conv;
49273         arg_conv.inner = untag_ptr(arg);
49274         arg_conv.is_owned = ptr_is_owned(arg);
49275         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49276         arg_conv.is_owned = false;
49277         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
49278         return ret_conv;
49279 }
49280
49281 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
49282         LDKTxAddInput orig_conv;
49283         orig_conv.inner = untag_ptr(orig);
49284         orig_conv.is_owned = ptr_is_owned(orig);
49285         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49286         orig_conv.is_owned = false;
49287         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
49288         uint64_t ret_ref = 0;
49289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49291         return ret_ref;
49292 }
49293
49294 int64_t  __attribute__((export_name("TS_TxAddInput_hash"))) TS_TxAddInput_hash(uint64_t o) {
49295         LDKTxAddInput o_conv;
49296         o_conv.inner = untag_ptr(o);
49297         o_conv.is_owned = ptr_is_owned(o);
49298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49299         o_conv.is_owned = false;
49300         int64_t ret_conv = TxAddInput_hash(&o_conv);
49301         return ret_conv;
49302 }
49303
49304 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
49305         LDKTxAddInput a_conv;
49306         a_conv.inner = untag_ptr(a);
49307         a_conv.is_owned = ptr_is_owned(a);
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49309         a_conv.is_owned = false;
49310         LDKTxAddInput b_conv;
49311         b_conv.inner = untag_ptr(b);
49312         b_conv.is_owned = ptr_is_owned(b);
49313         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49314         b_conv.is_owned = false;
49315         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
49316         return ret_conv;
49317 }
49318
49319 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
49320         LDKTxAddOutput this_obj_conv;
49321         this_obj_conv.inner = untag_ptr(this_obj);
49322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49324         TxAddOutput_free(this_obj_conv);
49325 }
49326
49327 uint64_t  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
49328         LDKTxAddOutput this_ptr_conv;
49329         this_ptr_conv.inner = untag_ptr(this_ptr);
49330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49332         this_ptr_conv.is_owned = false;
49333         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
49334         uint64_t ret_ref = 0;
49335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49337         return ret_ref;
49338 }
49339
49340 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
49341         LDKTxAddOutput this_ptr_conv;
49342         this_ptr_conv.inner = untag_ptr(this_ptr);
49343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49345         this_ptr_conv.is_owned = false;
49346         LDKChannelId val_conv;
49347         val_conv.inner = untag_ptr(val);
49348         val_conv.is_owned = ptr_is_owned(val);
49349         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49350         val_conv = ChannelId_clone(&val_conv);
49351         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
49352 }
49353
49354 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
49355         LDKTxAddOutput this_ptr_conv;
49356         this_ptr_conv.inner = untag_ptr(this_ptr);
49357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49359         this_ptr_conv.is_owned = false;
49360         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
49361         return ret_conv;
49362 }
49363
49364 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
49365         LDKTxAddOutput this_ptr_conv;
49366         this_ptr_conv.inner = untag_ptr(this_ptr);
49367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49369         this_ptr_conv.is_owned = false;
49370         TxAddOutput_set_serial_id(&this_ptr_conv, val);
49371 }
49372
49373 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
49374         LDKTxAddOutput this_ptr_conv;
49375         this_ptr_conv.inner = untag_ptr(this_ptr);
49376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49378         this_ptr_conv.is_owned = false;
49379         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
49380         return ret_conv;
49381 }
49382
49383 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
49384         LDKTxAddOutput this_ptr_conv;
49385         this_ptr_conv.inner = untag_ptr(this_ptr);
49386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49388         this_ptr_conv.is_owned = false;
49389         TxAddOutput_set_sats(&this_ptr_conv, val);
49390 }
49391
49392 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
49393         LDKTxAddOutput this_ptr_conv;
49394         this_ptr_conv.inner = untag_ptr(this_ptr);
49395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49397         this_ptr_conv.is_owned = false;
49398         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
49399         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49400         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49401         CVec_u8Z_free(ret_var);
49402         return ret_arr;
49403 }
49404
49405 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
49406         LDKTxAddOutput this_ptr_conv;
49407         this_ptr_conv.inner = untag_ptr(this_ptr);
49408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49410         this_ptr_conv.is_owned = false;
49411         LDKCVec_u8Z val_ref;
49412         val_ref.datalen = val->arr_len;
49413         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49414         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49415         TxAddOutput_set_script(&this_ptr_conv, val_ref);
49416 }
49417
49418 uint64_t  __attribute__((export_name("TS_TxAddOutput_new"))) TS_TxAddOutput_new(uint64_t channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
49419         LDKChannelId channel_id_arg_conv;
49420         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49421         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49422         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49423         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49424         LDKCVec_u8Z script_arg_ref;
49425         script_arg_ref.datalen = script_arg->arr_len;
49426         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49427         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
49428         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
49429         uint64_t ret_ref = 0;
49430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49432         return ret_ref;
49433 }
49434
49435 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
49436         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
49437         uint64_t ret_ref = 0;
49438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49440         return ret_ref;
49441 }
49442 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
49443         LDKTxAddOutput arg_conv;
49444         arg_conv.inner = untag_ptr(arg);
49445         arg_conv.is_owned = ptr_is_owned(arg);
49446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49447         arg_conv.is_owned = false;
49448         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
49449         return ret_conv;
49450 }
49451
49452 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
49453         LDKTxAddOutput orig_conv;
49454         orig_conv.inner = untag_ptr(orig);
49455         orig_conv.is_owned = ptr_is_owned(orig);
49456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49457         orig_conv.is_owned = false;
49458         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
49459         uint64_t ret_ref = 0;
49460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49462         return ret_ref;
49463 }
49464
49465 int64_t  __attribute__((export_name("TS_TxAddOutput_hash"))) TS_TxAddOutput_hash(uint64_t o) {
49466         LDKTxAddOutput o_conv;
49467         o_conv.inner = untag_ptr(o);
49468         o_conv.is_owned = ptr_is_owned(o);
49469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49470         o_conv.is_owned = false;
49471         int64_t ret_conv = TxAddOutput_hash(&o_conv);
49472         return ret_conv;
49473 }
49474
49475 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
49476         LDKTxAddOutput a_conv;
49477         a_conv.inner = untag_ptr(a);
49478         a_conv.is_owned = ptr_is_owned(a);
49479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49480         a_conv.is_owned = false;
49481         LDKTxAddOutput b_conv;
49482         b_conv.inner = untag_ptr(b);
49483         b_conv.is_owned = ptr_is_owned(b);
49484         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49485         b_conv.is_owned = false;
49486         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
49487         return ret_conv;
49488 }
49489
49490 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
49491         LDKTxRemoveInput this_obj_conv;
49492         this_obj_conv.inner = untag_ptr(this_obj);
49493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49495         TxRemoveInput_free(this_obj_conv);
49496 }
49497
49498 uint64_t  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
49499         LDKTxRemoveInput this_ptr_conv;
49500         this_ptr_conv.inner = untag_ptr(this_ptr);
49501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49503         this_ptr_conv.is_owned = false;
49504         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
49505         uint64_t ret_ref = 0;
49506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49508         return ret_ref;
49509 }
49510
49511 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, uint64_t val) {
49512         LDKTxRemoveInput this_ptr_conv;
49513         this_ptr_conv.inner = untag_ptr(this_ptr);
49514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49516         this_ptr_conv.is_owned = false;
49517         LDKChannelId val_conv;
49518         val_conv.inner = untag_ptr(val);
49519         val_conv.is_owned = ptr_is_owned(val);
49520         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49521         val_conv = ChannelId_clone(&val_conv);
49522         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
49523 }
49524
49525 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
49526         LDKTxRemoveInput this_ptr_conv;
49527         this_ptr_conv.inner = untag_ptr(this_ptr);
49528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49530         this_ptr_conv.is_owned = false;
49531         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
49532         return ret_conv;
49533 }
49534
49535 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
49536         LDKTxRemoveInput this_ptr_conv;
49537         this_ptr_conv.inner = untag_ptr(this_ptr);
49538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49540         this_ptr_conv.is_owned = false;
49541         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
49542 }
49543
49544 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(uint64_t channel_id_arg, int64_t serial_id_arg) {
49545         LDKChannelId channel_id_arg_conv;
49546         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49547         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49548         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49549         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49550         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
49551         uint64_t ret_ref = 0;
49552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49554         return ret_ref;
49555 }
49556
49557 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
49558         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
49559         uint64_t ret_ref = 0;
49560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49562         return ret_ref;
49563 }
49564 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
49565         LDKTxRemoveInput arg_conv;
49566         arg_conv.inner = untag_ptr(arg);
49567         arg_conv.is_owned = ptr_is_owned(arg);
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49569         arg_conv.is_owned = false;
49570         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
49571         return ret_conv;
49572 }
49573
49574 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
49575         LDKTxRemoveInput orig_conv;
49576         orig_conv.inner = untag_ptr(orig);
49577         orig_conv.is_owned = ptr_is_owned(orig);
49578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49579         orig_conv.is_owned = false;
49580         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
49581         uint64_t ret_ref = 0;
49582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49584         return ret_ref;
49585 }
49586
49587 int64_t  __attribute__((export_name("TS_TxRemoveInput_hash"))) TS_TxRemoveInput_hash(uint64_t o) {
49588         LDKTxRemoveInput o_conv;
49589         o_conv.inner = untag_ptr(o);
49590         o_conv.is_owned = ptr_is_owned(o);
49591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49592         o_conv.is_owned = false;
49593         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
49594         return ret_conv;
49595 }
49596
49597 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
49598         LDKTxRemoveInput a_conv;
49599         a_conv.inner = untag_ptr(a);
49600         a_conv.is_owned = ptr_is_owned(a);
49601         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49602         a_conv.is_owned = false;
49603         LDKTxRemoveInput b_conv;
49604         b_conv.inner = untag_ptr(b);
49605         b_conv.is_owned = ptr_is_owned(b);
49606         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49607         b_conv.is_owned = false;
49608         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
49609         return ret_conv;
49610 }
49611
49612 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
49613         LDKTxRemoveOutput this_obj_conv;
49614         this_obj_conv.inner = untag_ptr(this_obj);
49615         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49617         TxRemoveOutput_free(this_obj_conv);
49618 }
49619
49620 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
49621         LDKTxRemoveOutput this_ptr_conv;
49622         this_ptr_conv.inner = untag_ptr(this_ptr);
49623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49625         this_ptr_conv.is_owned = false;
49626         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
49627         uint64_t ret_ref = 0;
49628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49630         return ret_ref;
49631 }
49632
49633 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, uint64_t val) {
49634         LDKTxRemoveOutput this_ptr_conv;
49635         this_ptr_conv.inner = untag_ptr(this_ptr);
49636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49638         this_ptr_conv.is_owned = false;
49639         LDKChannelId val_conv;
49640         val_conv.inner = untag_ptr(val);
49641         val_conv.is_owned = ptr_is_owned(val);
49642         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49643         val_conv = ChannelId_clone(&val_conv);
49644         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
49645 }
49646
49647 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
49648         LDKTxRemoveOutput this_ptr_conv;
49649         this_ptr_conv.inner = untag_ptr(this_ptr);
49650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49652         this_ptr_conv.is_owned = false;
49653         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
49654         return ret_conv;
49655 }
49656
49657 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
49658         LDKTxRemoveOutput this_ptr_conv;
49659         this_ptr_conv.inner = untag_ptr(this_ptr);
49660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49662         this_ptr_conv.is_owned = false;
49663         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
49664 }
49665
49666 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(uint64_t channel_id_arg, int64_t serial_id_arg) {
49667         LDKChannelId channel_id_arg_conv;
49668         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49669         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49670         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49671         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49672         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
49673         uint64_t ret_ref = 0;
49674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49676         return ret_ref;
49677 }
49678
49679 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
49680         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
49681         uint64_t ret_ref = 0;
49682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49684         return ret_ref;
49685 }
49686 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
49687         LDKTxRemoveOutput arg_conv;
49688         arg_conv.inner = untag_ptr(arg);
49689         arg_conv.is_owned = ptr_is_owned(arg);
49690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49691         arg_conv.is_owned = false;
49692         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
49693         return ret_conv;
49694 }
49695
49696 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
49697         LDKTxRemoveOutput orig_conv;
49698         orig_conv.inner = untag_ptr(orig);
49699         orig_conv.is_owned = ptr_is_owned(orig);
49700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49701         orig_conv.is_owned = false;
49702         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
49703         uint64_t ret_ref = 0;
49704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49706         return ret_ref;
49707 }
49708
49709 int64_t  __attribute__((export_name("TS_TxRemoveOutput_hash"))) TS_TxRemoveOutput_hash(uint64_t o) {
49710         LDKTxRemoveOutput o_conv;
49711         o_conv.inner = untag_ptr(o);
49712         o_conv.is_owned = ptr_is_owned(o);
49713         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49714         o_conv.is_owned = false;
49715         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
49716         return ret_conv;
49717 }
49718
49719 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
49720         LDKTxRemoveOutput a_conv;
49721         a_conv.inner = untag_ptr(a);
49722         a_conv.is_owned = ptr_is_owned(a);
49723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49724         a_conv.is_owned = false;
49725         LDKTxRemoveOutput b_conv;
49726         b_conv.inner = untag_ptr(b);
49727         b_conv.is_owned = ptr_is_owned(b);
49728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49729         b_conv.is_owned = false;
49730         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
49731         return ret_conv;
49732 }
49733
49734 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
49735         LDKTxComplete this_obj_conv;
49736         this_obj_conv.inner = untag_ptr(this_obj);
49737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49739         TxComplete_free(this_obj_conv);
49740 }
49741
49742 uint64_t  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
49743         LDKTxComplete this_ptr_conv;
49744         this_ptr_conv.inner = untag_ptr(this_ptr);
49745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49747         this_ptr_conv.is_owned = false;
49748         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
49749         uint64_t ret_ref = 0;
49750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49752         return ret_ref;
49753 }
49754
49755 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, uint64_t val) {
49756         LDKTxComplete this_ptr_conv;
49757         this_ptr_conv.inner = untag_ptr(this_ptr);
49758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49760         this_ptr_conv.is_owned = false;
49761         LDKChannelId val_conv;
49762         val_conv.inner = untag_ptr(val);
49763         val_conv.is_owned = ptr_is_owned(val);
49764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49765         val_conv = ChannelId_clone(&val_conv);
49766         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
49767 }
49768
49769 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(uint64_t channel_id_arg) {
49770         LDKChannelId channel_id_arg_conv;
49771         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49772         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49773         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49774         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49775         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
49776         uint64_t ret_ref = 0;
49777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49779         return ret_ref;
49780 }
49781
49782 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
49783         LDKTxComplete ret_var = TxComplete_clone(arg);
49784         uint64_t ret_ref = 0;
49785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49787         return ret_ref;
49788 }
49789 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
49790         LDKTxComplete arg_conv;
49791         arg_conv.inner = untag_ptr(arg);
49792         arg_conv.is_owned = ptr_is_owned(arg);
49793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49794         arg_conv.is_owned = false;
49795         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
49796         return ret_conv;
49797 }
49798
49799 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
49800         LDKTxComplete orig_conv;
49801         orig_conv.inner = untag_ptr(orig);
49802         orig_conv.is_owned = ptr_is_owned(orig);
49803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49804         orig_conv.is_owned = false;
49805         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
49806         uint64_t ret_ref = 0;
49807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49809         return ret_ref;
49810 }
49811
49812 int64_t  __attribute__((export_name("TS_TxComplete_hash"))) TS_TxComplete_hash(uint64_t o) {
49813         LDKTxComplete o_conv;
49814         o_conv.inner = untag_ptr(o);
49815         o_conv.is_owned = ptr_is_owned(o);
49816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49817         o_conv.is_owned = false;
49818         int64_t ret_conv = TxComplete_hash(&o_conv);
49819         return ret_conv;
49820 }
49821
49822 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
49823         LDKTxComplete a_conv;
49824         a_conv.inner = untag_ptr(a);
49825         a_conv.is_owned = ptr_is_owned(a);
49826         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49827         a_conv.is_owned = false;
49828         LDKTxComplete b_conv;
49829         b_conv.inner = untag_ptr(b);
49830         b_conv.is_owned = ptr_is_owned(b);
49831         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49832         b_conv.is_owned = false;
49833         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
49834         return ret_conv;
49835 }
49836
49837 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
49838         LDKTxSignatures this_obj_conv;
49839         this_obj_conv.inner = untag_ptr(this_obj);
49840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49842         TxSignatures_free(this_obj_conv);
49843 }
49844
49845 uint64_t  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
49846         LDKTxSignatures this_ptr_conv;
49847         this_ptr_conv.inner = untag_ptr(this_ptr);
49848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49850         this_ptr_conv.is_owned = false;
49851         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
49852         uint64_t ret_ref = 0;
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49855         return ret_ref;
49856 }
49857
49858 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, uint64_t val) {
49859         LDKTxSignatures this_ptr_conv;
49860         this_ptr_conv.inner = untag_ptr(this_ptr);
49861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49863         this_ptr_conv.is_owned = false;
49864         LDKChannelId val_conv;
49865         val_conv.inner = untag_ptr(val);
49866         val_conv.is_owned = ptr_is_owned(val);
49867         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49868         val_conv = ChannelId_clone(&val_conv);
49869         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
49870 }
49871
49872 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
49873         LDKTxSignatures this_ptr_conv;
49874         this_ptr_conv.inner = untag_ptr(this_ptr);
49875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49877         this_ptr_conv.is_owned = false;
49878         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49879         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
49880         return ret_arr;
49881 }
49882
49883 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
49884         LDKTxSignatures this_ptr_conv;
49885         this_ptr_conv.inner = untag_ptr(this_ptr);
49886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49888         this_ptr_conv.is_owned = false;
49889         LDKThirtyTwoBytes val_ref;
49890         CHECK(val->arr_len == 32);
49891         memcpy(val_ref.data, val->elems, 32); FREE(val);
49892         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
49893 }
49894
49895 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
49896         LDKTxSignatures this_ptr_conv;
49897         this_ptr_conv.inner = untag_ptr(this_ptr);
49898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49900         this_ptr_conv.is_owned = false;
49901         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
49902         ptrArray ret_arr = NULL;
49903         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
49904         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
49905         for (size_t m = 0; m < ret_var.datalen; m++) {
49906                 LDKWitness ret_conv_12_var = ret_var.data[m];
49907                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
49908                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
49909                 Witness_free(ret_conv_12_var);
49910                 ret_arr_ptr[m] = ret_conv_12_arr;
49911         }
49912         
49913         FREE(ret_var.data);
49914         return ret_arr;
49915 }
49916
49917 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
49918         LDKTxSignatures this_ptr_conv;
49919         this_ptr_conv.inner = untag_ptr(this_ptr);
49920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49922         this_ptr_conv.is_owned = false;
49923         LDKCVec_WitnessZ val_constr;
49924         val_constr.datalen = val->arr_len;
49925         if (val_constr.datalen > 0)
49926                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
49927         else
49928                 val_constr.data = NULL;
49929         int8_tArray* val_vals = (void*) val->elems;
49930         for (size_t m = 0; m < val_constr.datalen; m++) {
49931                 int8_tArray val_conv_12 = val_vals[m];
49932                 LDKWitness val_conv_12_ref;
49933                 val_conv_12_ref.datalen = val_conv_12->arr_len;
49934                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
49935                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
49936                 val_conv_12_ref.data_is_owned = true;
49937                 val_constr.data[m] = val_conv_12_ref;
49938         }
49939         FREE(val);
49940         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
49941 }
49942
49943 uint64_t  __attribute__((export_name("TS_TxSignatures_get_funding_outpoint_sig"))) TS_TxSignatures_get_funding_outpoint_sig(uint64_t this_ptr) {
49944         LDKTxSignatures this_ptr_conv;
49945         this_ptr_conv.inner = untag_ptr(this_ptr);
49946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49948         this_ptr_conv.is_owned = false;
49949         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
49950         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
49951         uint64_t ret_ref = tag_ptr(ret_copy, true);
49952         return ret_ref;
49953 }
49954
49955 void  __attribute__((export_name("TS_TxSignatures_set_funding_outpoint_sig"))) TS_TxSignatures_set_funding_outpoint_sig(uint64_t this_ptr, uint64_t val) {
49956         LDKTxSignatures this_ptr_conv;
49957         this_ptr_conv.inner = untag_ptr(this_ptr);
49958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49960         this_ptr_conv.is_owned = false;
49961         void* val_ptr = untag_ptr(val);
49962         CHECK_ACCESS(val_ptr);
49963         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
49964         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
49965         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
49966 }
49967
49968 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(uint64_t channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg, uint64_t funding_outpoint_sig_arg) {
49969         LDKChannelId channel_id_arg_conv;
49970         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49971         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49972         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49973         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49974         LDKThirtyTwoBytes tx_hash_arg_ref;
49975         CHECK(tx_hash_arg->arr_len == 32);
49976         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
49977         LDKCVec_WitnessZ witnesses_arg_constr;
49978         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
49979         if (witnesses_arg_constr.datalen > 0)
49980                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
49981         else
49982                 witnesses_arg_constr.data = NULL;
49983         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
49984         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
49985                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
49986                 LDKWitness witnesses_arg_conv_12_ref;
49987                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
49988                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
49989                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
49990                 witnesses_arg_conv_12_ref.data_is_owned = true;
49991                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
49992         }
49993         FREE(witnesses_arg);
49994         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
49995         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
49996         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
49997         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
49998         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
49999         uint64_t ret_ref = 0;
50000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50002         return ret_ref;
50003 }
50004
50005 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
50006         LDKTxSignatures ret_var = TxSignatures_clone(arg);
50007         uint64_t ret_ref = 0;
50008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50010         return ret_ref;
50011 }
50012 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
50013         LDKTxSignatures arg_conv;
50014         arg_conv.inner = untag_ptr(arg);
50015         arg_conv.is_owned = ptr_is_owned(arg);
50016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50017         arg_conv.is_owned = false;
50018         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
50019         return ret_conv;
50020 }
50021
50022 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
50023         LDKTxSignatures orig_conv;
50024         orig_conv.inner = untag_ptr(orig);
50025         orig_conv.is_owned = ptr_is_owned(orig);
50026         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50027         orig_conv.is_owned = false;
50028         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
50029         uint64_t ret_ref = 0;
50030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50032         return ret_ref;
50033 }
50034
50035 int64_t  __attribute__((export_name("TS_TxSignatures_hash"))) TS_TxSignatures_hash(uint64_t o) {
50036         LDKTxSignatures o_conv;
50037         o_conv.inner = untag_ptr(o);
50038         o_conv.is_owned = ptr_is_owned(o);
50039         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50040         o_conv.is_owned = false;
50041         int64_t ret_conv = TxSignatures_hash(&o_conv);
50042         return ret_conv;
50043 }
50044
50045 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
50046         LDKTxSignatures a_conv;
50047         a_conv.inner = untag_ptr(a);
50048         a_conv.is_owned = ptr_is_owned(a);
50049         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50050         a_conv.is_owned = false;
50051         LDKTxSignatures b_conv;
50052         b_conv.inner = untag_ptr(b);
50053         b_conv.is_owned = ptr_is_owned(b);
50054         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50055         b_conv.is_owned = false;
50056         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
50057         return ret_conv;
50058 }
50059
50060 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
50061         LDKTxInitRbf this_obj_conv;
50062         this_obj_conv.inner = untag_ptr(this_obj);
50063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50065         TxInitRbf_free(this_obj_conv);
50066 }
50067
50068 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
50069         LDKTxInitRbf this_ptr_conv;
50070         this_ptr_conv.inner = untag_ptr(this_ptr);
50071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50073         this_ptr_conv.is_owned = false;
50074         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
50075         uint64_t ret_ref = 0;
50076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50078         return ret_ref;
50079 }
50080
50081 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, uint64_t val) {
50082         LDKTxInitRbf this_ptr_conv;
50083         this_ptr_conv.inner = untag_ptr(this_ptr);
50084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50086         this_ptr_conv.is_owned = false;
50087         LDKChannelId val_conv;
50088         val_conv.inner = untag_ptr(val);
50089         val_conv.is_owned = ptr_is_owned(val);
50090         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50091         val_conv = ChannelId_clone(&val_conv);
50092         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
50093 }
50094
50095 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
50096         LDKTxInitRbf this_ptr_conv;
50097         this_ptr_conv.inner = untag_ptr(this_ptr);
50098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50100         this_ptr_conv.is_owned = false;
50101         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
50102         return ret_conv;
50103 }
50104
50105 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
50106         LDKTxInitRbf this_ptr_conv;
50107         this_ptr_conv.inner = untag_ptr(this_ptr);
50108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50110         this_ptr_conv.is_owned = false;
50111         TxInitRbf_set_locktime(&this_ptr_conv, val);
50112 }
50113
50114 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) {
50115         LDKTxInitRbf this_ptr_conv;
50116         this_ptr_conv.inner = untag_ptr(this_ptr);
50117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50119         this_ptr_conv.is_owned = false;
50120         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
50121         return ret_conv;
50122 }
50123
50124 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) {
50125         LDKTxInitRbf this_ptr_conv;
50126         this_ptr_conv.inner = untag_ptr(this_ptr);
50127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50129         this_ptr_conv.is_owned = false;
50130         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
50131 }
50132
50133 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
50134         LDKTxInitRbf 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         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50140         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
50141         uint64_t ret_ref = tag_ptr(ret_copy, true);
50142         return ret_ref;
50143 }
50144
50145 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
50146         LDKTxInitRbf this_ptr_conv;
50147         this_ptr_conv.inner = untag_ptr(this_ptr);
50148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50150         this_ptr_conv.is_owned = false;
50151         void* val_ptr = untag_ptr(val);
50152         CHECK_ACCESS(val_ptr);
50153         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50154         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50155         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50156 }
50157
50158 uint64_t  __attribute__((export_name("TS_TxInitRbf_new"))) TS_TxInitRbf_new(uint64_t channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, uint64_t funding_output_contribution_arg) {
50159         LDKChannelId channel_id_arg_conv;
50160         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50161         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50162         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50163         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50164         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50165         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50166         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50167         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50168         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
50169         uint64_t ret_ref = 0;
50170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50172         return ret_ref;
50173 }
50174
50175 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
50176         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
50177         uint64_t ret_ref = 0;
50178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50180         return ret_ref;
50181 }
50182 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
50183         LDKTxInitRbf arg_conv;
50184         arg_conv.inner = untag_ptr(arg);
50185         arg_conv.is_owned = ptr_is_owned(arg);
50186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50187         arg_conv.is_owned = false;
50188         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
50189         return ret_conv;
50190 }
50191
50192 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
50193         LDKTxInitRbf orig_conv;
50194         orig_conv.inner = untag_ptr(orig);
50195         orig_conv.is_owned = ptr_is_owned(orig);
50196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50197         orig_conv.is_owned = false;
50198         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
50199         uint64_t ret_ref = 0;
50200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50202         return ret_ref;
50203 }
50204
50205 int64_t  __attribute__((export_name("TS_TxInitRbf_hash"))) TS_TxInitRbf_hash(uint64_t o) {
50206         LDKTxInitRbf o_conv;
50207         o_conv.inner = untag_ptr(o);
50208         o_conv.is_owned = ptr_is_owned(o);
50209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50210         o_conv.is_owned = false;
50211         int64_t ret_conv = TxInitRbf_hash(&o_conv);
50212         return ret_conv;
50213 }
50214
50215 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
50216         LDKTxInitRbf a_conv;
50217         a_conv.inner = untag_ptr(a);
50218         a_conv.is_owned = ptr_is_owned(a);
50219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50220         a_conv.is_owned = false;
50221         LDKTxInitRbf b_conv;
50222         b_conv.inner = untag_ptr(b);
50223         b_conv.is_owned = ptr_is_owned(b);
50224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50225         b_conv.is_owned = false;
50226         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
50227         return ret_conv;
50228 }
50229
50230 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
50231         LDKTxAckRbf this_obj_conv;
50232         this_obj_conv.inner = untag_ptr(this_obj);
50233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50235         TxAckRbf_free(this_obj_conv);
50236 }
50237
50238 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
50239         LDKTxAckRbf this_ptr_conv;
50240         this_ptr_conv.inner = untag_ptr(this_ptr);
50241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50243         this_ptr_conv.is_owned = false;
50244         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
50245         uint64_t ret_ref = 0;
50246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50248         return ret_ref;
50249 }
50250
50251 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, uint64_t val) {
50252         LDKTxAckRbf this_ptr_conv;
50253         this_ptr_conv.inner = untag_ptr(this_ptr);
50254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50256         this_ptr_conv.is_owned = false;
50257         LDKChannelId val_conv;
50258         val_conv.inner = untag_ptr(val);
50259         val_conv.is_owned = ptr_is_owned(val);
50260         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50261         val_conv = ChannelId_clone(&val_conv);
50262         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
50263 }
50264
50265 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
50266         LDKTxAckRbf this_ptr_conv;
50267         this_ptr_conv.inner = untag_ptr(this_ptr);
50268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50270         this_ptr_conv.is_owned = false;
50271         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50272         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
50273         uint64_t ret_ref = tag_ptr(ret_copy, true);
50274         return ret_ref;
50275 }
50276
50277 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
50278         LDKTxAckRbf this_ptr_conv;
50279         this_ptr_conv.inner = untag_ptr(this_ptr);
50280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50282         this_ptr_conv.is_owned = false;
50283         void* val_ptr = untag_ptr(val);
50284         CHECK_ACCESS(val_ptr);
50285         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50286         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50287         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50288 }
50289
50290 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(uint64_t channel_id_arg, uint64_t funding_output_contribution_arg) {
50291         LDKChannelId channel_id_arg_conv;
50292         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50293         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50294         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50295         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50296         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50297         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50298         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50299         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50300         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
50301         uint64_t ret_ref = 0;
50302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50304         return ret_ref;
50305 }
50306
50307 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
50308         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
50309         uint64_t ret_ref = 0;
50310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50312         return ret_ref;
50313 }
50314 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
50315         LDKTxAckRbf arg_conv;
50316         arg_conv.inner = untag_ptr(arg);
50317         arg_conv.is_owned = ptr_is_owned(arg);
50318         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50319         arg_conv.is_owned = false;
50320         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
50321         return ret_conv;
50322 }
50323
50324 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
50325         LDKTxAckRbf orig_conv;
50326         orig_conv.inner = untag_ptr(orig);
50327         orig_conv.is_owned = ptr_is_owned(orig);
50328         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50329         orig_conv.is_owned = false;
50330         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
50331         uint64_t ret_ref = 0;
50332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50334         return ret_ref;
50335 }
50336
50337 int64_t  __attribute__((export_name("TS_TxAckRbf_hash"))) TS_TxAckRbf_hash(uint64_t o) {
50338         LDKTxAckRbf o_conv;
50339         o_conv.inner = untag_ptr(o);
50340         o_conv.is_owned = ptr_is_owned(o);
50341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50342         o_conv.is_owned = false;
50343         int64_t ret_conv = TxAckRbf_hash(&o_conv);
50344         return ret_conv;
50345 }
50346
50347 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
50348         LDKTxAckRbf a_conv;
50349         a_conv.inner = untag_ptr(a);
50350         a_conv.is_owned = ptr_is_owned(a);
50351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50352         a_conv.is_owned = false;
50353         LDKTxAckRbf b_conv;
50354         b_conv.inner = untag_ptr(b);
50355         b_conv.is_owned = ptr_is_owned(b);
50356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50357         b_conv.is_owned = false;
50358         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
50359         return ret_conv;
50360 }
50361
50362 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
50363         LDKTxAbort this_obj_conv;
50364         this_obj_conv.inner = untag_ptr(this_obj);
50365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50367         TxAbort_free(this_obj_conv);
50368 }
50369
50370 uint64_t  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
50371         LDKTxAbort this_ptr_conv;
50372         this_ptr_conv.inner = untag_ptr(this_ptr);
50373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50375         this_ptr_conv.is_owned = false;
50376         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
50377         uint64_t ret_ref = 0;
50378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50380         return ret_ref;
50381 }
50382
50383 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, uint64_t val) {
50384         LDKTxAbort this_ptr_conv;
50385         this_ptr_conv.inner = untag_ptr(this_ptr);
50386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50388         this_ptr_conv.is_owned = false;
50389         LDKChannelId val_conv;
50390         val_conv.inner = untag_ptr(val);
50391         val_conv.is_owned = ptr_is_owned(val);
50392         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50393         val_conv = ChannelId_clone(&val_conv);
50394         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
50395 }
50396
50397 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
50398         LDKTxAbort this_ptr_conv;
50399         this_ptr_conv.inner = untag_ptr(this_ptr);
50400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50402         this_ptr_conv.is_owned = false;
50403         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
50404         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50405         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50406         CVec_u8Z_free(ret_var);
50407         return ret_arr;
50408 }
50409
50410 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
50411         LDKTxAbort this_ptr_conv;
50412         this_ptr_conv.inner = untag_ptr(this_ptr);
50413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50415         this_ptr_conv.is_owned = false;
50416         LDKCVec_u8Z val_ref;
50417         val_ref.datalen = val->arr_len;
50418         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
50419         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
50420         TxAbort_set_data(&this_ptr_conv, val_ref);
50421 }
50422
50423 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(uint64_t channel_id_arg, int8_tArray data_arg) {
50424         LDKChannelId channel_id_arg_conv;
50425         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50426         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50427         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50428         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50429         LDKCVec_u8Z data_arg_ref;
50430         data_arg_ref.datalen = data_arg->arr_len;
50431         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
50432         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
50433         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
50434         uint64_t ret_ref = 0;
50435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50437         return ret_ref;
50438 }
50439
50440 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
50441         LDKTxAbort ret_var = TxAbort_clone(arg);
50442         uint64_t ret_ref = 0;
50443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50445         return ret_ref;
50446 }
50447 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
50448         LDKTxAbort arg_conv;
50449         arg_conv.inner = untag_ptr(arg);
50450         arg_conv.is_owned = ptr_is_owned(arg);
50451         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50452         arg_conv.is_owned = false;
50453         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
50454         return ret_conv;
50455 }
50456
50457 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
50458         LDKTxAbort orig_conv;
50459         orig_conv.inner = untag_ptr(orig);
50460         orig_conv.is_owned = ptr_is_owned(orig);
50461         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50462         orig_conv.is_owned = false;
50463         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
50464         uint64_t ret_ref = 0;
50465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50467         return ret_ref;
50468 }
50469
50470 int64_t  __attribute__((export_name("TS_TxAbort_hash"))) TS_TxAbort_hash(uint64_t o) {
50471         LDKTxAbort o_conv;
50472         o_conv.inner = untag_ptr(o);
50473         o_conv.is_owned = ptr_is_owned(o);
50474         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50475         o_conv.is_owned = false;
50476         int64_t ret_conv = TxAbort_hash(&o_conv);
50477         return ret_conv;
50478 }
50479
50480 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
50481         LDKTxAbort a_conv;
50482         a_conv.inner = untag_ptr(a);
50483         a_conv.is_owned = ptr_is_owned(a);
50484         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50485         a_conv.is_owned = false;
50486         LDKTxAbort b_conv;
50487         b_conv.inner = untag_ptr(b);
50488         b_conv.is_owned = ptr_is_owned(b);
50489         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50490         b_conv.is_owned = false;
50491         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
50492         return ret_conv;
50493 }
50494
50495 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
50496         LDKShutdown this_obj_conv;
50497         this_obj_conv.inner = untag_ptr(this_obj);
50498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50500         Shutdown_free(this_obj_conv);
50501 }
50502
50503 uint64_t  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
50504         LDKShutdown this_ptr_conv;
50505         this_ptr_conv.inner = untag_ptr(this_ptr);
50506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50508         this_ptr_conv.is_owned = false;
50509         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
50510         uint64_t ret_ref = 0;
50511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50513         return ret_ref;
50514 }
50515
50516 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, uint64_t val) {
50517         LDKShutdown this_ptr_conv;
50518         this_ptr_conv.inner = untag_ptr(this_ptr);
50519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50521         this_ptr_conv.is_owned = false;
50522         LDKChannelId val_conv;
50523         val_conv.inner = untag_ptr(val);
50524         val_conv.is_owned = ptr_is_owned(val);
50525         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50526         val_conv = ChannelId_clone(&val_conv);
50527         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
50528 }
50529
50530 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
50531         LDKShutdown this_ptr_conv;
50532         this_ptr_conv.inner = untag_ptr(this_ptr);
50533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50535         this_ptr_conv.is_owned = false;
50536         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
50537         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50538         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50539         CVec_u8Z_free(ret_var);
50540         return ret_arr;
50541 }
50542
50543 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
50544         LDKShutdown this_ptr_conv;
50545         this_ptr_conv.inner = untag_ptr(this_ptr);
50546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50548         this_ptr_conv.is_owned = false;
50549         LDKCVec_u8Z val_ref;
50550         val_ref.datalen = val->arr_len;
50551         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
50552         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
50553         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
50554 }
50555
50556 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(uint64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
50557         LDKChannelId channel_id_arg_conv;
50558         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50559         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50560         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50561         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50562         LDKCVec_u8Z scriptpubkey_arg_ref;
50563         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
50564         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
50565         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
50566         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
50567         uint64_t ret_ref = 0;
50568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50570         return ret_ref;
50571 }
50572
50573 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
50574         LDKShutdown ret_var = Shutdown_clone(arg);
50575         uint64_t ret_ref = 0;
50576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50578         return ret_ref;
50579 }
50580 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
50581         LDKShutdown arg_conv;
50582         arg_conv.inner = untag_ptr(arg);
50583         arg_conv.is_owned = ptr_is_owned(arg);
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50585         arg_conv.is_owned = false;
50586         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
50587         return ret_conv;
50588 }
50589
50590 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
50591         LDKShutdown orig_conv;
50592         orig_conv.inner = untag_ptr(orig);
50593         orig_conv.is_owned = ptr_is_owned(orig);
50594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50595         orig_conv.is_owned = false;
50596         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
50597         uint64_t ret_ref = 0;
50598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50600         return ret_ref;
50601 }
50602
50603 int64_t  __attribute__((export_name("TS_Shutdown_hash"))) TS_Shutdown_hash(uint64_t o) {
50604         LDKShutdown o_conv;
50605         o_conv.inner = untag_ptr(o);
50606         o_conv.is_owned = ptr_is_owned(o);
50607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50608         o_conv.is_owned = false;
50609         int64_t ret_conv = Shutdown_hash(&o_conv);
50610         return ret_conv;
50611 }
50612
50613 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
50614         LDKShutdown a_conv;
50615         a_conv.inner = untag_ptr(a);
50616         a_conv.is_owned = ptr_is_owned(a);
50617         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50618         a_conv.is_owned = false;
50619         LDKShutdown b_conv;
50620         b_conv.inner = untag_ptr(b);
50621         b_conv.is_owned = ptr_is_owned(b);
50622         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50623         b_conv.is_owned = false;
50624         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
50625         return ret_conv;
50626 }
50627
50628 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
50629         LDKClosingSignedFeeRange this_obj_conv;
50630         this_obj_conv.inner = untag_ptr(this_obj);
50631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50633         ClosingSignedFeeRange_free(this_obj_conv);
50634 }
50635
50636 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
50637         LDKClosingSignedFeeRange this_ptr_conv;
50638         this_ptr_conv.inner = untag_ptr(this_ptr);
50639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50641         this_ptr_conv.is_owned = false;
50642         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
50643         return ret_conv;
50644 }
50645
50646 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
50647         LDKClosingSignedFeeRange this_ptr_conv;
50648         this_ptr_conv.inner = untag_ptr(this_ptr);
50649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50651         this_ptr_conv.is_owned = false;
50652         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
50653 }
50654
50655 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
50656         LDKClosingSignedFeeRange this_ptr_conv;
50657         this_ptr_conv.inner = untag_ptr(this_ptr);
50658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50660         this_ptr_conv.is_owned = false;
50661         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
50662         return ret_conv;
50663 }
50664
50665 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
50666         LDKClosingSignedFeeRange this_ptr_conv;
50667         this_ptr_conv.inner = untag_ptr(this_ptr);
50668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50670         this_ptr_conv.is_owned = false;
50671         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
50672 }
50673
50674 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
50675         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
50676         uint64_t ret_ref = 0;
50677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50679         return ret_ref;
50680 }
50681
50682 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
50683         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
50684         uint64_t ret_ref = 0;
50685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50687         return ret_ref;
50688 }
50689 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
50690         LDKClosingSignedFeeRange arg_conv;
50691         arg_conv.inner = untag_ptr(arg);
50692         arg_conv.is_owned = ptr_is_owned(arg);
50693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50694         arg_conv.is_owned = false;
50695         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
50696         return ret_conv;
50697 }
50698
50699 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
50700         LDKClosingSignedFeeRange orig_conv;
50701         orig_conv.inner = untag_ptr(orig);
50702         orig_conv.is_owned = ptr_is_owned(orig);
50703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50704         orig_conv.is_owned = false;
50705         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
50706         uint64_t ret_ref = 0;
50707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50709         return ret_ref;
50710 }
50711
50712 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_hash"))) TS_ClosingSignedFeeRange_hash(uint64_t o) {
50713         LDKClosingSignedFeeRange o_conv;
50714         o_conv.inner = untag_ptr(o);
50715         o_conv.is_owned = ptr_is_owned(o);
50716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50717         o_conv.is_owned = false;
50718         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
50719         return ret_conv;
50720 }
50721
50722 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
50723         LDKClosingSignedFeeRange a_conv;
50724         a_conv.inner = untag_ptr(a);
50725         a_conv.is_owned = ptr_is_owned(a);
50726         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50727         a_conv.is_owned = false;
50728         LDKClosingSignedFeeRange b_conv;
50729         b_conv.inner = untag_ptr(b);
50730         b_conv.is_owned = ptr_is_owned(b);
50731         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50732         b_conv.is_owned = false;
50733         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
50734         return ret_conv;
50735 }
50736
50737 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
50738         LDKClosingSigned this_obj_conv;
50739         this_obj_conv.inner = untag_ptr(this_obj);
50740         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50742         ClosingSigned_free(this_obj_conv);
50743 }
50744
50745 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
50746         LDKClosingSigned this_ptr_conv;
50747         this_ptr_conv.inner = untag_ptr(this_ptr);
50748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50750         this_ptr_conv.is_owned = false;
50751         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
50752         uint64_t ret_ref = 0;
50753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50755         return ret_ref;
50756 }
50757
50758 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
50759         LDKClosingSigned this_ptr_conv;
50760         this_ptr_conv.inner = untag_ptr(this_ptr);
50761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50763         this_ptr_conv.is_owned = false;
50764         LDKChannelId val_conv;
50765         val_conv.inner = untag_ptr(val);
50766         val_conv.is_owned = ptr_is_owned(val);
50767         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50768         val_conv = ChannelId_clone(&val_conv);
50769         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
50770 }
50771
50772 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
50773         LDKClosingSigned this_ptr_conv;
50774         this_ptr_conv.inner = untag_ptr(this_ptr);
50775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50777         this_ptr_conv.is_owned = false;
50778         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
50779         return ret_conv;
50780 }
50781
50782 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
50783         LDKClosingSigned this_ptr_conv;
50784         this_ptr_conv.inner = untag_ptr(this_ptr);
50785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50787         this_ptr_conv.is_owned = false;
50788         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
50789 }
50790
50791 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
50792         LDKClosingSigned this_ptr_conv;
50793         this_ptr_conv.inner = untag_ptr(this_ptr);
50794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50796         this_ptr_conv.is_owned = false;
50797         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
50798         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
50799         return ret_arr;
50800 }
50801
50802 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
50803         LDKClosingSigned this_ptr_conv;
50804         this_ptr_conv.inner = untag_ptr(this_ptr);
50805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50807         this_ptr_conv.is_owned = false;
50808         LDKECDSASignature val_ref;
50809         CHECK(val->arr_len == 64);
50810         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
50811         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
50812 }
50813
50814 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
50815         LDKClosingSigned this_ptr_conv;
50816         this_ptr_conv.inner = untag_ptr(this_ptr);
50817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50819         this_ptr_conv.is_owned = false;
50820         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
50821         uint64_t ret_ref = 0;
50822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50824         return ret_ref;
50825 }
50826
50827 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
50828         LDKClosingSigned this_ptr_conv;
50829         this_ptr_conv.inner = untag_ptr(this_ptr);
50830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50832         this_ptr_conv.is_owned = false;
50833         LDKClosingSignedFeeRange val_conv;
50834         val_conv.inner = untag_ptr(val);
50835         val_conv.is_owned = ptr_is_owned(val);
50836         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50837         val_conv = ClosingSignedFeeRange_clone(&val_conv);
50838         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
50839 }
50840
50841 uint64_t  __attribute__((export_name("TS_ClosingSigned_new"))) TS_ClosingSigned_new(uint64_t channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint64_t fee_range_arg) {
50842         LDKChannelId channel_id_arg_conv;
50843         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50844         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50846         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50847         LDKECDSASignature signature_arg_ref;
50848         CHECK(signature_arg->arr_len == 64);
50849         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
50850         LDKClosingSignedFeeRange fee_range_arg_conv;
50851         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
50852         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
50853         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
50854         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
50855         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
50856         uint64_t ret_ref = 0;
50857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50859         return ret_ref;
50860 }
50861
50862 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
50863         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
50864         uint64_t ret_ref = 0;
50865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50867         return ret_ref;
50868 }
50869 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
50870         LDKClosingSigned arg_conv;
50871         arg_conv.inner = untag_ptr(arg);
50872         arg_conv.is_owned = ptr_is_owned(arg);
50873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50874         arg_conv.is_owned = false;
50875         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
50876         return ret_conv;
50877 }
50878
50879 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
50880         LDKClosingSigned orig_conv;
50881         orig_conv.inner = untag_ptr(orig);
50882         orig_conv.is_owned = ptr_is_owned(orig);
50883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50884         orig_conv.is_owned = false;
50885         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
50886         uint64_t ret_ref = 0;
50887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50889         return ret_ref;
50890 }
50891
50892 int64_t  __attribute__((export_name("TS_ClosingSigned_hash"))) TS_ClosingSigned_hash(uint64_t o) {
50893         LDKClosingSigned o_conv;
50894         o_conv.inner = untag_ptr(o);
50895         o_conv.is_owned = ptr_is_owned(o);
50896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50897         o_conv.is_owned = false;
50898         int64_t ret_conv = ClosingSigned_hash(&o_conv);
50899         return ret_conv;
50900 }
50901
50902 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
50903         LDKClosingSigned a_conv;
50904         a_conv.inner = untag_ptr(a);
50905         a_conv.is_owned = ptr_is_owned(a);
50906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50907         a_conv.is_owned = false;
50908         LDKClosingSigned b_conv;
50909         b_conv.inner = untag_ptr(b);
50910         b_conv.is_owned = ptr_is_owned(b);
50911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50912         b_conv.is_owned = false;
50913         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
50914         return ret_conv;
50915 }
50916
50917 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
50918         LDKUpdateAddHTLC this_obj_conv;
50919         this_obj_conv.inner = untag_ptr(this_obj);
50920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50922         UpdateAddHTLC_free(this_obj_conv);
50923 }
50924
50925 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
50926         LDKUpdateAddHTLC this_ptr_conv;
50927         this_ptr_conv.inner = untag_ptr(this_ptr);
50928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50930         this_ptr_conv.is_owned = false;
50931         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
50932         uint64_t ret_ref = 0;
50933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50935         return ret_ref;
50936 }
50937
50938 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
50939         LDKUpdateAddHTLC this_ptr_conv;
50940         this_ptr_conv.inner = untag_ptr(this_ptr);
50941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50943         this_ptr_conv.is_owned = false;
50944         LDKChannelId val_conv;
50945         val_conv.inner = untag_ptr(val);
50946         val_conv.is_owned = ptr_is_owned(val);
50947         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50948         val_conv = ChannelId_clone(&val_conv);
50949         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
50950 }
50951
50952 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
50953         LDKUpdateAddHTLC this_ptr_conv;
50954         this_ptr_conv.inner = untag_ptr(this_ptr);
50955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50957         this_ptr_conv.is_owned = false;
50958         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
50959         return ret_conv;
50960 }
50961
50962 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
50963         LDKUpdateAddHTLC this_ptr_conv;
50964         this_ptr_conv.inner = untag_ptr(this_ptr);
50965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50967         this_ptr_conv.is_owned = false;
50968         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
50969 }
50970
50971 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
50972         LDKUpdateAddHTLC this_ptr_conv;
50973         this_ptr_conv.inner = untag_ptr(this_ptr);
50974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50976         this_ptr_conv.is_owned = false;
50977         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
50978         return ret_conv;
50979 }
50980
50981 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
50982         LDKUpdateAddHTLC this_ptr_conv;
50983         this_ptr_conv.inner = untag_ptr(this_ptr);
50984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50986         this_ptr_conv.is_owned = false;
50987         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
50988 }
50989
50990 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
50991         LDKUpdateAddHTLC this_ptr_conv;
50992         this_ptr_conv.inner = untag_ptr(this_ptr);
50993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50995         this_ptr_conv.is_owned = false;
50996         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50997         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
50998         return ret_arr;
50999 }
51000
51001 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
51002         LDKUpdateAddHTLC this_ptr_conv;
51003         this_ptr_conv.inner = untag_ptr(this_ptr);
51004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51006         this_ptr_conv.is_owned = false;
51007         LDKThirtyTwoBytes val_ref;
51008         CHECK(val->arr_len == 32);
51009         memcpy(val_ref.data, val->elems, 32); FREE(val);
51010         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
51011 }
51012
51013 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
51014         LDKUpdateAddHTLC this_ptr_conv;
51015         this_ptr_conv.inner = untag_ptr(this_ptr);
51016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51018         this_ptr_conv.is_owned = false;
51019         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
51020         return ret_conv;
51021 }
51022
51023 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
51024         LDKUpdateAddHTLC this_ptr_conv;
51025         this_ptr_conv.inner = untag_ptr(this_ptr);
51026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51028         this_ptr_conv.is_owned = false;
51029         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
51030 }
51031
51032 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
51033         LDKUpdateAddHTLC this_ptr_conv;
51034         this_ptr_conv.inner = untag_ptr(this_ptr);
51035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51037         this_ptr_conv.is_owned = false;
51038         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51039         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
51040         uint64_t ret_ref = tag_ptr(ret_copy, true);
51041         return ret_ref;
51042 }
51043
51044 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
51045         LDKUpdateAddHTLC this_ptr_conv;
51046         this_ptr_conv.inner = untag_ptr(this_ptr);
51047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51049         this_ptr_conv.is_owned = false;
51050         void* val_ptr = untag_ptr(val);
51051         CHECK_ACCESS(val_ptr);
51052         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51053         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51054         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
51055 }
51056
51057 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_onion_routing_packet"))) TS_UpdateAddHTLC_get_onion_routing_packet(uint64_t this_ptr) {
51058         LDKUpdateAddHTLC this_ptr_conv;
51059         this_ptr_conv.inner = untag_ptr(this_ptr);
51060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51062         this_ptr_conv.is_owned = false;
51063         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
51064         uint64_t ret_ref = 0;
51065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51067         return ret_ref;
51068 }
51069
51070 void  __attribute__((export_name("TS_UpdateAddHTLC_set_onion_routing_packet"))) TS_UpdateAddHTLC_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
51071         LDKUpdateAddHTLC this_ptr_conv;
51072         this_ptr_conv.inner = untag_ptr(this_ptr);
51073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51075         this_ptr_conv.is_owned = false;
51076         LDKOnionPacket val_conv;
51077         val_conv.inner = untag_ptr(val);
51078         val_conv.is_owned = ptr_is_owned(val);
51079         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51080         val_conv = OnionPacket_clone(&val_conv);
51081         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
51082 }
51083
51084 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_blinding_point"))) TS_UpdateAddHTLC_get_blinding_point(uint64_t this_ptr) {
51085         LDKUpdateAddHTLC this_ptr_conv;
51086         this_ptr_conv.inner = untag_ptr(this_ptr);
51087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51089         this_ptr_conv.is_owned = false;
51090         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51091         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
51092         return ret_arr;
51093 }
51094
51095 void  __attribute__((export_name("TS_UpdateAddHTLC_set_blinding_point"))) TS_UpdateAddHTLC_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
51096         LDKUpdateAddHTLC this_ptr_conv;
51097         this_ptr_conv.inner = untag_ptr(this_ptr);
51098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51100         this_ptr_conv.is_owned = false;
51101         LDKPublicKey val_ref;
51102         CHECK(val->arr_len == 33);
51103         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51104         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
51105 }
51106
51107 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_new"))) TS_UpdateAddHTLC_new(uint64_t 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) {
51108         LDKChannelId channel_id_arg_conv;
51109         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51110         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51111         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51112         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51113         LDKThirtyTwoBytes payment_hash_arg_ref;
51114         CHECK(payment_hash_arg->arr_len == 32);
51115         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
51116         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
51117         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
51118         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
51119         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
51120         LDKOnionPacket onion_routing_packet_arg_conv;
51121         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51122         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51123         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51124         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
51125         LDKPublicKey blinding_point_arg_ref;
51126         CHECK(blinding_point_arg->arr_len == 33);
51127         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
51128         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_conv, 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);
51129         uint64_t ret_ref = 0;
51130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51132         return ret_ref;
51133 }
51134
51135 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
51136         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
51137         uint64_t ret_ref = 0;
51138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51140         return ret_ref;
51141 }
51142 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
51143         LDKUpdateAddHTLC arg_conv;
51144         arg_conv.inner = untag_ptr(arg);
51145         arg_conv.is_owned = ptr_is_owned(arg);
51146         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51147         arg_conv.is_owned = false;
51148         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
51149         return ret_conv;
51150 }
51151
51152 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
51153         LDKUpdateAddHTLC orig_conv;
51154         orig_conv.inner = untag_ptr(orig);
51155         orig_conv.is_owned = ptr_is_owned(orig);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51157         orig_conv.is_owned = false;
51158         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
51159         uint64_t ret_ref = 0;
51160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51162         return ret_ref;
51163 }
51164
51165 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_hash"))) TS_UpdateAddHTLC_hash(uint64_t o) {
51166         LDKUpdateAddHTLC o_conv;
51167         o_conv.inner = untag_ptr(o);
51168         o_conv.is_owned = ptr_is_owned(o);
51169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51170         o_conv.is_owned = false;
51171         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
51172         return ret_conv;
51173 }
51174
51175 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
51176         LDKUpdateAddHTLC a_conv;
51177         a_conv.inner = untag_ptr(a);
51178         a_conv.is_owned = ptr_is_owned(a);
51179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51180         a_conv.is_owned = false;
51181         LDKUpdateAddHTLC b_conv;
51182         b_conv.inner = untag_ptr(b);
51183         b_conv.is_owned = ptr_is_owned(b);
51184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51185         b_conv.is_owned = false;
51186         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
51187         return ret_conv;
51188 }
51189
51190 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
51191         LDKOnionMessage this_obj_conv;
51192         this_obj_conv.inner = untag_ptr(this_obj);
51193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51195         OnionMessage_free(this_obj_conv);
51196 }
51197
51198 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
51199         LDKOnionMessage this_ptr_conv;
51200         this_ptr_conv.inner = untag_ptr(this_ptr);
51201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51203         this_ptr_conv.is_owned = false;
51204         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51205         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
51206         return ret_arr;
51207 }
51208
51209 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
51210         LDKOnionMessage this_ptr_conv;
51211         this_ptr_conv.inner = untag_ptr(this_ptr);
51212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51214         this_ptr_conv.is_owned = false;
51215         LDKPublicKey val_ref;
51216         CHECK(val->arr_len == 33);
51217         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51218         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
51219 }
51220
51221 uint64_t  __attribute__((export_name("TS_OnionMessage_get_onion_routing_packet"))) TS_OnionMessage_get_onion_routing_packet(uint64_t this_ptr) {
51222         LDKOnionMessage this_ptr_conv;
51223         this_ptr_conv.inner = untag_ptr(this_ptr);
51224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51226         this_ptr_conv.is_owned = false;
51227         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
51228         uint64_t ret_ref = 0;
51229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51231         return ret_ref;
51232 }
51233
51234 void  __attribute__((export_name("TS_OnionMessage_set_onion_routing_packet"))) TS_OnionMessage_set_onion_routing_packet(uint64_t this_ptr, uint64_t val) {
51235         LDKOnionMessage this_ptr_conv;
51236         this_ptr_conv.inner = untag_ptr(this_ptr);
51237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51239         this_ptr_conv.is_owned = false;
51240         LDKPacket val_conv;
51241         val_conv.inner = untag_ptr(val);
51242         val_conv.is_owned = ptr_is_owned(val);
51243         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51244         val_conv = Packet_clone(&val_conv);
51245         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
51246 }
51247
51248 uint64_t  __attribute__((export_name("TS_OnionMessage_new"))) TS_OnionMessage_new(int8_tArray blinding_point_arg, uint64_t onion_routing_packet_arg) {
51249         LDKPublicKey blinding_point_arg_ref;
51250         CHECK(blinding_point_arg->arr_len == 33);
51251         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
51252         LDKPacket onion_routing_packet_arg_conv;
51253         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51254         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51255         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51256         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
51257         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
51258         uint64_t ret_ref = 0;
51259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51261         return ret_ref;
51262 }
51263
51264 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
51265         LDKOnionMessage ret_var = OnionMessage_clone(arg);
51266         uint64_t ret_ref = 0;
51267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51269         return ret_ref;
51270 }
51271 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
51272         LDKOnionMessage arg_conv;
51273         arg_conv.inner = untag_ptr(arg);
51274         arg_conv.is_owned = ptr_is_owned(arg);
51275         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51276         arg_conv.is_owned = false;
51277         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
51278         return ret_conv;
51279 }
51280
51281 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
51282         LDKOnionMessage orig_conv;
51283         orig_conv.inner = untag_ptr(orig);
51284         orig_conv.is_owned = ptr_is_owned(orig);
51285         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51286         orig_conv.is_owned = false;
51287         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
51288         uint64_t ret_ref = 0;
51289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51291         return ret_ref;
51292 }
51293
51294 int64_t  __attribute__((export_name("TS_OnionMessage_hash"))) TS_OnionMessage_hash(uint64_t o) {
51295         LDKOnionMessage o_conv;
51296         o_conv.inner = untag_ptr(o);
51297         o_conv.is_owned = ptr_is_owned(o);
51298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51299         o_conv.is_owned = false;
51300         int64_t ret_conv = OnionMessage_hash(&o_conv);
51301         return ret_conv;
51302 }
51303
51304 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
51305         LDKOnionMessage a_conv;
51306         a_conv.inner = untag_ptr(a);
51307         a_conv.is_owned = ptr_is_owned(a);
51308         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51309         a_conv.is_owned = false;
51310         LDKOnionMessage b_conv;
51311         b_conv.inner = untag_ptr(b);
51312         b_conv.is_owned = ptr_is_owned(b);
51313         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51314         b_conv.is_owned = false;
51315         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
51316         return ret_conv;
51317 }
51318
51319 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
51320         LDKUpdateFulfillHTLC this_obj_conv;
51321         this_obj_conv.inner = untag_ptr(this_obj);
51322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51324         UpdateFulfillHTLC_free(this_obj_conv);
51325 }
51326
51327 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
51328         LDKUpdateFulfillHTLC this_ptr_conv;
51329         this_ptr_conv.inner = untag_ptr(this_ptr);
51330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51332         this_ptr_conv.is_owned = false;
51333         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
51334         uint64_t ret_ref = 0;
51335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51337         return ret_ref;
51338 }
51339
51340 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
51341         LDKUpdateFulfillHTLC this_ptr_conv;
51342         this_ptr_conv.inner = untag_ptr(this_ptr);
51343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51345         this_ptr_conv.is_owned = false;
51346         LDKChannelId val_conv;
51347         val_conv.inner = untag_ptr(val);
51348         val_conv.is_owned = ptr_is_owned(val);
51349         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51350         val_conv = ChannelId_clone(&val_conv);
51351         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
51352 }
51353
51354 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
51355         LDKUpdateFulfillHTLC this_ptr_conv;
51356         this_ptr_conv.inner = untag_ptr(this_ptr);
51357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51359         this_ptr_conv.is_owned = false;
51360         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
51361         return ret_conv;
51362 }
51363
51364 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
51365         LDKUpdateFulfillHTLC this_ptr_conv;
51366         this_ptr_conv.inner = untag_ptr(this_ptr);
51367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51369         this_ptr_conv.is_owned = false;
51370         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
51371 }
51372
51373 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
51374         LDKUpdateFulfillHTLC this_ptr_conv;
51375         this_ptr_conv.inner = untag_ptr(this_ptr);
51376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51378         this_ptr_conv.is_owned = false;
51379         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51380         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
51381         return ret_arr;
51382 }
51383
51384 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
51385         LDKUpdateFulfillHTLC this_ptr_conv;
51386         this_ptr_conv.inner = untag_ptr(this_ptr);
51387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51389         this_ptr_conv.is_owned = false;
51390         LDKThirtyTwoBytes val_ref;
51391         CHECK(val->arr_len == 32);
51392         memcpy(val_ref.data, val->elems, 32); FREE(val);
51393         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
51394 }
51395
51396 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_new"))) TS_UpdateFulfillHTLC_new(uint64_t channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
51397         LDKChannelId channel_id_arg_conv;
51398         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51399         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51400         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51401         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51402         LDKThirtyTwoBytes payment_preimage_arg_ref;
51403         CHECK(payment_preimage_arg->arr_len == 32);
51404         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
51405         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
51406         uint64_t ret_ref = 0;
51407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51409         return ret_ref;
51410 }
51411
51412 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
51413         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
51414         uint64_t ret_ref = 0;
51415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51417         return ret_ref;
51418 }
51419 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
51420         LDKUpdateFulfillHTLC arg_conv;
51421         arg_conv.inner = untag_ptr(arg);
51422         arg_conv.is_owned = ptr_is_owned(arg);
51423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51424         arg_conv.is_owned = false;
51425         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
51426         return ret_conv;
51427 }
51428
51429 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
51430         LDKUpdateFulfillHTLC orig_conv;
51431         orig_conv.inner = untag_ptr(orig);
51432         orig_conv.is_owned = ptr_is_owned(orig);
51433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51434         orig_conv.is_owned = false;
51435         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
51436         uint64_t ret_ref = 0;
51437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51439         return ret_ref;
51440 }
51441
51442 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_hash"))) TS_UpdateFulfillHTLC_hash(uint64_t o) {
51443         LDKUpdateFulfillHTLC o_conv;
51444         o_conv.inner = untag_ptr(o);
51445         o_conv.is_owned = ptr_is_owned(o);
51446         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51447         o_conv.is_owned = false;
51448         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
51449         return ret_conv;
51450 }
51451
51452 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
51453         LDKUpdateFulfillHTLC a_conv;
51454         a_conv.inner = untag_ptr(a);
51455         a_conv.is_owned = ptr_is_owned(a);
51456         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51457         a_conv.is_owned = false;
51458         LDKUpdateFulfillHTLC b_conv;
51459         b_conv.inner = untag_ptr(b);
51460         b_conv.is_owned = ptr_is_owned(b);
51461         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51462         b_conv.is_owned = false;
51463         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
51464         return ret_conv;
51465 }
51466
51467 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
51468         LDKUpdateFailHTLC this_obj_conv;
51469         this_obj_conv.inner = untag_ptr(this_obj);
51470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51472         UpdateFailHTLC_free(this_obj_conv);
51473 }
51474
51475 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
51476         LDKUpdateFailHTLC this_ptr_conv;
51477         this_ptr_conv.inner = untag_ptr(this_ptr);
51478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51480         this_ptr_conv.is_owned = false;
51481         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
51482         uint64_t ret_ref = 0;
51483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51485         return ret_ref;
51486 }
51487
51488 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
51489         LDKUpdateFailHTLC this_ptr_conv;
51490         this_ptr_conv.inner = untag_ptr(this_ptr);
51491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51493         this_ptr_conv.is_owned = false;
51494         LDKChannelId val_conv;
51495         val_conv.inner = untag_ptr(val);
51496         val_conv.is_owned = ptr_is_owned(val);
51497         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51498         val_conv = ChannelId_clone(&val_conv);
51499         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
51500 }
51501
51502 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
51503         LDKUpdateFailHTLC this_ptr_conv;
51504         this_ptr_conv.inner = untag_ptr(this_ptr);
51505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51507         this_ptr_conv.is_owned = false;
51508         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
51509         return ret_conv;
51510 }
51511
51512 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
51513         LDKUpdateFailHTLC this_ptr_conv;
51514         this_ptr_conv.inner = untag_ptr(this_ptr);
51515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51517         this_ptr_conv.is_owned = false;
51518         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
51519 }
51520
51521 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
51522         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
51523         uint64_t ret_ref = 0;
51524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51526         return ret_ref;
51527 }
51528 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
51529         LDKUpdateFailHTLC arg_conv;
51530         arg_conv.inner = untag_ptr(arg);
51531         arg_conv.is_owned = ptr_is_owned(arg);
51532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51533         arg_conv.is_owned = false;
51534         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
51535         return ret_conv;
51536 }
51537
51538 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
51539         LDKUpdateFailHTLC orig_conv;
51540         orig_conv.inner = untag_ptr(orig);
51541         orig_conv.is_owned = ptr_is_owned(orig);
51542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51543         orig_conv.is_owned = false;
51544         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
51545         uint64_t ret_ref = 0;
51546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51548         return ret_ref;
51549 }
51550
51551 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_hash"))) TS_UpdateFailHTLC_hash(uint64_t o) {
51552         LDKUpdateFailHTLC o_conv;
51553         o_conv.inner = untag_ptr(o);
51554         o_conv.is_owned = ptr_is_owned(o);
51555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51556         o_conv.is_owned = false;
51557         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
51558         return ret_conv;
51559 }
51560
51561 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
51562         LDKUpdateFailHTLC a_conv;
51563         a_conv.inner = untag_ptr(a);
51564         a_conv.is_owned = ptr_is_owned(a);
51565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51566         a_conv.is_owned = false;
51567         LDKUpdateFailHTLC b_conv;
51568         b_conv.inner = untag_ptr(b);
51569         b_conv.is_owned = ptr_is_owned(b);
51570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51571         b_conv.is_owned = false;
51572         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
51573         return ret_conv;
51574 }
51575
51576 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
51577         LDKUpdateFailMalformedHTLC this_obj_conv;
51578         this_obj_conv.inner = untag_ptr(this_obj);
51579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51581         UpdateFailMalformedHTLC_free(this_obj_conv);
51582 }
51583
51584 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
51585         LDKUpdateFailMalformedHTLC this_ptr_conv;
51586         this_ptr_conv.inner = untag_ptr(this_ptr);
51587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51589         this_ptr_conv.is_owned = false;
51590         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
51591         uint64_t ret_ref = 0;
51592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51594         return ret_ref;
51595 }
51596
51597 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
51598         LDKUpdateFailMalformedHTLC this_ptr_conv;
51599         this_ptr_conv.inner = untag_ptr(this_ptr);
51600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51602         this_ptr_conv.is_owned = false;
51603         LDKChannelId val_conv;
51604         val_conv.inner = untag_ptr(val);
51605         val_conv.is_owned = ptr_is_owned(val);
51606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51607         val_conv = ChannelId_clone(&val_conv);
51608         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
51609 }
51610
51611 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
51612         LDKUpdateFailMalformedHTLC this_ptr_conv;
51613         this_ptr_conv.inner = untag_ptr(this_ptr);
51614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51616         this_ptr_conv.is_owned = false;
51617         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
51618         return ret_conv;
51619 }
51620
51621 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
51622         LDKUpdateFailMalformedHTLC this_ptr_conv;
51623         this_ptr_conv.inner = untag_ptr(this_ptr);
51624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51626         this_ptr_conv.is_owned = false;
51627         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
51628 }
51629
51630 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
51631         LDKUpdateFailMalformedHTLC this_ptr_conv;
51632         this_ptr_conv.inner = untag_ptr(this_ptr);
51633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51635         this_ptr_conv.is_owned = false;
51636         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
51637         return ret_conv;
51638 }
51639
51640 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
51641         LDKUpdateFailMalformedHTLC this_ptr_conv;
51642         this_ptr_conv.inner = untag_ptr(this_ptr);
51643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51645         this_ptr_conv.is_owned = false;
51646         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
51647 }
51648
51649 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
51650         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
51651         uint64_t ret_ref = 0;
51652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51654         return ret_ref;
51655 }
51656 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
51657         LDKUpdateFailMalformedHTLC arg_conv;
51658         arg_conv.inner = untag_ptr(arg);
51659         arg_conv.is_owned = ptr_is_owned(arg);
51660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51661         arg_conv.is_owned = false;
51662         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
51663         return ret_conv;
51664 }
51665
51666 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
51667         LDKUpdateFailMalformedHTLC orig_conv;
51668         orig_conv.inner = untag_ptr(orig);
51669         orig_conv.is_owned = ptr_is_owned(orig);
51670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51671         orig_conv.is_owned = false;
51672         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
51673         uint64_t ret_ref = 0;
51674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51676         return ret_ref;
51677 }
51678
51679 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_hash"))) TS_UpdateFailMalformedHTLC_hash(uint64_t o) {
51680         LDKUpdateFailMalformedHTLC o_conv;
51681         o_conv.inner = untag_ptr(o);
51682         o_conv.is_owned = ptr_is_owned(o);
51683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51684         o_conv.is_owned = false;
51685         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
51686         return ret_conv;
51687 }
51688
51689 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
51690         LDKUpdateFailMalformedHTLC a_conv;
51691         a_conv.inner = untag_ptr(a);
51692         a_conv.is_owned = ptr_is_owned(a);
51693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51694         a_conv.is_owned = false;
51695         LDKUpdateFailMalformedHTLC b_conv;
51696         b_conv.inner = untag_ptr(b);
51697         b_conv.is_owned = ptr_is_owned(b);
51698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51699         b_conv.is_owned = false;
51700         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
51701         return ret_conv;
51702 }
51703
51704 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
51705         LDKCommitmentSigned this_obj_conv;
51706         this_obj_conv.inner = untag_ptr(this_obj);
51707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51709         CommitmentSigned_free(this_obj_conv);
51710 }
51711
51712 uint64_t  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
51713         LDKCommitmentSigned this_ptr_conv;
51714         this_ptr_conv.inner = untag_ptr(this_ptr);
51715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51717         this_ptr_conv.is_owned = false;
51718         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
51719         uint64_t ret_ref = 0;
51720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51722         return ret_ref;
51723 }
51724
51725 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, uint64_t val) {
51726         LDKCommitmentSigned this_ptr_conv;
51727         this_ptr_conv.inner = untag_ptr(this_ptr);
51728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51730         this_ptr_conv.is_owned = false;
51731         LDKChannelId val_conv;
51732         val_conv.inner = untag_ptr(val);
51733         val_conv.is_owned = ptr_is_owned(val);
51734         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51735         val_conv = ChannelId_clone(&val_conv);
51736         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
51737 }
51738
51739 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
51740         LDKCommitmentSigned this_ptr_conv;
51741         this_ptr_conv.inner = untag_ptr(this_ptr);
51742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51744         this_ptr_conv.is_owned = false;
51745         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51746         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
51747         return ret_arr;
51748 }
51749
51750 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
51751         LDKCommitmentSigned this_ptr_conv;
51752         this_ptr_conv.inner = untag_ptr(this_ptr);
51753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51755         this_ptr_conv.is_owned = false;
51756         LDKECDSASignature val_ref;
51757         CHECK(val->arr_len == 64);
51758         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51759         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
51760 }
51761
51762 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
51763         LDKCommitmentSigned this_ptr_conv;
51764         this_ptr_conv.inner = untag_ptr(this_ptr);
51765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51767         this_ptr_conv.is_owned = false;
51768         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
51769         ptrArray ret_arr = NULL;
51770         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
51771         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
51772         for (size_t m = 0; m < ret_var.datalen; m++) {
51773                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
51774                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
51775                 ret_arr_ptr[m] = ret_conv_12_arr;
51776         }
51777         
51778         FREE(ret_var.data);
51779         return ret_arr;
51780 }
51781
51782 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
51783         LDKCommitmentSigned this_ptr_conv;
51784         this_ptr_conv.inner = untag_ptr(this_ptr);
51785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51787         this_ptr_conv.is_owned = false;
51788         LDKCVec_ECDSASignatureZ val_constr;
51789         val_constr.datalen = val->arr_len;
51790         if (val_constr.datalen > 0)
51791                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
51792         else
51793                 val_constr.data = NULL;
51794         int8_tArray* val_vals = (void*) val->elems;
51795         for (size_t m = 0; m < val_constr.datalen; m++) {
51796                 int8_tArray val_conv_12 = val_vals[m];
51797                 LDKECDSASignature val_conv_12_ref;
51798                 CHECK(val_conv_12->arr_len == 64);
51799                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
51800                 val_constr.data[m] = val_conv_12_ref;
51801         }
51802         FREE(val);
51803         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
51804 }
51805
51806 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(uint64_t channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
51807         LDKChannelId channel_id_arg_conv;
51808         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51809         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51810         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51811         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51812         LDKECDSASignature signature_arg_ref;
51813         CHECK(signature_arg->arr_len == 64);
51814         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
51815         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
51816         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
51817         if (htlc_signatures_arg_constr.datalen > 0)
51818                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
51819         else
51820                 htlc_signatures_arg_constr.data = NULL;
51821         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
51822         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
51823                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
51824                 LDKECDSASignature htlc_signatures_arg_conv_12_ref;
51825                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
51826                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
51827                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
51828         }
51829         FREE(htlc_signatures_arg);
51830         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
51831         uint64_t ret_ref = 0;
51832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51834         return ret_ref;
51835 }
51836
51837 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
51838         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
51839         uint64_t ret_ref = 0;
51840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51842         return ret_ref;
51843 }
51844 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
51845         LDKCommitmentSigned arg_conv;
51846         arg_conv.inner = untag_ptr(arg);
51847         arg_conv.is_owned = ptr_is_owned(arg);
51848         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51849         arg_conv.is_owned = false;
51850         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
51851         return ret_conv;
51852 }
51853
51854 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
51855         LDKCommitmentSigned orig_conv;
51856         orig_conv.inner = untag_ptr(orig);
51857         orig_conv.is_owned = ptr_is_owned(orig);
51858         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51859         orig_conv.is_owned = false;
51860         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
51861         uint64_t ret_ref = 0;
51862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51864         return ret_ref;
51865 }
51866
51867 int64_t  __attribute__((export_name("TS_CommitmentSigned_hash"))) TS_CommitmentSigned_hash(uint64_t o) {
51868         LDKCommitmentSigned o_conv;
51869         o_conv.inner = untag_ptr(o);
51870         o_conv.is_owned = ptr_is_owned(o);
51871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51872         o_conv.is_owned = false;
51873         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
51874         return ret_conv;
51875 }
51876
51877 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
51878         LDKCommitmentSigned a_conv;
51879         a_conv.inner = untag_ptr(a);
51880         a_conv.is_owned = ptr_is_owned(a);
51881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51882         a_conv.is_owned = false;
51883         LDKCommitmentSigned b_conv;
51884         b_conv.inner = untag_ptr(b);
51885         b_conv.is_owned = ptr_is_owned(b);
51886         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51887         b_conv.is_owned = false;
51888         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
51889         return ret_conv;
51890 }
51891
51892 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
51893         LDKRevokeAndACK this_obj_conv;
51894         this_obj_conv.inner = untag_ptr(this_obj);
51895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51897         RevokeAndACK_free(this_obj_conv);
51898 }
51899
51900 uint64_t  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
51901         LDKRevokeAndACK this_ptr_conv;
51902         this_ptr_conv.inner = untag_ptr(this_ptr);
51903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51905         this_ptr_conv.is_owned = false;
51906         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
51907         uint64_t ret_ref = 0;
51908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51910         return ret_ref;
51911 }
51912
51913 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, uint64_t val) {
51914         LDKRevokeAndACK this_ptr_conv;
51915         this_ptr_conv.inner = untag_ptr(this_ptr);
51916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51918         this_ptr_conv.is_owned = false;
51919         LDKChannelId val_conv;
51920         val_conv.inner = untag_ptr(val);
51921         val_conv.is_owned = ptr_is_owned(val);
51922         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51923         val_conv = ChannelId_clone(&val_conv);
51924         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
51925 }
51926
51927 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
51928         LDKRevokeAndACK this_ptr_conv;
51929         this_ptr_conv.inner = untag_ptr(this_ptr);
51930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51932         this_ptr_conv.is_owned = false;
51933         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51934         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
51935         return ret_arr;
51936 }
51937
51938 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
51939         LDKRevokeAndACK this_ptr_conv;
51940         this_ptr_conv.inner = untag_ptr(this_ptr);
51941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51943         this_ptr_conv.is_owned = false;
51944         LDKThirtyTwoBytes val_ref;
51945         CHECK(val->arr_len == 32);
51946         memcpy(val_ref.data, val->elems, 32); FREE(val);
51947         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
51948 }
51949
51950 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
51951         LDKRevokeAndACK this_ptr_conv;
51952         this_ptr_conv.inner = untag_ptr(this_ptr);
51953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51955         this_ptr_conv.is_owned = false;
51956         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51957         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
51958         return ret_arr;
51959 }
51960
51961 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) {
51962         LDKRevokeAndACK this_ptr_conv;
51963         this_ptr_conv.inner = untag_ptr(this_ptr);
51964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51966         this_ptr_conv.is_owned = false;
51967         LDKPublicKey val_ref;
51968         CHECK(val->arr_len == 33);
51969         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51970         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
51971 }
51972
51973 uint64_t  __attribute__((export_name("TS_RevokeAndACK_new"))) TS_RevokeAndACK_new(uint64_t channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
51974         LDKChannelId channel_id_arg_conv;
51975         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51976         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51978         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51979         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
51980         CHECK(per_commitment_secret_arg->arr_len == 32);
51981         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
51982         LDKPublicKey next_per_commitment_point_arg_ref;
51983         CHECK(next_per_commitment_point_arg->arr_len == 33);
51984         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
51985         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
51986         uint64_t ret_ref = 0;
51987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51989         return ret_ref;
51990 }
51991
51992 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
51993         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
51994         uint64_t ret_ref = 0;
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51997         return ret_ref;
51998 }
51999 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
52000         LDKRevokeAndACK arg_conv;
52001         arg_conv.inner = untag_ptr(arg);
52002         arg_conv.is_owned = ptr_is_owned(arg);
52003         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52004         arg_conv.is_owned = false;
52005         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
52006         return ret_conv;
52007 }
52008
52009 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
52010         LDKRevokeAndACK orig_conv;
52011         orig_conv.inner = untag_ptr(orig);
52012         orig_conv.is_owned = ptr_is_owned(orig);
52013         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52014         orig_conv.is_owned = false;
52015         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
52016         uint64_t ret_ref = 0;
52017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52019         return ret_ref;
52020 }
52021
52022 int64_t  __attribute__((export_name("TS_RevokeAndACK_hash"))) TS_RevokeAndACK_hash(uint64_t o) {
52023         LDKRevokeAndACK o_conv;
52024         o_conv.inner = untag_ptr(o);
52025         o_conv.is_owned = ptr_is_owned(o);
52026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52027         o_conv.is_owned = false;
52028         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
52029         return ret_conv;
52030 }
52031
52032 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
52033         LDKRevokeAndACK a_conv;
52034         a_conv.inner = untag_ptr(a);
52035         a_conv.is_owned = ptr_is_owned(a);
52036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52037         a_conv.is_owned = false;
52038         LDKRevokeAndACK b_conv;
52039         b_conv.inner = untag_ptr(b);
52040         b_conv.is_owned = ptr_is_owned(b);
52041         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52042         b_conv.is_owned = false;
52043         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
52044         return ret_conv;
52045 }
52046
52047 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
52048         LDKUpdateFee this_obj_conv;
52049         this_obj_conv.inner = untag_ptr(this_obj);
52050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52052         UpdateFee_free(this_obj_conv);
52053 }
52054
52055 uint64_t  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
52056         LDKUpdateFee this_ptr_conv;
52057         this_ptr_conv.inner = untag_ptr(this_ptr);
52058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52060         this_ptr_conv.is_owned = false;
52061         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
52062         uint64_t ret_ref = 0;
52063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52065         return ret_ref;
52066 }
52067
52068 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, uint64_t val) {
52069         LDKUpdateFee this_ptr_conv;
52070         this_ptr_conv.inner = untag_ptr(this_ptr);
52071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52073         this_ptr_conv.is_owned = false;
52074         LDKChannelId val_conv;
52075         val_conv.inner = untag_ptr(val);
52076         val_conv.is_owned = ptr_is_owned(val);
52077         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52078         val_conv = ChannelId_clone(&val_conv);
52079         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
52080 }
52081
52082 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
52083         LDKUpdateFee this_ptr_conv;
52084         this_ptr_conv.inner = untag_ptr(this_ptr);
52085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52087         this_ptr_conv.is_owned = false;
52088         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
52089         return ret_conv;
52090 }
52091
52092 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
52093         LDKUpdateFee this_ptr_conv;
52094         this_ptr_conv.inner = untag_ptr(this_ptr);
52095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52097         this_ptr_conv.is_owned = false;
52098         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
52099 }
52100
52101 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(uint64_t channel_id_arg, int32_t feerate_per_kw_arg) {
52102         LDKChannelId channel_id_arg_conv;
52103         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52104         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52105         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52106         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52107         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
52108         uint64_t ret_ref = 0;
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52111         return ret_ref;
52112 }
52113
52114 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
52115         LDKUpdateFee ret_var = UpdateFee_clone(arg);
52116         uint64_t ret_ref = 0;
52117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52119         return ret_ref;
52120 }
52121 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
52122         LDKUpdateFee arg_conv;
52123         arg_conv.inner = untag_ptr(arg);
52124         arg_conv.is_owned = ptr_is_owned(arg);
52125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52126         arg_conv.is_owned = false;
52127         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
52128         return ret_conv;
52129 }
52130
52131 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
52132         LDKUpdateFee orig_conv;
52133         orig_conv.inner = untag_ptr(orig);
52134         orig_conv.is_owned = ptr_is_owned(orig);
52135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52136         orig_conv.is_owned = false;
52137         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
52138         uint64_t ret_ref = 0;
52139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52141         return ret_ref;
52142 }
52143
52144 int64_t  __attribute__((export_name("TS_UpdateFee_hash"))) TS_UpdateFee_hash(uint64_t o) {
52145         LDKUpdateFee o_conv;
52146         o_conv.inner = untag_ptr(o);
52147         o_conv.is_owned = ptr_is_owned(o);
52148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52149         o_conv.is_owned = false;
52150         int64_t ret_conv = UpdateFee_hash(&o_conv);
52151         return ret_conv;
52152 }
52153
52154 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
52155         LDKUpdateFee a_conv;
52156         a_conv.inner = untag_ptr(a);
52157         a_conv.is_owned = ptr_is_owned(a);
52158         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52159         a_conv.is_owned = false;
52160         LDKUpdateFee b_conv;
52161         b_conv.inner = untag_ptr(b);
52162         b_conv.is_owned = ptr_is_owned(b);
52163         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52164         b_conv.is_owned = false;
52165         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
52166         return ret_conv;
52167 }
52168
52169 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
52170         LDKChannelReestablish this_obj_conv;
52171         this_obj_conv.inner = untag_ptr(this_obj);
52172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52174         ChannelReestablish_free(this_obj_conv);
52175 }
52176
52177 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
52178         LDKChannelReestablish this_ptr_conv;
52179         this_ptr_conv.inner = untag_ptr(this_ptr);
52180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52182         this_ptr_conv.is_owned = false;
52183         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
52184         uint64_t ret_ref = 0;
52185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52187         return ret_ref;
52188 }
52189
52190 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, uint64_t val) {
52191         LDKChannelReestablish this_ptr_conv;
52192         this_ptr_conv.inner = untag_ptr(this_ptr);
52193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52195         this_ptr_conv.is_owned = false;
52196         LDKChannelId val_conv;
52197         val_conv.inner = untag_ptr(val);
52198         val_conv.is_owned = ptr_is_owned(val);
52199         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52200         val_conv = ChannelId_clone(&val_conv);
52201         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
52202 }
52203
52204 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
52205         LDKChannelReestablish this_ptr_conv;
52206         this_ptr_conv.inner = untag_ptr(this_ptr);
52207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52209         this_ptr_conv.is_owned = false;
52210         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
52211         return ret_conv;
52212 }
52213
52214 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) {
52215         LDKChannelReestablish this_ptr_conv;
52216         this_ptr_conv.inner = untag_ptr(this_ptr);
52217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52219         this_ptr_conv.is_owned = false;
52220         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
52221 }
52222
52223 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
52224         LDKChannelReestablish this_ptr_conv;
52225         this_ptr_conv.inner = untag_ptr(this_ptr);
52226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52228         this_ptr_conv.is_owned = false;
52229         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
52230         return ret_conv;
52231 }
52232
52233 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) {
52234         LDKChannelReestablish this_ptr_conv;
52235         this_ptr_conv.inner = untag_ptr(this_ptr);
52236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52238         this_ptr_conv.is_owned = false;
52239         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
52240 }
52241
52242 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) {
52243         LDKChannelReestablish this_ptr_conv;
52244         this_ptr_conv.inner = untag_ptr(this_ptr);
52245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52247         this_ptr_conv.is_owned = false;
52248         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52249         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
52250         return ret_arr;
52251 }
52252
52253 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) {
52254         LDKChannelReestablish this_ptr_conv;
52255         this_ptr_conv.inner = untag_ptr(this_ptr);
52256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52258         this_ptr_conv.is_owned = false;
52259         LDKThirtyTwoBytes val_ref;
52260         CHECK(val->arr_len == 32);
52261         memcpy(val_ref.data, val->elems, 32); FREE(val);
52262         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
52263 }
52264
52265 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) {
52266         LDKChannelReestablish this_ptr_conv;
52267         this_ptr_conv.inner = untag_ptr(this_ptr);
52268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52270         this_ptr_conv.is_owned = false;
52271         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52272         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
52273         return ret_arr;
52274 }
52275
52276 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) {
52277         LDKChannelReestablish this_ptr_conv;
52278         this_ptr_conv.inner = untag_ptr(this_ptr);
52279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52281         this_ptr_conv.is_owned = false;
52282         LDKPublicKey val_ref;
52283         CHECK(val->arr_len == 33);
52284         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52285         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
52286 }
52287
52288 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
52289         LDKChannelReestablish this_ptr_conv;
52290         this_ptr_conv.inner = untag_ptr(this_ptr);
52291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52293         this_ptr_conv.is_owned = false;
52294         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
52295         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
52296         uint64_t ret_ref = tag_ptr(ret_copy, true);
52297         return ret_ref;
52298 }
52299
52300 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
52301         LDKChannelReestablish this_ptr_conv;
52302         this_ptr_conv.inner = untag_ptr(this_ptr);
52303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52305         this_ptr_conv.is_owned = false;
52306         void* val_ptr = untag_ptr(val);
52307         CHECK_ACCESS(val_ptr);
52308         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
52309         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
52310         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
52311 }
52312
52313 uint64_t  __attribute__((export_name("TS_ChannelReestablish_new"))) TS_ChannelReestablish_new(uint64_t 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) {
52314         LDKChannelId channel_id_arg_conv;
52315         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52316         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52317         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52318         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52319         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
52320         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
52321         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
52322         LDKPublicKey my_current_per_commitment_point_arg_ref;
52323         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
52324         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);
52325         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
52326         CHECK_ACCESS(next_funding_txid_arg_ptr);
52327         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
52328         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
52329         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_conv, 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);
52330         uint64_t ret_ref = 0;
52331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52333         return ret_ref;
52334 }
52335
52336 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
52337         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
52338         uint64_t ret_ref = 0;
52339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52341         return ret_ref;
52342 }
52343 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
52344         LDKChannelReestablish arg_conv;
52345         arg_conv.inner = untag_ptr(arg);
52346         arg_conv.is_owned = ptr_is_owned(arg);
52347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52348         arg_conv.is_owned = false;
52349         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
52350         return ret_conv;
52351 }
52352
52353 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
52354         LDKChannelReestablish orig_conv;
52355         orig_conv.inner = untag_ptr(orig);
52356         orig_conv.is_owned = ptr_is_owned(orig);
52357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52358         orig_conv.is_owned = false;
52359         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
52360         uint64_t ret_ref = 0;
52361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52363         return ret_ref;
52364 }
52365
52366 int64_t  __attribute__((export_name("TS_ChannelReestablish_hash"))) TS_ChannelReestablish_hash(uint64_t o) {
52367         LDKChannelReestablish o_conv;
52368         o_conv.inner = untag_ptr(o);
52369         o_conv.is_owned = ptr_is_owned(o);
52370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52371         o_conv.is_owned = false;
52372         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
52373         return ret_conv;
52374 }
52375
52376 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
52377         LDKChannelReestablish a_conv;
52378         a_conv.inner = untag_ptr(a);
52379         a_conv.is_owned = ptr_is_owned(a);
52380         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52381         a_conv.is_owned = false;
52382         LDKChannelReestablish b_conv;
52383         b_conv.inner = untag_ptr(b);
52384         b_conv.is_owned = ptr_is_owned(b);
52385         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52386         b_conv.is_owned = false;
52387         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
52388         return ret_conv;
52389 }
52390
52391 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
52392         LDKAnnouncementSignatures this_obj_conv;
52393         this_obj_conv.inner = untag_ptr(this_obj);
52394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52396         AnnouncementSignatures_free(this_obj_conv);
52397 }
52398
52399 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
52400         LDKAnnouncementSignatures this_ptr_conv;
52401         this_ptr_conv.inner = untag_ptr(this_ptr);
52402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52404         this_ptr_conv.is_owned = false;
52405         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
52406         uint64_t ret_ref = 0;
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52409         return ret_ref;
52410 }
52411
52412 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, uint64_t val) {
52413         LDKAnnouncementSignatures this_ptr_conv;
52414         this_ptr_conv.inner = untag_ptr(this_ptr);
52415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52417         this_ptr_conv.is_owned = false;
52418         LDKChannelId val_conv;
52419         val_conv.inner = untag_ptr(val);
52420         val_conv.is_owned = ptr_is_owned(val);
52421         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52422         val_conv = ChannelId_clone(&val_conv);
52423         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
52424 }
52425
52426 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
52427         LDKAnnouncementSignatures this_ptr_conv;
52428         this_ptr_conv.inner = untag_ptr(this_ptr);
52429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52431         this_ptr_conv.is_owned = false;
52432         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
52433         return ret_conv;
52434 }
52435
52436 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
52437         LDKAnnouncementSignatures this_ptr_conv;
52438         this_ptr_conv.inner = untag_ptr(this_ptr);
52439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52441         this_ptr_conv.is_owned = false;
52442         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
52443 }
52444
52445 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
52446         LDKAnnouncementSignatures this_ptr_conv;
52447         this_ptr_conv.inner = untag_ptr(this_ptr);
52448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52450         this_ptr_conv.is_owned = false;
52451         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52452         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
52453         return ret_arr;
52454 }
52455
52456 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
52457         LDKAnnouncementSignatures this_ptr_conv;
52458         this_ptr_conv.inner = untag_ptr(this_ptr);
52459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52461         this_ptr_conv.is_owned = false;
52462         LDKECDSASignature val_ref;
52463         CHECK(val->arr_len == 64);
52464         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52465         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
52466 }
52467
52468 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
52469         LDKAnnouncementSignatures this_ptr_conv;
52470         this_ptr_conv.inner = untag_ptr(this_ptr);
52471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52473         this_ptr_conv.is_owned = false;
52474         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52475         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
52476         return ret_arr;
52477 }
52478
52479 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
52480         LDKAnnouncementSignatures this_ptr_conv;
52481         this_ptr_conv.inner = untag_ptr(this_ptr);
52482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52484         this_ptr_conv.is_owned = false;
52485         LDKECDSASignature val_ref;
52486         CHECK(val->arr_len == 64);
52487         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52488         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
52489 }
52490
52491 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_new"))) TS_AnnouncementSignatures_new(uint64_t channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
52492         LDKChannelId channel_id_arg_conv;
52493         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52494         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52495         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52496         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52497         LDKECDSASignature node_signature_arg_ref;
52498         CHECK(node_signature_arg->arr_len == 64);
52499         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
52500         LDKECDSASignature bitcoin_signature_arg_ref;
52501         CHECK(bitcoin_signature_arg->arr_len == 64);
52502         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
52503         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
52504         uint64_t ret_ref = 0;
52505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52507         return ret_ref;
52508 }
52509
52510 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
52511         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
52512         uint64_t ret_ref = 0;
52513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52515         return ret_ref;
52516 }
52517 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
52518         LDKAnnouncementSignatures arg_conv;
52519         arg_conv.inner = untag_ptr(arg);
52520         arg_conv.is_owned = ptr_is_owned(arg);
52521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52522         arg_conv.is_owned = false;
52523         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
52524         return ret_conv;
52525 }
52526
52527 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
52528         LDKAnnouncementSignatures orig_conv;
52529         orig_conv.inner = untag_ptr(orig);
52530         orig_conv.is_owned = ptr_is_owned(orig);
52531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52532         orig_conv.is_owned = false;
52533         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
52534         uint64_t ret_ref = 0;
52535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52537         return ret_ref;
52538 }
52539
52540 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_hash"))) TS_AnnouncementSignatures_hash(uint64_t o) {
52541         LDKAnnouncementSignatures o_conv;
52542         o_conv.inner = untag_ptr(o);
52543         o_conv.is_owned = ptr_is_owned(o);
52544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52545         o_conv.is_owned = false;
52546         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
52547         return ret_conv;
52548 }
52549
52550 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
52551         LDKAnnouncementSignatures a_conv;
52552         a_conv.inner = untag_ptr(a);
52553         a_conv.is_owned = ptr_is_owned(a);
52554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52555         a_conv.is_owned = false;
52556         LDKAnnouncementSignatures b_conv;
52557         b_conv.inner = untag_ptr(b);
52558         b_conv.is_owned = ptr_is_owned(b);
52559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52560         b_conv.is_owned = false;
52561         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
52562         return ret_conv;
52563 }
52564
52565 void  __attribute__((export_name("TS_SocketAddress_free"))) TS_SocketAddress_free(uint64_t this_ptr) {
52566         if (!ptr_is_owned(this_ptr)) return;
52567         void* this_ptr_ptr = untag_ptr(this_ptr);
52568         CHECK_ACCESS(this_ptr_ptr);
52569         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
52570         FREE(untag_ptr(this_ptr));
52571         SocketAddress_free(this_ptr_conv);
52572 }
52573
52574 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
52575         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52576         *ret_copy = SocketAddress_clone(arg);
52577         uint64_t ret_ref = tag_ptr(ret_copy, true);
52578         return ret_ref;
52579 }
52580 int64_t  __attribute__((export_name("TS_SocketAddress_clone_ptr"))) TS_SocketAddress_clone_ptr(uint64_t arg) {
52581         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
52582         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
52583         return ret_conv;
52584 }
52585
52586 uint64_t  __attribute__((export_name("TS_SocketAddress_clone"))) TS_SocketAddress_clone(uint64_t orig) {
52587         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
52588         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52589         *ret_copy = SocketAddress_clone(orig_conv);
52590         uint64_t ret_ref = tag_ptr(ret_copy, true);
52591         return ret_ref;
52592 }
52593
52594 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v4"))) TS_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
52595         LDKFourBytes addr_ref;
52596         CHECK(addr->arr_len == 4);
52597         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
52598         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52599         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
52600         uint64_t ret_ref = tag_ptr(ret_copy, true);
52601         return ret_ref;
52602 }
52603
52604 uint64_t  __attribute__((export_name("TS_SocketAddress_tcp_ip_v6"))) TS_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
52605         LDKSixteenBytes addr_ref;
52606         CHECK(addr->arr_len == 16);
52607         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
52608         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52609         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
52610         uint64_t ret_ref = tag_ptr(ret_copy, true);
52611         return ret_ref;
52612 }
52613
52614 uint64_t  __attribute__((export_name("TS_SocketAddress_onion_v2"))) TS_SocketAddress_onion_v2(int8_tArray a) {
52615         LDKTwelveBytes a_ref;
52616         CHECK(a->arr_len == 12);
52617         memcpy(a_ref.data, a->elems, 12); FREE(a);
52618         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52619         *ret_copy = SocketAddress_onion_v2(a_ref);
52620         uint64_t ret_ref = tag_ptr(ret_copy, true);
52621         return ret_ref;
52622 }
52623
52624 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) {
52625         LDKThirtyTwoBytes ed25519_pubkey_ref;
52626         CHECK(ed25519_pubkey->arr_len == 32);
52627         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
52628         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52629         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
52630         uint64_t ret_ref = tag_ptr(ret_copy, true);
52631         return ret_ref;
52632 }
52633
52634 uint64_t  __attribute__((export_name("TS_SocketAddress_hostname"))) TS_SocketAddress_hostname(uint64_t hostname, int16_t port) {
52635         LDKHostname hostname_conv;
52636         hostname_conv.inner = untag_ptr(hostname);
52637         hostname_conv.is_owned = ptr_is_owned(hostname);
52638         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
52639         hostname_conv = Hostname_clone(&hostname_conv);
52640         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52641         *ret_copy = SocketAddress_hostname(hostname_conv, port);
52642         uint64_t ret_ref = tag_ptr(ret_copy, true);
52643         return ret_ref;
52644 }
52645
52646 int64_t  __attribute__((export_name("TS_SocketAddress_hash"))) TS_SocketAddress_hash(uint64_t o) {
52647         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
52648         int64_t ret_conv = SocketAddress_hash(o_conv);
52649         return ret_conv;
52650 }
52651
52652 jboolean  __attribute__((export_name("TS_SocketAddress_eq"))) TS_SocketAddress_eq(uint64_t a, uint64_t b) {
52653         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
52654         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
52655         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
52656         return ret_conv;
52657 }
52658
52659 int8_tArray  __attribute__((export_name("TS_SocketAddress_write"))) TS_SocketAddress_write(uint64_t obj) {
52660         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
52661         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
52662         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52663         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52664         CVec_u8Z_free(ret_var);
52665         return ret_arr;
52666 }
52667
52668 uint64_t  __attribute__((export_name("TS_SocketAddress_read"))) TS_SocketAddress_read(int8_tArray ser) {
52669         LDKu8slice ser_ref;
52670         ser_ref.datalen = ser->arr_len;
52671         ser_ref.data = ser->elems;
52672         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
52673         *ret_conv = SocketAddress_read(ser_ref);
52674         FREE(ser);
52675         return tag_ptr(ret_conv, true);
52676 }
52677
52678 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_clone"))) TS_SocketAddressParseError_clone(uint64_t orig) {
52679         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
52680         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_clone(orig_conv));
52681         return ret_conv;
52682 }
52683
52684 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_socket_addr_parse"))) TS_SocketAddressParseError_socket_addr_parse() {
52685         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_socket_addr_parse());
52686         return ret_conv;
52687 }
52688
52689 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_input"))) TS_SocketAddressParseError_invalid_input() {
52690         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_input());
52691         return ret_conv;
52692 }
52693
52694 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_port"))) TS_SocketAddressParseError_invalid_port() {
52695         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_port());
52696         return ret_conv;
52697 }
52698
52699 uint32_t  __attribute__((export_name("TS_SocketAddressParseError_invalid_onion_v3"))) TS_SocketAddressParseError_invalid_onion_v3() {
52700         uint32_t ret_conv = LDKSocketAddressParseError_to_js(SocketAddressParseError_invalid_onion_v3());
52701         return ret_conv;
52702 }
52703
52704 int64_t  __attribute__((export_name("TS_SocketAddressParseError_hash"))) TS_SocketAddressParseError_hash(uint64_t o) {
52705         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
52706         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
52707         return ret_conv;
52708 }
52709
52710 jboolean  __attribute__((export_name("TS_SocketAddressParseError_eq"))) TS_SocketAddressParseError_eq(uint64_t a, uint64_t b) {
52711         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
52712         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
52713         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
52714         return ret_conv;
52715 }
52716
52717 jstring  __attribute__((export_name("TS_SocketAddressParseError_to_str"))) TS_SocketAddressParseError_to_str(uint64_t o) {
52718         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
52719         LDKStr ret_str = SocketAddressParseError_to_str(o_conv);
52720         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52721         Str_free(ret_str);
52722         return ret_conv;
52723 }
52724
52725 uint64_t  __attribute__((export_name("TS_parse_onion_address"))) TS_parse_onion_address(jstring host, int16_t port) {
52726         LDKStr host_conv = str_ref_to_owned_c(host);
52727         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
52728         *ret_conv = parse_onion_address(host_conv, port);
52729         return tag_ptr(ret_conv, true);
52730 }
52731
52732 jstring  __attribute__((export_name("TS_SocketAddress_to_str"))) TS_SocketAddress_to_str(uint64_t o) {
52733         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
52734         LDKStr ret_str = SocketAddress_to_str(o_conv);
52735         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
52736         Str_free(ret_str);
52737         return ret_conv;
52738 }
52739
52740 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
52741         if (!ptr_is_owned(this_ptr)) return;
52742         void* this_ptr_ptr = untag_ptr(this_ptr);
52743         CHECK_ACCESS(this_ptr_ptr);
52744         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
52745         FREE(untag_ptr(this_ptr));
52746         UnsignedGossipMessage_free(this_ptr_conv);
52747 }
52748
52749 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
52750         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
52751         *ret_copy = UnsignedGossipMessage_clone(arg);
52752         uint64_t ret_ref = tag_ptr(ret_copy, true);
52753         return ret_ref;
52754 }
52755 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
52756         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
52757         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
52758         return ret_conv;
52759 }
52760
52761 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
52762         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
52763         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
52764         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
52765         uint64_t ret_ref = tag_ptr(ret_copy, true);
52766         return ret_ref;
52767 }
52768
52769 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
52770         LDKUnsignedChannelAnnouncement a_conv;
52771         a_conv.inner = untag_ptr(a);
52772         a_conv.is_owned = ptr_is_owned(a);
52773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52774         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
52775         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
52776         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
52777         uint64_t ret_ref = tag_ptr(ret_copy, true);
52778         return ret_ref;
52779 }
52780
52781 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
52782         LDKUnsignedChannelUpdate a_conv;
52783         a_conv.inner = untag_ptr(a);
52784         a_conv.is_owned = ptr_is_owned(a);
52785         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52786         a_conv = UnsignedChannelUpdate_clone(&a_conv);
52787         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
52788         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
52789         uint64_t ret_ref = tag_ptr(ret_copy, true);
52790         return ret_ref;
52791 }
52792
52793 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
52794         LDKUnsignedNodeAnnouncement a_conv;
52795         a_conv.inner = untag_ptr(a);
52796         a_conv.is_owned = ptr_is_owned(a);
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52798         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
52799         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
52800         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
52801         uint64_t ret_ref = tag_ptr(ret_copy, true);
52802         return ret_ref;
52803 }
52804
52805 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
52806         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
52807         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
52808         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52809         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52810         CVec_u8Z_free(ret_var);
52811         return ret_arr;
52812 }
52813
52814 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
52815         LDKUnsignedNodeAnnouncement this_obj_conv;
52816         this_obj_conv.inner = untag_ptr(this_obj);
52817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52819         UnsignedNodeAnnouncement_free(this_obj_conv);
52820 }
52821
52822 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
52823         LDKUnsignedNodeAnnouncement this_ptr_conv;
52824         this_ptr_conv.inner = untag_ptr(this_ptr);
52825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52827         this_ptr_conv.is_owned = false;
52828         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
52829         uint64_t ret_ref = 0;
52830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52832         return ret_ref;
52833 }
52834
52835 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
52836         LDKUnsignedNodeAnnouncement this_ptr_conv;
52837         this_ptr_conv.inner = untag_ptr(this_ptr);
52838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52840         this_ptr_conv.is_owned = false;
52841         LDKNodeFeatures val_conv;
52842         val_conv.inner = untag_ptr(val);
52843         val_conv.is_owned = ptr_is_owned(val);
52844         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52845         val_conv = NodeFeatures_clone(&val_conv);
52846         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
52847 }
52848
52849 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
52850         LDKUnsignedNodeAnnouncement this_ptr_conv;
52851         this_ptr_conv.inner = untag_ptr(this_ptr);
52852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52854         this_ptr_conv.is_owned = false;
52855         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
52856         return ret_conv;
52857 }
52858
52859 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
52860         LDKUnsignedNodeAnnouncement this_ptr_conv;
52861         this_ptr_conv.inner = untag_ptr(this_ptr);
52862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52864         this_ptr_conv.is_owned = false;
52865         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
52866 }
52867
52868 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
52869         LDKUnsignedNodeAnnouncement this_ptr_conv;
52870         this_ptr_conv.inner = untag_ptr(this_ptr);
52871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52873         this_ptr_conv.is_owned = false;
52874         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
52875         uint64_t ret_ref = 0;
52876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52878         return ret_ref;
52879 }
52880
52881 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
52882         LDKUnsignedNodeAnnouncement this_ptr_conv;
52883         this_ptr_conv.inner = untag_ptr(this_ptr);
52884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52886         this_ptr_conv.is_owned = false;
52887         LDKNodeId val_conv;
52888         val_conv.inner = untag_ptr(val);
52889         val_conv.is_owned = ptr_is_owned(val);
52890         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52891         val_conv = NodeId_clone(&val_conv);
52892         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
52893 }
52894
52895 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
52896         LDKUnsignedNodeAnnouncement this_ptr_conv;
52897         this_ptr_conv.inner = untag_ptr(this_ptr);
52898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52900         this_ptr_conv.is_owned = false;
52901         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
52902         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
52903         return ret_arr;
52904 }
52905
52906 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
52907         LDKUnsignedNodeAnnouncement this_ptr_conv;
52908         this_ptr_conv.inner = untag_ptr(this_ptr);
52909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52911         this_ptr_conv.is_owned = false;
52912         LDKThreeBytes val_ref;
52913         CHECK(val->arr_len == 3);
52914         memcpy(val_ref.data, val->elems, 3); FREE(val);
52915         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
52916 }
52917
52918 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
52919         LDKUnsignedNodeAnnouncement this_ptr_conv;
52920         this_ptr_conv.inner = untag_ptr(this_ptr);
52921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52923         this_ptr_conv.is_owned = false;
52924         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
52925         uint64_t ret_ref = 0;
52926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52928         return ret_ref;
52929 }
52930
52931 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
52932         LDKUnsignedNodeAnnouncement this_ptr_conv;
52933         this_ptr_conv.inner = untag_ptr(this_ptr);
52934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52936         this_ptr_conv.is_owned = false;
52937         LDKNodeAlias val_conv;
52938         val_conv.inner = untag_ptr(val);
52939         val_conv.is_owned = ptr_is_owned(val);
52940         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52941         val_conv = NodeAlias_clone(&val_conv);
52942         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
52943 }
52944
52945 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
52946         LDKUnsignedNodeAnnouncement this_ptr_conv;
52947         this_ptr_conv.inner = untag_ptr(this_ptr);
52948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52950         this_ptr_conv.is_owned = false;
52951         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
52952         uint64_tArray ret_arr = NULL;
52953         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
52954         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
52955         for (size_t p = 0; p < ret_var.datalen; p++) {
52956                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52957                 *ret_conv_15_copy = ret_var.data[p];
52958                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
52959                 ret_arr_ptr[p] = ret_conv_15_ref;
52960         }
52961         
52962         FREE(ret_var.data);
52963         return ret_arr;
52964 }
52965
52966 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
52967         LDKUnsignedNodeAnnouncement 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         LDKCVec_SocketAddressZ val_constr;
52973         val_constr.datalen = val->arr_len;
52974         if (val_constr.datalen > 0)
52975                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52976         else
52977                 val_constr.data = NULL;
52978         uint64_t* val_vals = val->elems;
52979         for (size_t p = 0; p < val_constr.datalen; p++) {
52980                 uint64_t val_conv_15 = val_vals[p];
52981                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
52982                 CHECK_ACCESS(val_conv_15_ptr);
52983                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
52984                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
52985                 val_constr.data[p] = val_conv_15_conv;
52986         }
52987         FREE(val);
52988         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
52989 }
52990
52991 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_excess_address_data"))) TS_UnsignedNodeAnnouncement_get_excess_address_data(uint64_t this_ptr) {
52992         LDKUnsignedNodeAnnouncement 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         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
52998         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52999         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53000         CVec_u8Z_free(ret_var);
53001         return ret_arr;
53002 }
53003
53004 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_excess_address_data"))) TS_UnsignedNodeAnnouncement_set_excess_address_data(uint64_t this_ptr, int8_tArray val) {
53005         LDKUnsignedNodeAnnouncement this_ptr_conv;
53006         this_ptr_conv.inner = untag_ptr(this_ptr);
53007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53009         this_ptr_conv.is_owned = false;
53010         LDKCVec_u8Z val_ref;
53011         val_ref.datalen = val->arr_len;
53012         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53013         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53014         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
53015 }
53016
53017 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_excess_data"))) TS_UnsignedNodeAnnouncement_get_excess_data(uint64_t this_ptr) {
53018         LDKUnsignedNodeAnnouncement this_ptr_conv;
53019         this_ptr_conv.inner = untag_ptr(this_ptr);
53020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53022         this_ptr_conv.is_owned = false;
53023         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
53024         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53025         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53026         CVec_u8Z_free(ret_var);
53027         return ret_arr;
53028 }
53029
53030 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_excess_data"))) TS_UnsignedNodeAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
53031         LDKUnsignedNodeAnnouncement 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         LDKCVec_u8Z val_ref;
53037         val_ref.datalen = val->arr_len;
53038         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53039         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53040         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
53041 }
53042
53043 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_new"))) TS_UnsignedNodeAnnouncement_new(uint64_t features_arg, int32_t timestamp_arg, uint64_t node_id_arg, int8_tArray rgb_arg, uint64_t alias_arg, uint64_tArray addresses_arg, int8_tArray excess_address_data_arg, int8_tArray excess_data_arg) {
53044         LDKNodeFeatures features_arg_conv;
53045         features_arg_conv.inner = untag_ptr(features_arg);
53046         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53047         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53048         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
53049         LDKNodeId node_id_arg_conv;
53050         node_id_arg_conv.inner = untag_ptr(node_id_arg);
53051         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
53052         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
53053         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
53054         LDKThreeBytes rgb_arg_ref;
53055         CHECK(rgb_arg->arr_len == 3);
53056         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
53057         LDKNodeAlias alias_arg_conv;
53058         alias_arg_conv.inner = untag_ptr(alias_arg);
53059         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
53060         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
53061         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
53062         LDKCVec_SocketAddressZ addresses_arg_constr;
53063         addresses_arg_constr.datalen = addresses_arg->arr_len;
53064         if (addresses_arg_constr.datalen > 0)
53065                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
53066         else
53067                 addresses_arg_constr.data = NULL;
53068         uint64_t* addresses_arg_vals = addresses_arg->elems;
53069         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
53070                 uint64_t addresses_arg_conv_15 = addresses_arg_vals[p];
53071                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
53072                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
53073                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
53074                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
53075         }
53076         FREE(addresses_arg);
53077         LDKCVec_u8Z excess_address_data_arg_ref;
53078         excess_address_data_arg_ref.datalen = excess_address_data_arg->arr_len;
53079         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53080         memcpy(excess_address_data_arg_ref.data, excess_address_data_arg->elems, excess_address_data_arg_ref.datalen); FREE(excess_address_data_arg);
53081         LDKCVec_u8Z excess_data_arg_ref;
53082         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
53083         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53084         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
53085         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_new(features_arg_conv, timestamp_arg, node_id_arg_conv, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, excess_address_data_arg_ref, excess_data_arg_ref);
53086         uint64_t ret_ref = 0;
53087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53089         return ret_ref;
53090 }
53091
53092 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
53093         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
53094         uint64_t ret_ref = 0;
53095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53097         return ret_ref;
53098 }
53099 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
53100         LDKUnsignedNodeAnnouncement arg_conv;
53101         arg_conv.inner = untag_ptr(arg);
53102         arg_conv.is_owned = ptr_is_owned(arg);
53103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53104         arg_conv.is_owned = false;
53105         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
53106         return ret_conv;
53107 }
53108
53109 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
53110         LDKUnsignedNodeAnnouncement orig_conv;
53111         orig_conv.inner = untag_ptr(orig);
53112         orig_conv.is_owned = ptr_is_owned(orig);
53113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53114         orig_conv.is_owned = false;
53115         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
53116         uint64_t ret_ref = 0;
53117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53119         return ret_ref;
53120 }
53121
53122 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_hash"))) TS_UnsignedNodeAnnouncement_hash(uint64_t o) {
53123         LDKUnsignedNodeAnnouncement o_conv;
53124         o_conv.inner = untag_ptr(o);
53125         o_conv.is_owned = ptr_is_owned(o);
53126         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53127         o_conv.is_owned = false;
53128         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
53129         return ret_conv;
53130 }
53131
53132 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
53133         LDKUnsignedNodeAnnouncement a_conv;
53134         a_conv.inner = untag_ptr(a);
53135         a_conv.is_owned = ptr_is_owned(a);
53136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53137         a_conv.is_owned = false;
53138         LDKUnsignedNodeAnnouncement b_conv;
53139         b_conv.inner = untag_ptr(b);
53140         b_conv.is_owned = ptr_is_owned(b);
53141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53142         b_conv.is_owned = false;
53143         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
53144         return ret_conv;
53145 }
53146
53147 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
53148         LDKNodeAnnouncement this_obj_conv;
53149         this_obj_conv.inner = untag_ptr(this_obj);
53150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53152         NodeAnnouncement_free(this_obj_conv);
53153 }
53154
53155 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
53156         LDKNodeAnnouncement this_ptr_conv;
53157         this_ptr_conv.inner = untag_ptr(this_ptr);
53158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53160         this_ptr_conv.is_owned = false;
53161         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53162         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
53163         return ret_arr;
53164 }
53165
53166 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
53167         LDKNodeAnnouncement this_ptr_conv;
53168         this_ptr_conv.inner = untag_ptr(this_ptr);
53169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53171         this_ptr_conv.is_owned = false;
53172         LDKECDSASignature val_ref;
53173         CHECK(val->arr_len == 64);
53174         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53175         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
53176 }
53177
53178 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
53179         LDKNodeAnnouncement this_ptr_conv;
53180         this_ptr_conv.inner = untag_ptr(this_ptr);
53181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53183         this_ptr_conv.is_owned = false;
53184         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
53185         uint64_t ret_ref = 0;
53186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53188         return ret_ref;
53189 }
53190
53191 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
53192         LDKNodeAnnouncement this_ptr_conv;
53193         this_ptr_conv.inner = untag_ptr(this_ptr);
53194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53196         this_ptr_conv.is_owned = false;
53197         LDKUnsignedNodeAnnouncement val_conv;
53198         val_conv.inner = untag_ptr(val);
53199         val_conv.is_owned = ptr_is_owned(val);
53200         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53201         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
53202         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
53203 }
53204
53205 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
53206         LDKECDSASignature signature_arg_ref;
53207         CHECK(signature_arg->arr_len == 64);
53208         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
53209         LDKUnsignedNodeAnnouncement contents_arg_conv;
53210         contents_arg_conv.inner = untag_ptr(contents_arg);
53211         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
53212         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
53213         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
53214         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
53215         uint64_t ret_ref = 0;
53216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53218         return ret_ref;
53219 }
53220
53221 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
53222         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
53223         uint64_t ret_ref = 0;
53224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53226         return ret_ref;
53227 }
53228 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
53229         LDKNodeAnnouncement arg_conv;
53230         arg_conv.inner = untag_ptr(arg);
53231         arg_conv.is_owned = ptr_is_owned(arg);
53232         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53233         arg_conv.is_owned = false;
53234         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
53235         return ret_conv;
53236 }
53237
53238 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
53239         LDKNodeAnnouncement orig_conv;
53240         orig_conv.inner = untag_ptr(orig);
53241         orig_conv.is_owned = ptr_is_owned(orig);
53242         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53243         orig_conv.is_owned = false;
53244         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
53245         uint64_t ret_ref = 0;
53246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53248         return ret_ref;
53249 }
53250
53251 int64_t  __attribute__((export_name("TS_NodeAnnouncement_hash"))) TS_NodeAnnouncement_hash(uint64_t o) {
53252         LDKNodeAnnouncement o_conv;
53253         o_conv.inner = untag_ptr(o);
53254         o_conv.is_owned = ptr_is_owned(o);
53255         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53256         o_conv.is_owned = false;
53257         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
53258         return ret_conv;
53259 }
53260
53261 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
53262         LDKNodeAnnouncement a_conv;
53263         a_conv.inner = untag_ptr(a);
53264         a_conv.is_owned = ptr_is_owned(a);
53265         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53266         a_conv.is_owned = false;
53267         LDKNodeAnnouncement b_conv;
53268         b_conv.inner = untag_ptr(b);
53269         b_conv.is_owned = ptr_is_owned(b);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53271         b_conv.is_owned = false;
53272         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
53273         return ret_conv;
53274 }
53275
53276 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
53277         LDKUnsignedChannelAnnouncement this_obj_conv;
53278         this_obj_conv.inner = untag_ptr(this_obj);
53279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53281         UnsignedChannelAnnouncement_free(this_obj_conv);
53282 }
53283
53284 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
53285         LDKUnsignedChannelAnnouncement this_ptr_conv;
53286         this_ptr_conv.inner = untag_ptr(this_ptr);
53287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53289         this_ptr_conv.is_owned = false;
53290         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
53291         uint64_t ret_ref = 0;
53292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53294         return ret_ref;
53295 }
53296
53297 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
53298         LDKUnsignedChannelAnnouncement this_ptr_conv;
53299         this_ptr_conv.inner = untag_ptr(this_ptr);
53300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53302         this_ptr_conv.is_owned = false;
53303         LDKChannelFeatures val_conv;
53304         val_conv.inner = untag_ptr(val);
53305         val_conv.is_owned = ptr_is_owned(val);
53306         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53307         val_conv = ChannelFeatures_clone(&val_conv);
53308         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
53309 }
53310
53311 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
53312         LDKUnsignedChannelAnnouncement this_ptr_conv;
53313         this_ptr_conv.inner = untag_ptr(this_ptr);
53314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53316         this_ptr_conv.is_owned = false;
53317         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53318         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
53319         return ret_arr;
53320 }
53321
53322 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53323         LDKUnsignedChannelAnnouncement this_ptr_conv;
53324         this_ptr_conv.inner = untag_ptr(this_ptr);
53325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53327         this_ptr_conv.is_owned = false;
53328         LDKThirtyTwoBytes val_ref;
53329         CHECK(val->arr_len == 32);
53330         memcpy(val_ref.data, val->elems, 32); FREE(val);
53331         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
53332 }
53333
53334 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
53335         LDKUnsignedChannelAnnouncement this_ptr_conv;
53336         this_ptr_conv.inner = untag_ptr(this_ptr);
53337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53339         this_ptr_conv.is_owned = false;
53340         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
53341         return ret_conv;
53342 }
53343
53344 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
53345         LDKUnsignedChannelAnnouncement this_ptr_conv;
53346         this_ptr_conv.inner = untag_ptr(this_ptr);
53347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53349         this_ptr_conv.is_owned = false;
53350         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
53351 }
53352
53353 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
53354         LDKUnsignedChannelAnnouncement this_ptr_conv;
53355         this_ptr_conv.inner = untag_ptr(this_ptr);
53356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53358         this_ptr_conv.is_owned = false;
53359         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
53360         uint64_t ret_ref = 0;
53361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53363         return ret_ref;
53364 }
53365
53366 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
53367         LDKUnsignedChannelAnnouncement this_ptr_conv;
53368         this_ptr_conv.inner = untag_ptr(this_ptr);
53369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53371         this_ptr_conv.is_owned = false;
53372         LDKNodeId val_conv;
53373         val_conv.inner = untag_ptr(val);
53374         val_conv.is_owned = ptr_is_owned(val);
53375         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53376         val_conv = NodeId_clone(&val_conv);
53377         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
53378 }
53379
53380 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
53381         LDKUnsignedChannelAnnouncement this_ptr_conv;
53382         this_ptr_conv.inner = untag_ptr(this_ptr);
53383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53385         this_ptr_conv.is_owned = false;
53386         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
53387         uint64_t ret_ref = 0;
53388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53390         return ret_ref;
53391 }
53392
53393 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
53394         LDKUnsignedChannelAnnouncement this_ptr_conv;
53395         this_ptr_conv.inner = untag_ptr(this_ptr);
53396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53398         this_ptr_conv.is_owned = false;
53399         LDKNodeId val_conv;
53400         val_conv.inner = untag_ptr(val);
53401         val_conv.is_owned = ptr_is_owned(val);
53402         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53403         val_conv = NodeId_clone(&val_conv);
53404         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
53405 }
53406
53407 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
53408         LDKUnsignedChannelAnnouncement this_ptr_conv;
53409         this_ptr_conv.inner = untag_ptr(this_ptr);
53410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53412         this_ptr_conv.is_owned = false;
53413         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
53414         uint64_t ret_ref = 0;
53415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53417         return ret_ref;
53418 }
53419
53420 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
53421         LDKUnsignedChannelAnnouncement this_ptr_conv;
53422         this_ptr_conv.inner = untag_ptr(this_ptr);
53423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53425         this_ptr_conv.is_owned = false;
53426         LDKNodeId val_conv;
53427         val_conv.inner = untag_ptr(val);
53428         val_conv.is_owned = ptr_is_owned(val);
53429         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53430         val_conv = NodeId_clone(&val_conv);
53431         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
53432 }
53433
53434 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
53435         LDKUnsignedChannelAnnouncement this_ptr_conv;
53436         this_ptr_conv.inner = untag_ptr(this_ptr);
53437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53439         this_ptr_conv.is_owned = false;
53440         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
53441         uint64_t ret_ref = 0;
53442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53444         return ret_ref;
53445 }
53446
53447 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
53448         LDKUnsignedChannelAnnouncement this_ptr_conv;
53449         this_ptr_conv.inner = untag_ptr(this_ptr);
53450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53452         this_ptr_conv.is_owned = false;
53453         LDKNodeId val_conv;
53454         val_conv.inner = untag_ptr(val);
53455         val_conv.is_owned = ptr_is_owned(val);
53456         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53457         val_conv = NodeId_clone(&val_conv);
53458         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
53459 }
53460
53461 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_excess_data"))) TS_UnsignedChannelAnnouncement_get_excess_data(uint64_t this_ptr) {
53462         LDKUnsignedChannelAnnouncement this_ptr_conv;
53463         this_ptr_conv.inner = untag_ptr(this_ptr);
53464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53466         this_ptr_conv.is_owned = false;
53467         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
53468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53470         CVec_u8Z_free(ret_var);
53471         return ret_arr;
53472 }
53473
53474 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_excess_data"))) TS_UnsignedChannelAnnouncement_set_excess_data(uint64_t this_ptr, int8_tArray val) {
53475         LDKUnsignedChannelAnnouncement this_ptr_conv;
53476         this_ptr_conv.inner = untag_ptr(this_ptr);
53477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53479         this_ptr_conv.is_owned = false;
53480         LDKCVec_u8Z val_ref;
53481         val_ref.datalen = val->arr_len;
53482         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53483         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53484         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
53485 }
53486
53487 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) {
53488         LDKChannelFeatures features_arg_conv;
53489         features_arg_conv.inner = untag_ptr(features_arg);
53490         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53491         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53492         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
53493         LDKThirtyTwoBytes chain_hash_arg_ref;
53494         CHECK(chain_hash_arg->arr_len == 32);
53495         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53496         LDKNodeId node_id_1_arg_conv;
53497         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
53498         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
53499         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
53500         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
53501         LDKNodeId node_id_2_arg_conv;
53502         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
53503         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
53505         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
53506         LDKNodeId bitcoin_key_1_arg_conv;
53507         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
53508         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
53509         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
53510         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
53511         LDKNodeId bitcoin_key_2_arg_conv;
53512         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
53513         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
53515         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
53516         LDKCVec_u8Z excess_data_arg_ref;
53517         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
53518         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53519         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
53520         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);
53521         uint64_t ret_ref = 0;
53522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53524         return ret_ref;
53525 }
53526
53527 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
53528         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
53529         uint64_t ret_ref = 0;
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53532         return ret_ref;
53533 }
53534 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
53535         LDKUnsignedChannelAnnouncement arg_conv;
53536         arg_conv.inner = untag_ptr(arg);
53537         arg_conv.is_owned = ptr_is_owned(arg);
53538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53539         arg_conv.is_owned = false;
53540         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
53541         return ret_conv;
53542 }
53543
53544 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
53545         LDKUnsignedChannelAnnouncement orig_conv;
53546         orig_conv.inner = untag_ptr(orig);
53547         orig_conv.is_owned = ptr_is_owned(orig);
53548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53549         orig_conv.is_owned = false;
53550         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
53551         uint64_t ret_ref = 0;
53552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53554         return ret_ref;
53555 }
53556
53557 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_hash"))) TS_UnsignedChannelAnnouncement_hash(uint64_t o) {
53558         LDKUnsignedChannelAnnouncement o_conv;
53559         o_conv.inner = untag_ptr(o);
53560         o_conv.is_owned = ptr_is_owned(o);
53561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53562         o_conv.is_owned = false;
53563         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
53564         return ret_conv;
53565 }
53566
53567 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
53568         LDKUnsignedChannelAnnouncement a_conv;
53569         a_conv.inner = untag_ptr(a);
53570         a_conv.is_owned = ptr_is_owned(a);
53571         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53572         a_conv.is_owned = false;
53573         LDKUnsignedChannelAnnouncement b_conv;
53574         b_conv.inner = untag_ptr(b);
53575         b_conv.is_owned = ptr_is_owned(b);
53576         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53577         b_conv.is_owned = false;
53578         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
53579         return ret_conv;
53580 }
53581
53582 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
53583         LDKChannelAnnouncement this_obj_conv;
53584         this_obj_conv.inner = untag_ptr(this_obj);
53585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53587         ChannelAnnouncement_free(this_obj_conv);
53588 }
53589
53590 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
53591         LDKChannelAnnouncement this_ptr_conv;
53592         this_ptr_conv.inner = untag_ptr(this_ptr);
53593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53595         this_ptr_conv.is_owned = false;
53596         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53597         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
53598         return ret_arr;
53599 }
53600
53601 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
53602         LDKChannelAnnouncement this_ptr_conv;
53603         this_ptr_conv.inner = untag_ptr(this_ptr);
53604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53606         this_ptr_conv.is_owned = false;
53607         LDKECDSASignature val_ref;
53608         CHECK(val->arr_len == 64);
53609         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53610         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
53611 }
53612
53613 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
53614         LDKChannelAnnouncement 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         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53620         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
53621         return ret_arr;
53622 }
53623
53624 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
53625         LDKChannelAnnouncement this_ptr_conv;
53626         this_ptr_conv.inner = untag_ptr(this_ptr);
53627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53629         this_ptr_conv.is_owned = false;
53630         LDKECDSASignature val_ref;
53631         CHECK(val->arr_len == 64);
53632         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53633         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
53634 }
53635
53636 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
53637         LDKChannelAnnouncement this_ptr_conv;
53638         this_ptr_conv.inner = untag_ptr(this_ptr);
53639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53641         this_ptr_conv.is_owned = false;
53642         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53643         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
53644         return ret_arr;
53645 }
53646
53647 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
53648         LDKChannelAnnouncement this_ptr_conv;
53649         this_ptr_conv.inner = untag_ptr(this_ptr);
53650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53652         this_ptr_conv.is_owned = false;
53653         LDKECDSASignature val_ref;
53654         CHECK(val->arr_len == 64);
53655         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53656         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
53657 }
53658
53659 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
53660         LDKChannelAnnouncement this_ptr_conv;
53661         this_ptr_conv.inner = untag_ptr(this_ptr);
53662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53664         this_ptr_conv.is_owned = false;
53665         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53666         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
53667         return ret_arr;
53668 }
53669
53670 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
53671         LDKChannelAnnouncement this_ptr_conv;
53672         this_ptr_conv.inner = untag_ptr(this_ptr);
53673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53675         this_ptr_conv.is_owned = false;
53676         LDKECDSASignature val_ref;
53677         CHECK(val->arr_len == 64);
53678         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53679         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
53680 }
53681
53682 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
53683         LDKChannelAnnouncement this_ptr_conv;
53684         this_ptr_conv.inner = untag_ptr(this_ptr);
53685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53687         this_ptr_conv.is_owned = false;
53688         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
53689         uint64_t ret_ref = 0;
53690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53692         return ret_ref;
53693 }
53694
53695 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
53696         LDKChannelAnnouncement this_ptr_conv;
53697         this_ptr_conv.inner = untag_ptr(this_ptr);
53698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53700         this_ptr_conv.is_owned = false;
53701         LDKUnsignedChannelAnnouncement val_conv;
53702         val_conv.inner = untag_ptr(val);
53703         val_conv.is_owned = ptr_is_owned(val);
53704         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53705         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
53706         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
53707 }
53708
53709 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) {
53710         LDKECDSASignature node_signature_1_arg_ref;
53711         CHECK(node_signature_1_arg->arr_len == 64);
53712         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
53713         LDKECDSASignature node_signature_2_arg_ref;
53714         CHECK(node_signature_2_arg->arr_len == 64);
53715         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
53716         LDKECDSASignature bitcoin_signature_1_arg_ref;
53717         CHECK(bitcoin_signature_1_arg->arr_len == 64);
53718         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
53719         LDKECDSASignature bitcoin_signature_2_arg_ref;
53720         CHECK(bitcoin_signature_2_arg->arr_len == 64);
53721         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
53722         LDKUnsignedChannelAnnouncement contents_arg_conv;
53723         contents_arg_conv.inner = untag_ptr(contents_arg);
53724         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
53725         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
53726         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
53727         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);
53728         uint64_t ret_ref = 0;
53729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53731         return ret_ref;
53732 }
53733
53734 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
53735         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
53736         uint64_t ret_ref = 0;
53737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53739         return ret_ref;
53740 }
53741 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
53742         LDKChannelAnnouncement arg_conv;
53743         arg_conv.inner = untag_ptr(arg);
53744         arg_conv.is_owned = ptr_is_owned(arg);
53745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53746         arg_conv.is_owned = false;
53747         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
53748         return ret_conv;
53749 }
53750
53751 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
53752         LDKChannelAnnouncement orig_conv;
53753         orig_conv.inner = untag_ptr(orig);
53754         orig_conv.is_owned = ptr_is_owned(orig);
53755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53756         orig_conv.is_owned = false;
53757         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
53758         uint64_t ret_ref = 0;
53759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53761         return ret_ref;
53762 }
53763
53764 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_hash"))) TS_ChannelAnnouncement_hash(uint64_t o) {
53765         LDKChannelAnnouncement o_conv;
53766         o_conv.inner = untag_ptr(o);
53767         o_conv.is_owned = ptr_is_owned(o);
53768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53769         o_conv.is_owned = false;
53770         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
53771         return ret_conv;
53772 }
53773
53774 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
53775         LDKChannelAnnouncement a_conv;
53776         a_conv.inner = untag_ptr(a);
53777         a_conv.is_owned = ptr_is_owned(a);
53778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53779         a_conv.is_owned = false;
53780         LDKChannelAnnouncement b_conv;
53781         b_conv.inner = untag_ptr(b);
53782         b_conv.is_owned = ptr_is_owned(b);
53783         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53784         b_conv.is_owned = false;
53785         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
53786         return ret_conv;
53787 }
53788
53789 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
53790         LDKUnsignedChannelUpdate this_obj_conv;
53791         this_obj_conv.inner = untag_ptr(this_obj);
53792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53794         UnsignedChannelUpdate_free(this_obj_conv);
53795 }
53796
53797 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
53798         LDKUnsignedChannelUpdate this_ptr_conv;
53799         this_ptr_conv.inner = untag_ptr(this_ptr);
53800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53802         this_ptr_conv.is_owned = false;
53803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53804         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
53805         return ret_arr;
53806 }
53807
53808 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
53809         LDKUnsignedChannelUpdate this_ptr_conv;
53810         this_ptr_conv.inner = untag_ptr(this_ptr);
53811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53813         this_ptr_conv.is_owned = false;
53814         LDKThirtyTwoBytes val_ref;
53815         CHECK(val->arr_len == 32);
53816         memcpy(val_ref.data, val->elems, 32); FREE(val);
53817         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
53818 }
53819
53820 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
53821         LDKUnsignedChannelUpdate this_ptr_conv;
53822         this_ptr_conv.inner = untag_ptr(this_ptr);
53823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53825         this_ptr_conv.is_owned = false;
53826         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
53827         return ret_conv;
53828 }
53829
53830 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
53831         LDKUnsignedChannelUpdate this_ptr_conv;
53832         this_ptr_conv.inner = untag_ptr(this_ptr);
53833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53835         this_ptr_conv.is_owned = false;
53836         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
53837 }
53838
53839 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
53840         LDKUnsignedChannelUpdate this_ptr_conv;
53841         this_ptr_conv.inner = untag_ptr(this_ptr);
53842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53844         this_ptr_conv.is_owned = false;
53845         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
53846         return ret_conv;
53847 }
53848
53849 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
53850         LDKUnsignedChannelUpdate this_ptr_conv;
53851         this_ptr_conv.inner = untag_ptr(this_ptr);
53852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53854         this_ptr_conv.is_owned = false;
53855         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
53856 }
53857
53858 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
53859         LDKUnsignedChannelUpdate this_ptr_conv;
53860         this_ptr_conv.inner = untag_ptr(this_ptr);
53861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53863         this_ptr_conv.is_owned = false;
53864         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
53865         return ret_conv;
53866 }
53867
53868 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
53869         LDKUnsignedChannelUpdate this_ptr_conv;
53870         this_ptr_conv.inner = untag_ptr(this_ptr);
53871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53873         this_ptr_conv.is_owned = false;
53874         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
53875 }
53876
53877 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
53878         LDKUnsignedChannelUpdate this_ptr_conv;
53879         this_ptr_conv.inner = untag_ptr(this_ptr);
53880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53882         this_ptr_conv.is_owned = false;
53883         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
53884         return ret_conv;
53885 }
53886
53887 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
53888         LDKUnsignedChannelUpdate this_ptr_conv;
53889         this_ptr_conv.inner = untag_ptr(this_ptr);
53890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53892         this_ptr_conv.is_owned = false;
53893         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
53894 }
53895
53896 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
53897         LDKUnsignedChannelUpdate this_ptr_conv;
53898         this_ptr_conv.inner = untag_ptr(this_ptr);
53899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53901         this_ptr_conv.is_owned = false;
53902         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
53903         return ret_conv;
53904 }
53905
53906 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
53907         LDKUnsignedChannelUpdate this_ptr_conv;
53908         this_ptr_conv.inner = untag_ptr(this_ptr);
53909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53911         this_ptr_conv.is_owned = false;
53912         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
53913 }
53914
53915 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
53916         LDKUnsignedChannelUpdate this_ptr_conv;
53917         this_ptr_conv.inner = untag_ptr(this_ptr);
53918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53920         this_ptr_conv.is_owned = false;
53921         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
53922         return ret_conv;
53923 }
53924
53925 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
53926         LDKUnsignedChannelUpdate this_ptr_conv;
53927         this_ptr_conv.inner = untag_ptr(this_ptr);
53928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53930         this_ptr_conv.is_owned = false;
53931         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
53932 }
53933
53934 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
53935         LDKUnsignedChannelUpdate this_ptr_conv;
53936         this_ptr_conv.inner = untag_ptr(this_ptr);
53937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53939         this_ptr_conv.is_owned = false;
53940         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
53941         return ret_conv;
53942 }
53943
53944 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
53945         LDKUnsignedChannelUpdate this_ptr_conv;
53946         this_ptr_conv.inner = untag_ptr(this_ptr);
53947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53949         this_ptr_conv.is_owned = false;
53950         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
53951 }
53952
53953 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
53954         LDKUnsignedChannelUpdate this_ptr_conv;
53955         this_ptr_conv.inner = untag_ptr(this_ptr);
53956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53958         this_ptr_conv.is_owned = false;
53959         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
53960         return ret_conv;
53961 }
53962
53963 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
53964         LDKUnsignedChannelUpdate this_ptr_conv;
53965         this_ptr_conv.inner = untag_ptr(this_ptr);
53966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53968         this_ptr_conv.is_owned = false;
53969         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
53970 }
53971
53972 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
53973         LDKUnsignedChannelUpdate this_ptr_conv;
53974         this_ptr_conv.inner = untag_ptr(this_ptr);
53975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53977         this_ptr_conv.is_owned = false;
53978         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
53979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53981         CVec_u8Z_free(ret_var);
53982         return ret_arr;
53983 }
53984
53985 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
53986         LDKUnsignedChannelUpdate this_ptr_conv;
53987         this_ptr_conv.inner = untag_ptr(this_ptr);
53988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53990         this_ptr_conv.is_owned = false;
53991         LDKCVec_u8Z val_ref;
53992         val_ref.datalen = val->arr_len;
53993         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53994         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53995         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
53996 }
53997
53998 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) {
53999         LDKThirtyTwoBytes chain_hash_arg_ref;
54000         CHECK(chain_hash_arg->arr_len == 32);
54001         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54002         LDKCVec_u8Z excess_data_arg_ref;
54003         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
54004         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54005         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
54006         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);
54007         uint64_t ret_ref = 0;
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54010         return ret_ref;
54011 }
54012
54013 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
54014         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
54015         uint64_t ret_ref = 0;
54016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54018         return ret_ref;
54019 }
54020 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
54021         LDKUnsignedChannelUpdate arg_conv;
54022         arg_conv.inner = untag_ptr(arg);
54023         arg_conv.is_owned = ptr_is_owned(arg);
54024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54025         arg_conv.is_owned = false;
54026         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
54027         return ret_conv;
54028 }
54029
54030 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
54031         LDKUnsignedChannelUpdate orig_conv;
54032         orig_conv.inner = untag_ptr(orig);
54033         orig_conv.is_owned = ptr_is_owned(orig);
54034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54035         orig_conv.is_owned = false;
54036         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
54037         uint64_t ret_ref = 0;
54038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54040         return ret_ref;
54041 }
54042
54043 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_hash"))) TS_UnsignedChannelUpdate_hash(uint64_t o) {
54044         LDKUnsignedChannelUpdate o_conv;
54045         o_conv.inner = untag_ptr(o);
54046         o_conv.is_owned = ptr_is_owned(o);
54047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54048         o_conv.is_owned = false;
54049         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
54050         return ret_conv;
54051 }
54052
54053 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
54054         LDKUnsignedChannelUpdate a_conv;
54055         a_conv.inner = untag_ptr(a);
54056         a_conv.is_owned = ptr_is_owned(a);
54057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54058         a_conv.is_owned = false;
54059         LDKUnsignedChannelUpdate b_conv;
54060         b_conv.inner = untag_ptr(b);
54061         b_conv.is_owned = ptr_is_owned(b);
54062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54063         b_conv.is_owned = false;
54064         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
54065         return ret_conv;
54066 }
54067
54068 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
54069         LDKChannelUpdate this_obj_conv;
54070         this_obj_conv.inner = untag_ptr(this_obj);
54071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54073         ChannelUpdate_free(this_obj_conv);
54074 }
54075
54076 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
54077         LDKChannelUpdate this_ptr_conv;
54078         this_ptr_conv.inner = untag_ptr(this_ptr);
54079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54081         this_ptr_conv.is_owned = false;
54082         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54083         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
54084         return ret_arr;
54085 }
54086
54087 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
54088         LDKChannelUpdate this_ptr_conv;
54089         this_ptr_conv.inner = untag_ptr(this_ptr);
54090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54092         this_ptr_conv.is_owned = false;
54093         LDKECDSASignature val_ref;
54094         CHECK(val->arr_len == 64);
54095         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54096         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
54097 }
54098
54099 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
54100         LDKChannelUpdate this_ptr_conv;
54101         this_ptr_conv.inner = untag_ptr(this_ptr);
54102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54104         this_ptr_conv.is_owned = false;
54105         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
54106         uint64_t ret_ref = 0;
54107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54109         return ret_ref;
54110 }
54111
54112 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
54113         LDKChannelUpdate this_ptr_conv;
54114         this_ptr_conv.inner = untag_ptr(this_ptr);
54115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54117         this_ptr_conv.is_owned = false;
54118         LDKUnsignedChannelUpdate val_conv;
54119         val_conv.inner = untag_ptr(val);
54120         val_conv.is_owned = ptr_is_owned(val);
54121         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54122         val_conv = UnsignedChannelUpdate_clone(&val_conv);
54123         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
54124 }
54125
54126 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
54127         LDKECDSASignature signature_arg_ref;
54128         CHECK(signature_arg->arr_len == 64);
54129         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
54130         LDKUnsignedChannelUpdate contents_arg_conv;
54131         contents_arg_conv.inner = untag_ptr(contents_arg);
54132         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54133         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54134         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
54135         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
54136         uint64_t ret_ref = 0;
54137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54139         return ret_ref;
54140 }
54141
54142 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
54143         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
54144         uint64_t ret_ref = 0;
54145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54147         return ret_ref;
54148 }
54149 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
54150         LDKChannelUpdate arg_conv;
54151         arg_conv.inner = untag_ptr(arg);
54152         arg_conv.is_owned = ptr_is_owned(arg);
54153         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54154         arg_conv.is_owned = false;
54155         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
54156         return ret_conv;
54157 }
54158
54159 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
54160         LDKChannelUpdate orig_conv;
54161         orig_conv.inner = untag_ptr(orig);
54162         orig_conv.is_owned = ptr_is_owned(orig);
54163         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54164         orig_conv.is_owned = false;
54165         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
54166         uint64_t ret_ref = 0;
54167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54169         return ret_ref;
54170 }
54171
54172 int64_t  __attribute__((export_name("TS_ChannelUpdate_hash"))) TS_ChannelUpdate_hash(uint64_t o) {
54173         LDKChannelUpdate o_conv;
54174         o_conv.inner = untag_ptr(o);
54175         o_conv.is_owned = ptr_is_owned(o);
54176         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54177         o_conv.is_owned = false;
54178         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
54179         return ret_conv;
54180 }
54181
54182 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
54183         LDKChannelUpdate a_conv;
54184         a_conv.inner = untag_ptr(a);
54185         a_conv.is_owned = ptr_is_owned(a);
54186         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54187         a_conv.is_owned = false;
54188         LDKChannelUpdate b_conv;
54189         b_conv.inner = untag_ptr(b);
54190         b_conv.is_owned = ptr_is_owned(b);
54191         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54192         b_conv.is_owned = false;
54193         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
54194         return ret_conv;
54195 }
54196
54197 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
54198         LDKQueryChannelRange this_obj_conv;
54199         this_obj_conv.inner = untag_ptr(this_obj);
54200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54202         QueryChannelRange_free(this_obj_conv);
54203 }
54204
54205 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
54206         LDKQueryChannelRange this_ptr_conv;
54207         this_ptr_conv.inner = untag_ptr(this_ptr);
54208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54210         this_ptr_conv.is_owned = false;
54211         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54212         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
54213         return ret_arr;
54214 }
54215
54216 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
54217         LDKQueryChannelRange this_ptr_conv;
54218         this_ptr_conv.inner = untag_ptr(this_ptr);
54219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54221         this_ptr_conv.is_owned = false;
54222         LDKThirtyTwoBytes val_ref;
54223         CHECK(val->arr_len == 32);
54224         memcpy(val_ref.data, val->elems, 32); FREE(val);
54225         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54226 }
54227
54228 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
54229         LDKQueryChannelRange this_ptr_conv;
54230         this_ptr_conv.inner = untag_ptr(this_ptr);
54231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54233         this_ptr_conv.is_owned = false;
54234         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
54235         return ret_conv;
54236 }
54237
54238 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
54239         LDKQueryChannelRange this_ptr_conv;
54240         this_ptr_conv.inner = untag_ptr(this_ptr);
54241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54243         this_ptr_conv.is_owned = false;
54244         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
54245 }
54246
54247 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
54248         LDKQueryChannelRange this_ptr_conv;
54249         this_ptr_conv.inner = untag_ptr(this_ptr);
54250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54252         this_ptr_conv.is_owned = false;
54253         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
54254         return ret_conv;
54255 }
54256
54257 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
54258         LDKQueryChannelRange this_ptr_conv;
54259         this_ptr_conv.inner = untag_ptr(this_ptr);
54260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54262         this_ptr_conv.is_owned = false;
54263         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54264 }
54265
54266 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) {
54267         LDKThirtyTwoBytes chain_hash_arg_ref;
54268         CHECK(chain_hash_arg->arr_len == 32);
54269         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54270         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
54271         uint64_t ret_ref = 0;
54272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54274         return ret_ref;
54275 }
54276
54277 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
54278         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
54279         uint64_t ret_ref = 0;
54280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54282         return ret_ref;
54283 }
54284 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
54285         LDKQueryChannelRange arg_conv;
54286         arg_conv.inner = untag_ptr(arg);
54287         arg_conv.is_owned = ptr_is_owned(arg);
54288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54289         arg_conv.is_owned = false;
54290         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
54291         return ret_conv;
54292 }
54293
54294 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
54295         LDKQueryChannelRange orig_conv;
54296         orig_conv.inner = untag_ptr(orig);
54297         orig_conv.is_owned = ptr_is_owned(orig);
54298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54299         orig_conv.is_owned = false;
54300         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
54301         uint64_t ret_ref = 0;
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54304         return ret_ref;
54305 }
54306
54307 int64_t  __attribute__((export_name("TS_QueryChannelRange_hash"))) TS_QueryChannelRange_hash(uint64_t o) {
54308         LDKQueryChannelRange o_conv;
54309         o_conv.inner = untag_ptr(o);
54310         o_conv.is_owned = ptr_is_owned(o);
54311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54312         o_conv.is_owned = false;
54313         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
54314         return ret_conv;
54315 }
54316
54317 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
54318         LDKQueryChannelRange a_conv;
54319         a_conv.inner = untag_ptr(a);
54320         a_conv.is_owned = ptr_is_owned(a);
54321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54322         a_conv.is_owned = false;
54323         LDKQueryChannelRange b_conv;
54324         b_conv.inner = untag_ptr(b);
54325         b_conv.is_owned = ptr_is_owned(b);
54326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54327         b_conv.is_owned = false;
54328         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
54329         return ret_conv;
54330 }
54331
54332 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
54333         LDKReplyChannelRange this_obj_conv;
54334         this_obj_conv.inner = untag_ptr(this_obj);
54335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54337         ReplyChannelRange_free(this_obj_conv);
54338 }
54339
54340 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
54341         LDKReplyChannelRange this_ptr_conv;
54342         this_ptr_conv.inner = untag_ptr(this_ptr);
54343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54345         this_ptr_conv.is_owned = false;
54346         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54347         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
54348         return ret_arr;
54349 }
54350
54351 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
54352         LDKReplyChannelRange this_ptr_conv;
54353         this_ptr_conv.inner = untag_ptr(this_ptr);
54354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54356         this_ptr_conv.is_owned = false;
54357         LDKThirtyTwoBytes val_ref;
54358         CHECK(val->arr_len == 32);
54359         memcpy(val_ref.data, val->elems, 32); FREE(val);
54360         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54361 }
54362
54363 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
54364         LDKReplyChannelRange this_ptr_conv;
54365         this_ptr_conv.inner = untag_ptr(this_ptr);
54366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54368         this_ptr_conv.is_owned = false;
54369         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
54370         return ret_conv;
54371 }
54372
54373 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
54374         LDKReplyChannelRange this_ptr_conv;
54375         this_ptr_conv.inner = untag_ptr(this_ptr);
54376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54378         this_ptr_conv.is_owned = false;
54379         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
54380 }
54381
54382 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
54383         LDKReplyChannelRange this_ptr_conv;
54384         this_ptr_conv.inner = untag_ptr(this_ptr);
54385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54387         this_ptr_conv.is_owned = false;
54388         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
54389         return ret_conv;
54390 }
54391
54392 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
54393         LDKReplyChannelRange this_ptr_conv;
54394         this_ptr_conv.inner = untag_ptr(this_ptr);
54395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54397         this_ptr_conv.is_owned = false;
54398         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54399 }
54400
54401 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
54402         LDKReplyChannelRange this_ptr_conv;
54403         this_ptr_conv.inner = untag_ptr(this_ptr);
54404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54406         this_ptr_conv.is_owned = false;
54407         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
54408         return ret_conv;
54409 }
54410
54411 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
54412         LDKReplyChannelRange this_ptr_conv;
54413         this_ptr_conv.inner = untag_ptr(this_ptr);
54414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54416         this_ptr_conv.is_owned = false;
54417         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
54418 }
54419
54420 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
54421         LDKReplyChannelRange this_ptr_conv;
54422         this_ptr_conv.inner = untag_ptr(this_ptr);
54423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54425         this_ptr_conv.is_owned = false;
54426         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
54427         int64_tArray ret_arr = NULL;
54428         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54429         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54430         for (size_t i = 0; i < ret_var.datalen; i++) {
54431                 int64_t ret_conv_8_conv = ret_var.data[i];
54432                 ret_arr_ptr[i] = ret_conv_8_conv;
54433         }
54434         
54435         FREE(ret_var.data);
54436         return ret_arr;
54437 }
54438
54439 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
54440         LDKReplyChannelRange this_ptr_conv;
54441         this_ptr_conv.inner = untag_ptr(this_ptr);
54442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54444         this_ptr_conv.is_owned = false;
54445         LDKCVec_u64Z val_constr;
54446         val_constr.datalen = val->arr_len;
54447         if (val_constr.datalen > 0)
54448                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54449         else
54450                 val_constr.data = NULL;
54451         int64_t* val_vals = val->elems;
54452         for (size_t i = 0; i < val_constr.datalen; i++) {
54453                 int64_t val_conv_8 = val_vals[i];
54454                 val_constr.data[i] = val_conv_8;
54455         }
54456         FREE(val);
54457         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
54458 }
54459
54460 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) {
54461         LDKThirtyTwoBytes chain_hash_arg_ref;
54462         CHECK(chain_hash_arg->arr_len == 32);
54463         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54464         LDKCVec_u64Z short_channel_ids_arg_constr;
54465         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
54466         if (short_channel_ids_arg_constr.datalen > 0)
54467                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54468         else
54469                 short_channel_ids_arg_constr.data = NULL;
54470         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
54471         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
54472                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
54473                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
54474         }
54475         FREE(short_channel_ids_arg);
54476         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
54477         uint64_t ret_ref = 0;
54478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54480         return ret_ref;
54481 }
54482
54483 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
54484         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
54485         uint64_t ret_ref = 0;
54486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54488         return ret_ref;
54489 }
54490 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
54491         LDKReplyChannelRange arg_conv;
54492         arg_conv.inner = untag_ptr(arg);
54493         arg_conv.is_owned = ptr_is_owned(arg);
54494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54495         arg_conv.is_owned = false;
54496         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
54497         return ret_conv;
54498 }
54499
54500 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
54501         LDKReplyChannelRange orig_conv;
54502         orig_conv.inner = untag_ptr(orig);
54503         orig_conv.is_owned = ptr_is_owned(orig);
54504         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54505         orig_conv.is_owned = false;
54506         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
54507         uint64_t ret_ref = 0;
54508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54510         return ret_ref;
54511 }
54512
54513 int64_t  __attribute__((export_name("TS_ReplyChannelRange_hash"))) TS_ReplyChannelRange_hash(uint64_t o) {
54514         LDKReplyChannelRange o_conv;
54515         o_conv.inner = untag_ptr(o);
54516         o_conv.is_owned = ptr_is_owned(o);
54517         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54518         o_conv.is_owned = false;
54519         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
54520         return ret_conv;
54521 }
54522
54523 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
54524         LDKReplyChannelRange a_conv;
54525         a_conv.inner = untag_ptr(a);
54526         a_conv.is_owned = ptr_is_owned(a);
54527         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54528         a_conv.is_owned = false;
54529         LDKReplyChannelRange b_conv;
54530         b_conv.inner = untag_ptr(b);
54531         b_conv.is_owned = ptr_is_owned(b);
54532         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54533         b_conv.is_owned = false;
54534         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
54535         return ret_conv;
54536 }
54537
54538 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
54539         LDKQueryShortChannelIds this_obj_conv;
54540         this_obj_conv.inner = untag_ptr(this_obj);
54541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54543         QueryShortChannelIds_free(this_obj_conv);
54544 }
54545
54546 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
54547         LDKQueryShortChannelIds this_ptr_conv;
54548         this_ptr_conv.inner = untag_ptr(this_ptr);
54549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54551         this_ptr_conv.is_owned = false;
54552         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54553         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
54554         return ret_arr;
54555 }
54556
54557 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
54558         LDKQueryShortChannelIds this_ptr_conv;
54559         this_ptr_conv.inner = untag_ptr(this_ptr);
54560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54562         this_ptr_conv.is_owned = false;
54563         LDKThirtyTwoBytes val_ref;
54564         CHECK(val->arr_len == 32);
54565         memcpy(val_ref.data, val->elems, 32); FREE(val);
54566         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
54567 }
54568
54569 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
54570         LDKQueryShortChannelIds this_ptr_conv;
54571         this_ptr_conv.inner = untag_ptr(this_ptr);
54572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54574         this_ptr_conv.is_owned = false;
54575         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
54576         int64_tArray ret_arr = NULL;
54577         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54578         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54579         for (size_t i = 0; i < ret_var.datalen; i++) {
54580                 int64_t ret_conv_8_conv = ret_var.data[i];
54581                 ret_arr_ptr[i] = ret_conv_8_conv;
54582         }
54583         
54584         FREE(ret_var.data);
54585         return ret_arr;
54586 }
54587
54588 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
54589         LDKQueryShortChannelIds this_ptr_conv;
54590         this_ptr_conv.inner = untag_ptr(this_ptr);
54591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54593         this_ptr_conv.is_owned = false;
54594         LDKCVec_u64Z val_constr;
54595         val_constr.datalen = val->arr_len;
54596         if (val_constr.datalen > 0)
54597                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54598         else
54599                 val_constr.data = NULL;
54600         int64_t* val_vals = val->elems;
54601         for (size_t i = 0; i < val_constr.datalen; i++) {
54602                 int64_t val_conv_8 = val_vals[i];
54603                 val_constr.data[i] = val_conv_8;
54604         }
54605         FREE(val);
54606         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
54607 }
54608
54609 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
54610         LDKThirtyTwoBytes chain_hash_arg_ref;
54611         CHECK(chain_hash_arg->arr_len == 32);
54612         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54613         LDKCVec_u64Z short_channel_ids_arg_constr;
54614         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
54615         if (short_channel_ids_arg_constr.datalen > 0)
54616                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54617         else
54618                 short_channel_ids_arg_constr.data = NULL;
54619         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
54620         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
54621                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
54622                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
54623         }
54624         FREE(short_channel_ids_arg);
54625         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
54626         uint64_t ret_ref = 0;
54627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54629         return ret_ref;
54630 }
54631
54632 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
54633         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
54634         uint64_t ret_ref = 0;
54635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54637         return ret_ref;
54638 }
54639 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
54640         LDKQueryShortChannelIds arg_conv;
54641         arg_conv.inner = untag_ptr(arg);
54642         arg_conv.is_owned = ptr_is_owned(arg);
54643         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54644         arg_conv.is_owned = false;
54645         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
54646         return ret_conv;
54647 }
54648
54649 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
54650         LDKQueryShortChannelIds orig_conv;
54651         orig_conv.inner = untag_ptr(orig);
54652         orig_conv.is_owned = ptr_is_owned(orig);
54653         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54654         orig_conv.is_owned = false;
54655         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
54656         uint64_t ret_ref = 0;
54657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54659         return ret_ref;
54660 }
54661
54662 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_hash"))) TS_QueryShortChannelIds_hash(uint64_t o) {
54663         LDKQueryShortChannelIds o_conv;
54664         o_conv.inner = untag_ptr(o);
54665         o_conv.is_owned = ptr_is_owned(o);
54666         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54667         o_conv.is_owned = false;
54668         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
54669         return ret_conv;
54670 }
54671
54672 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
54673         LDKQueryShortChannelIds a_conv;
54674         a_conv.inner = untag_ptr(a);
54675         a_conv.is_owned = ptr_is_owned(a);
54676         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54677         a_conv.is_owned = false;
54678         LDKQueryShortChannelIds b_conv;
54679         b_conv.inner = untag_ptr(b);
54680         b_conv.is_owned = ptr_is_owned(b);
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54682         b_conv.is_owned = false;
54683         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
54684         return ret_conv;
54685 }
54686
54687 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
54688         LDKReplyShortChannelIdsEnd this_obj_conv;
54689         this_obj_conv.inner = untag_ptr(this_obj);
54690         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54692         ReplyShortChannelIdsEnd_free(this_obj_conv);
54693 }
54694
54695 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
54696         LDKReplyShortChannelIdsEnd this_ptr_conv;
54697         this_ptr_conv.inner = untag_ptr(this_ptr);
54698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54700         this_ptr_conv.is_owned = false;
54701         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54702         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
54703         return ret_arr;
54704 }
54705
54706 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
54707         LDKReplyShortChannelIdsEnd this_ptr_conv;
54708         this_ptr_conv.inner = untag_ptr(this_ptr);
54709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54711         this_ptr_conv.is_owned = false;
54712         LDKThirtyTwoBytes val_ref;
54713         CHECK(val->arr_len == 32);
54714         memcpy(val_ref.data, val->elems, 32); FREE(val);
54715         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
54716 }
54717
54718 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
54719         LDKReplyShortChannelIdsEnd this_ptr_conv;
54720         this_ptr_conv.inner = untag_ptr(this_ptr);
54721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54723         this_ptr_conv.is_owned = false;
54724         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
54725         return ret_conv;
54726 }
54727
54728 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
54729         LDKReplyShortChannelIdsEnd this_ptr_conv;
54730         this_ptr_conv.inner = untag_ptr(this_ptr);
54731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54733         this_ptr_conv.is_owned = false;
54734         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
54735 }
54736
54737 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
54738         LDKThirtyTwoBytes chain_hash_arg_ref;
54739         CHECK(chain_hash_arg->arr_len == 32);
54740         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54741         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
54742         uint64_t ret_ref = 0;
54743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54745         return ret_ref;
54746 }
54747
54748 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
54749         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
54750         uint64_t ret_ref = 0;
54751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54753         return ret_ref;
54754 }
54755 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
54756         LDKReplyShortChannelIdsEnd arg_conv;
54757         arg_conv.inner = untag_ptr(arg);
54758         arg_conv.is_owned = ptr_is_owned(arg);
54759         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54760         arg_conv.is_owned = false;
54761         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
54762         return ret_conv;
54763 }
54764
54765 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
54766         LDKReplyShortChannelIdsEnd orig_conv;
54767         orig_conv.inner = untag_ptr(orig);
54768         orig_conv.is_owned = ptr_is_owned(orig);
54769         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54770         orig_conv.is_owned = false;
54771         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
54772         uint64_t ret_ref = 0;
54773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54775         return ret_ref;
54776 }
54777
54778 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_hash"))) TS_ReplyShortChannelIdsEnd_hash(uint64_t o) {
54779         LDKReplyShortChannelIdsEnd o_conv;
54780         o_conv.inner = untag_ptr(o);
54781         o_conv.is_owned = ptr_is_owned(o);
54782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54783         o_conv.is_owned = false;
54784         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
54785         return ret_conv;
54786 }
54787
54788 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
54789         LDKReplyShortChannelIdsEnd a_conv;
54790         a_conv.inner = untag_ptr(a);
54791         a_conv.is_owned = ptr_is_owned(a);
54792         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54793         a_conv.is_owned = false;
54794         LDKReplyShortChannelIdsEnd b_conv;
54795         b_conv.inner = untag_ptr(b);
54796         b_conv.is_owned = ptr_is_owned(b);
54797         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54798         b_conv.is_owned = false;
54799         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
54800         return ret_conv;
54801 }
54802
54803 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
54804         LDKGossipTimestampFilter this_obj_conv;
54805         this_obj_conv.inner = untag_ptr(this_obj);
54806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54808         GossipTimestampFilter_free(this_obj_conv);
54809 }
54810
54811 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
54812         LDKGossipTimestampFilter this_ptr_conv;
54813         this_ptr_conv.inner = untag_ptr(this_ptr);
54814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54816         this_ptr_conv.is_owned = false;
54817         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54818         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
54819         return ret_arr;
54820 }
54821
54822 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
54823         LDKGossipTimestampFilter this_ptr_conv;
54824         this_ptr_conv.inner = untag_ptr(this_ptr);
54825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54827         this_ptr_conv.is_owned = false;
54828         LDKThirtyTwoBytes val_ref;
54829         CHECK(val->arr_len == 32);
54830         memcpy(val_ref.data, val->elems, 32); FREE(val);
54831         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
54832 }
54833
54834 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
54835         LDKGossipTimestampFilter this_ptr_conv;
54836         this_ptr_conv.inner = untag_ptr(this_ptr);
54837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54839         this_ptr_conv.is_owned = false;
54840         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
54841         return ret_conv;
54842 }
54843
54844 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
54845         LDKGossipTimestampFilter this_ptr_conv;
54846         this_ptr_conv.inner = untag_ptr(this_ptr);
54847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54849         this_ptr_conv.is_owned = false;
54850         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
54851 }
54852
54853 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
54854         LDKGossipTimestampFilter this_ptr_conv;
54855         this_ptr_conv.inner = untag_ptr(this_ptr);
54856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54858         this_ptr_conv.is_owned = false;
54859         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
54860         return ret_conv;
54861 }
54862
54863 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
54864         LDKGossipTimestampFilter this_ptr_conv;
54865         this_ptr_conv.inner = untag_ptr(this_ptr);
54866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54868         this_ptr_conv.is_owned = false;
54869         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
54870 }
54871
54872 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) {
54873         LDKThirtyTwoBytes chain_hash_arg_ref;
54874         CHECK(chain_hash_arg->arr_len == 32);
54875         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54876         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
54877         uint64_t ret_ref = 0;
54878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54880         return ret_ref;
54881 }
54882
54883 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
54884         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
54885         uint64_t ret_ref = 0;
54886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54888         return ret_ref;
54889 }
54890 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
54891         LDKGossipTimestampFilter arg_conv;
54892         arg_conv.inner = untag_ptr(arg);
54893         arg_conv.is_owned = ptr_is_owned(arg);
54894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54895         arg_conv.is_owned = false;
54896         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
54897         return ret_conv;
54898 }
54899
54900 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
54901         LDKGossipTimestampFilter orig_conv;
54902         orig_conv.inner = untag_ptr(orig);
54903         orig_conv.is_owned = ptr_is_owned(orig);
54904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54905         orig_conv.is_owned = false;
54906         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
54907         uint64_t ret_ref = 0;
54908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54910         return ret_ref;
54911 }
54912
54913 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_hash"))) TS_GossipTimestampFilter_hash(uint64_t o) {
54914         LDKGossipTimestampFilter o_conv;
54915         o_conv.inner = untag_ptr(o);
54916         o_conv.is_owned = ptr_is_owned(o);
54917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54918         o_conv.is_owned = false;
54919         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
54920         return ret_conv;
54921 }
54922
54923 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
54924         LDKGossipTimestampFilter a_conv;
54925         a_conv.inner = untag_ptr(a);
54926         a_conv.is_owned = ptr_is_owned(a);
54927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54928         a_conv.is_owned = false;
54929         LDKGossipTimestampFilter b_conv;
54930         b_conv.inner = untag_ptr(b);
54931         b_conv.is_owned = ptr_is_owned(b);
54932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54933         b_conv.is_owned = false;
54934         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
54935         return ret_conv;
54936 }
54937
54938 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
54939         if (!ptr_is_owned(this_ptr)) return;
54940         void* this_ptr_ptr = untag_ptr(this_ptr);
54941         CHECK_ACCESS(this_ptr_ptr);
54942         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
54943         FREE(untag_ptr(this_ptr));
54944         ErrorAction_free(this_ptr_conv);
54945 }
54946
54947 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
54948         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54949         *ret_copy = ErrorAction_clone(arg);
54950         uint64_t ret_ref = tag_ptr(ret_copy, true);
54951         return ret_ref;
54952 }
54953 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
54954         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
54955         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
54956         return ret_conv;
54957 }
54958
54959 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
54960         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
54961         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54962         *ret_copy = ErrorAction_clone(orig_conv);
54963         uint64_t ret_ref = tag_ptr(ret_copy, true);
54964         return ret_ref;
54965 }
54966
54967 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
54968         LDKErrorMessage msg_conv;
54969         msg_conv.inner = untag_ptr(msg);
54970         msg_conv.is_owned = ptr_is_owned(msg);
54971         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
54972         msg_conv = ErrorMessage_clone(&msg_conv);
54973         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54974         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
54975         uint64_t ret_ref = tag_ptr(ret_copy, true);
54976         return ret_ref;
54977 }
54978
54979 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
54980         LDKWarningMessage msg_conv;
54981         msg_conv.inner = untag_ptr(msg);
54982         msg_conv.is_owned = ptr_is_owned(msg);
54983         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
54984         msg_conv = WarningMessage_clone(&msg_conv);
54985         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54986         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
54987         uint64_t ret_ref = tag_ptr(ret_copy, true);
54988         return ret_ref;
54989 }
54990
54991 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
54992         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54993         *ret_copy = ErrorAction_ignore_error();
54994         uint64_t ret_ref = tag_ptr(ret_copy, true);
54995         return ret_ref;
54996 }
54997
54998 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
54999         LDKLevel a_conv = LDKLevel_from_js(a);
55000         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55001         *ret_copy = ErrorAction_ignore_and_log(a_conv);
55002         uint64_t ret_ref = tag_ptr(ret_copy, true);
55003         return ret_ref;
55004 }
55005
55006 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
55007         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55008         *ret_copy = ErrorAction_ignore_duplicate_gossip();
55009         uint64_t ret_ref = tag_ptr(ret_copy, true);
55010         return ret_ref;
55011 }
55012
55013 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
55014         LDKErrorMessage msg_conv;
55015         msg_conv.inner = untag_ptr(msg);
55016         msg_conv.is_owned = ptr_is_owned(msg);
55017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55018         msg_conv = ErrorMessage_clone(&msg_conv);
55019         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55020         *ret_copy = ErrorAction_send_error_message(msg_conv);
55021         uint64_t ret_ref = tag_ptr(ret_copy, true);
55022         return ret_ref;
55023 }
55024
55025 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
55026         LDKWarningMessage msg_conv;
55027         msg_conv.inner = untag_ptr(msg);
55028         msg_conv.is_owned = ptr_is_owned(msg);
55029         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55030         msg_conv = WarningMessage_clone(&msg_conv);
55031         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
55032         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55033         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
55034         uint64_t ret_ref = tag_ptr(ret_copy, true);
55035         return ret_ref;
55036 }
55037
55038 int64_t  __attribute__((export_name("TS_ErrorAction_hash"))) TS_ErrorAction_hash(uint64_t o) {
55039         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
55040         int64_t ret_conv = ErrorAction_hash(o_conv);
55041         return ret_conv;
55042 }
55043
55044 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
55045         LDKLightningError this_obj_conv;
55046         this_obj_conv.inner = untag_ptr(this_obj);
55047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55049         LightningError_free(this_obj_conv);
55050 }
55051
55052 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
55053         LDKLightningError this_ptr_conv;
55054         this_ptr_conv.inner = untag_ptr(this_ptr);
55055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55057         this_ptr_conv.is_owned = false;
55058         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
55059         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
55060         Str_free(ret_str);
55061         return ret_conv;
55062 }
55063
55064 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
55065         LDKLightningError this_ptr_conv;
55066         this_ptr_conv.inner = untag_ptr(this_ptr);
55067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55069         this_ptr_conv.is_owned = false;
55070         LDKStr val_conv = str_ref_to_owned_c(val);
55071         LightningError_set_err(&this_ptr_conv, val_conv);
55072 }
55073
55074 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
55075         LDKLightningError this_ptr_conv;
55076         this_ptr_conv.inner = untag_ptr(this_ptr);
55077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55079         this_ptr_conv.is_owned = false;
55080         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55081         *ret_copy = LightningError_get_action(&this_ptr_conv);
55082         uint64_t ret_ref = tag_ptr(ret_copy, true);
55083         return ret_ref;
55084 }
55085
55086 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
55087         LDKLightningError this_ptr_conv;
55088         this_ptr_conv.inner = untag_ptr(this_ptr);
55089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55091         this_ptr_conv.is_owned = false;
55092         void* val_ptr = untag_ptr(val);
55093         CHECK_ACCESS(val_ptr);
55094         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
55095         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
55096         LightningError_set_action(&this_ptr_conv, val_conv);
55097 }
55098
55099 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
55100         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
55101         void* action_arg_ptr = untag_ptr(action_arg);
55102         CHECK_ACCESS(action_arg_ptr);
55103         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
55104         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
55105         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
55106         uint64_t ret_ref = 0;
55107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55109         return ret_ref;
55110 }
55111
55112 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
55113         LDKLightningError ret_var = LightningError_clone(arg);
55114         uint64_t ret_ref = 0;
55115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55117         return ret_ref;
55118 }
55119 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
55120         LDKLightningError arg_conv;
55121         arg_conv.inner = untag_ptr(arg);
55122         arg_conv.is_owned = ptr_is_owned(arg);
55123         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55124         arg_conv.is_owned = false;
55125         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
55126         return ret_conv;
55127 }
55128
55129 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
55130         LDKLightningError orig_conv;
55131         orig_conv.inner = untag_ptr(orig);
55132         orig_conv.is_owned = ptr_is_owned(orig);
55133         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55134         orig_conv.is_owned = false;
55135         LDKLightningError ret_var = LightningError_clone(&orig_conv);
55136         uint64_t ret_ref = 0;
55137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55139         return ret_ref;
55140 }
55141
55142 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
55143         LDKCommitmentUpdate this_obj_conv;
55144         this_obj_conv.inner = untag_ptr(this_obj);
55145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55147         CommitmentUpdate_free(this_obj_conv);
55148 }
55149
55150 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
55151         LDKCommitmentUpdate this_ptr_conv;
55152         this_ptr_conv.inner = untag_ptr(this_ptr);
55153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55155         this_ptr_conv.is_owned = false;
55156         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
55157         uint64_tArray ret_arr = NULL;
55158         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55159         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55160         for (size_t p = 0; p < ret_var.datalen; p++) {
55161                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
55162                 uint64_t ret_conv_15_ref = 0;
55163                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
55164                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
55165                 ret_arr_ptr[p] = ret_conv_15_ref;
55166         }
55167         
55168         FREE(ret_var.data);
55169         return ret_arr;
55170 }
55171
55172 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
55173         LDKCommitmentUpdate this_ptr_conv;
55174         this_ptr_conv.inner = untag_ptr(this_ptr);
55175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55177         this_ptr_conv.is_owned = false;
55178         LDKCVec_UpdateAddHTLCZ val_constr;
55179         val_constr.datalen = val->arr_len;
55180         if (val_constr.datalen > 0)
55181                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55182         else
55183                 val_constr.data = NULL;
55184         uint64_t* val_vals = val->elems;
55185         for (size_t p = 0; p < val_constr.datalen; p++) {
55186                 uint64_t val_conv_15 = val_vals[p];
55187                 LDKUpdateAddHTLC val_conv_15_conv;
55188                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
55189                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
55190                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
55191                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
55192                 val_constr.data[p] = val_conv_15_conv;
55193         }
55194         FREE(val);
55195         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
55196 }
55197
55198 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
55199         LDKCommitmentUpdate this_ptr_conv;
55200         this_ptr_conv.inner = untag_ptr(this_ptr);
55201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55203         this_ptr_conv.is_owned = false;
55204         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
55205         uint64_tArray ret_arr = NULL;
55206         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55207         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55208         for (size_t t = 0; t < ret_var.datalen; t++) {
55209                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
55210                 uint64_t ret_conv_19_ref = 0;
55211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
55212                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
55213                 ret_arr_ptr[t] = ret_conv_19_ref;
55214         }
55215         
55216         FREE(ret_var.data);
55217         return ret_arr;
55218 }
55219
55220 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
55221         LDKCommitmentUpdate this_ptr_conv;
55222         this_ptr_conv.inner = untag_ptr(this_ptr);
55223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55225         this_ptr_conv.is_owned = false;
55226         LDKCVec_UpdateFulfillHTLCZ val_constr;
55227         val_constr.datalen = val->arr_len;
55228         if (val_constr.datalen > 0)
55229                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55230         else
55231                 val_constr.data = NULL;
55232         uint64_t* val_vals = val->elems;
55233         for (size_t t = 0; t < val_constr.datalen; t++) {
55234                 uint64_t val_conv_19 = val_vals[t];
55235                 LDKUpdateFulfillHTLC val_conv_19_conv;
55236                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
55237                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
55238                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
55239                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
55240                 val_constr.data[t] = val_conv_19_conv;
55241         }
55242         FREE(val);
55243         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
55244 }
55245
55246 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
55247         LDKCommitmentUpdate this_ptr_conv;
55248         this_ptr_conv.inner = untag_ptr(this_ptr);
55249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55251         this_ptr_conv.is_owned = false;
55252         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
55253         uint64_tArray ret_arr = NULL;
55254         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55255         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55256         for (size_t q = 0; q < ret_var.datalen; q++) {
55257                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
55258                 uint64_t ret_conv_16_ref = 0;
55259                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
55260                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
55261                 ret_arr_ptr[q] = ret_conv_16_ref;
55262         }
55263         
55264         FREE(ret_var.data);
55265         return ret_arr;
55266 }
55267
55268 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
55269         LDKCommitmentUpdate this_ptr_conv;
55270         this_ptr_conv.inner = untag_ptr(this_ptr);
55271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55273         this_ptr_conv.is_owned = false;
55274         LDKCVec_UpdateFailHTLCZ val_constr;
55275         val_constr.datalen = val->arr_len;
55276         if (val_constr.datalen > 0)
55277                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55278         else
55279                 val_constr.data = NULL;
55280         uint64_t* val_vals = val->elems;
55281         for (size_t q = 0; q < val_constr.datalen; q++) {
55282                 uint64_t val_conv_16 = val_vals[q];
55283                 LDKUpdateFailHTLC val_conv_16_conv;
55284                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
55285                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
55286                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
55287                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
55288                 val_constr.data[q] = val_conv_16_conv;
55289         }
55290         FREE(val);
55291         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
55292 }
55293
55294 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
55295         LDKCommitmentUpdate this_ptr_conv;
55296         this_ptr_conv.inner = untag_ptr(this_ptr);
55297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55299         this_ptr_conv.is_owned = false;
55300         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
55301         uint64_tArray ret_arr = NULL;
55302         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55303         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55304         for (size_t z = 0; z < ret_var.datalen; z++) {
55305                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
55306                 uint64_t ret_conv_25_ref = 0;
55307                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
55308                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
55309                 ret_arr_ptr[z] = ret_conv_25_ref;
55310         }
55311         
55312         FREE(ret_var.data);
55313         return ret_arr;
55314 }
55315
55316 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) {
55317         LDKCommitmentUpdate this_ptr_conv;
55318         this_ptr_conv.inner = untag_ptr(this_ptr);
55319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55321         this_ptr_conv.is_owned = false;
55322         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
55323         val_constr.datalen = val->arr_len;
55324         if (val_constr.datalen > 0)
55325                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55326         else
55327                 val_constr.data = NULL;
55328         uint64_t* val_vals = val->elems;
55329         for (size_t z = 0; z < val_constr.datalen; z++) {
55330                 uint64_t val_conv_25 = val_vals[z];
55331                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
55332                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
55333                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
55334                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
55335                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
55336                 val_constr.data[z] = val_conv_25_conv;
55337         }
55338         FREE(val);
55339         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
55340 }
55341
55342 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
55343         LDKCommitmentUpdate this_ptr_conv;
55344         this_ptr_conv.inner = untag_ptr(this_ptr);
55345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55347         this_ptr_conv.is_owned = false;
55348         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
55349         uint64_t ret_ref = 0;
55350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55352         return ret_ref;
55353 }
55354
55355 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
55356         LDKCommitmentUpdate this_ptr_conv;
55357         this_ptr_conv.inner = untag_ptr(this_ptr);
55358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55360         this_ptr_conv.is_owned = false;
55361         LDKUpdateFee val_conv;
55362         val_conv.inner = untag_ptr(val);
55363         val_conv.is_owned = ptr_is_owned(val);
55364         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55365         val_conv = UpdateFee_clone(&val_conv);
55366         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
55367 }
55368
55369 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
55370         LDKCommitmentUpdate this_ptr_conv;
55371         this_ptr_conv.inner = untag_ptr(this_ptr);
55372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55374         this_ptr_conv.is_owned = false;
55375         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
55376         uint64_t ret_ref = 0;
55377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55379         return ret_ref;
55380 }
55381
55382 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
55383         LDKCommitmentUpdate this_ptr_conv;
55384         this_ptr_conv.inner = untag_ptr(this_ptr);
55385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55387         this_ptr_conv.is_owned = false;
55388         LDKCommitmentSigned val_conv;
55389         val_conv.inner = untag_ptr(val);
55390         val_conv.is_owned = ptr_is_owned(val);
55391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55392         val_conv = CommitmentSigned_clone(&val_conv);
55393         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
55394 }
55395
55396 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) {
55397         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
55398         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
55399         if (update_add_htlcs_arg_constr.datalen > 0)
55400                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55401         else
55402                 update_add_htlcs_arg_constr.data = NULL;
55403         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
55404         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
55405                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
55406                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
55407                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
55408                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
55409                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
55410                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
55411                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
55412         }
55413         FREE(update_add_htlcs_arg);
55414         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
55415         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
55416         if (update_fulfill_htlcs_arg_constr.datalen > 0)
55417                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55418         else
55419                 update_fulfill_htlcs_arg_constr.data = NULL;
55420         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
55421         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
55422                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
55423                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
55424                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
55425                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
55426                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
55427                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
55428                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
55429         }
55430         FREE(update_fulfill_htlcs_arg);
55431         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
55432         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
55433         if (update_fail_htlcs_arg_constr.datalen > 0)
55434                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55435         else
55436                 update_fail_htlcs_arg_constr.data = NULL;
55437         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
55438         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
55439                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
55440                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
55441                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
55442                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
55443                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
55444                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
55445                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
55446         }
55447         FREE(update_fail_htlcs_arg);
55448         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
55449         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
55450         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
55451                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55452         else
55453                 update_fail_malformed_htlcs_arg_constr.data = NULL;
55454         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
55455         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
55456                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
55457                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
55458                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
55459                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
55460                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
55461                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
55462                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
55463         }
55464         FREE(update_fail_malformed_htlcs_arg);
55465         LDKUpdateFee update_fee_arg_conv;
55466         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
55467         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
55468         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
55469         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
55470         LDKCommitmentSigned commitment_signed_arg_conv;
55471         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
55472         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
55473         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
55474         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
55475         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);
55476         uint64_t ret_ref = 0;
55477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55479         return ret_ref;
55480 }
55481
55482 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
55483         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
55484         uint64_t ret_ref = 0;
55485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55487         return ret_ref;
55488 }
55489 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
55490         LDKCommitmentUpdate arg_conv;
55491         arg_conv.inner = untag_ptr(arg);
55492         arg_conv.is_owned = ptr_is_owned(arg);
55493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55494         arg_conv.is_owned = false;
55495         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
55496         return ret_conv;
55497 }
55498
55499 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
55500         LDKCommitmentUpdate orig_conv;
55501         orig_conv.inner = untag_ptr(orig);
55502         orig_conv.is_owned = ptr_is_owned(orig);
55503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55504         orig_conv.is_owned = false;
55505         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
55506         uint64_t ret_ref = 0;
55507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55509         return ret_ref;
55510 }
55511
55512 int64_t  __attribute__((export_name("TS_CommitmentUpdate_hash"))) TS_CommitmentUpdate_hash(uint64_t o) {
55513         LDKCommitmentUpdate o_conv;
55514         o_conv.inner = untag_ptr(o);
55515         o_conv.is_owned = ptr_is_owned(o);
55516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55517         o_conv.is_owned = false;
55518         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
55519         return ret_conv;
55520 }
55521
55522 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
55523         LDKCommitmentUpdate a_conv;
55524         a_conv.inner = untag_ptr(a);
55525         a_conv.is_owned = ptr_is_owned(a);
55526         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55527         a_conv.is_owned = false;
55528         LDKCommitmentUpdate b_conv;
55529         b_conv.inner = untag_ptr(b);
55530         b_conv.is_owned = ptr_is_owned(b);
55531         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55532         b_conv.is_owned = false;
55533         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
55534         return ret_conv;
55535 }
55536
55537 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
55538         if (!ptr_is_owned(this_ptr)) return;
55539         void* this_ptr_ptr = untag_ptr(this_ptr);
55540         CHECK_ACCESS(this_ptr_ptr);
55541         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
55542         FREE(untag_ptr(this_ptr));
55543         ChannelMessageHandler_free(this_ptr_conv);
55544 }
55545
55546 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
55547         if (!ptr_is_owned(this_ptr)) return;
55548         void* this_ptr_ptr = untag_ptr(this_ptr);
55549         CHECK_ACCESS(this_ptr_ptr);
55550         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
55551         FREE(untag_ptr(this_ptr));
55552         RoutingMessageHandler_free(this_ptr_conv);
55553 }
55554
55555 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
55556         if (!ptr_is_owned(this_ptr)) return;
55557         void* this_ptr_ptr = untag_ptr(this_ptr);
55558         CHECK_ACCESS(this_ptr_ptr);
55559         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
55560         FREE(untag_ptr(this_ptr));
55561         OnionMessageHandler_free(this_ptr_conv);
55562 }
55563
55564 void  __attribute__((export_name("TS_FinalOnionHopData_free"))) TS_FinalOnionHopData_free(uint64_t this_obj) {
55565         LDKFinalOnionHopData this_obj_conv;
55566         this_obj_conv.inner = untag_ptr(this_obj);
55567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55569         FinalOnionHopData_free(this_obj_conv);
55570 }
55571
55572 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_get_payment_secret"))) TS_FinalOnionHopData_get_payment_secret(uint64_t this_ptr) {
55573         LDKFinalOnionHopData this_ptr_conv;
55574         this_ptr_conv.inner = untag_ptr(this_ptr);
55575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55577         this_ptr_conv.is_owned = false;
55578         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55579         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
55580         return ret_arr;
55581 }
55582
55583 void  __attribute__((export_name("TS_FinalOnionHopData_set_payment_secret"))) TS_FinalOnionHopData_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
55584         LDKFinalOnionHopData this_ptr_conv;
55585         this_ptr_conv.inner = untag_ptr(this_ptr);
55586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55588         this_ptr_conv.is_owned = false;
55589         LDKThirtyTwoBytes val_ref;
55590         CHECK(val->arr_len == 32);
55591         memcpy(val_ref.data, val->elems, 32); FREE(val);
55592         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
55593 }
55594
55595 int64_t  __attribute__((export_name("TS_FinalOnionHopData_get_total_msat"))) TS_FinalOnionHopData_get_total_msat(uint64_t this_ptr) {
55596         LDKFinalOnionHopData this_ptr_conv;
55597         this_ptr_conv.inner = untag_ptr(this_ptr);
55598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55600         this_ptr_conv.is_owned = false;
55601         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
55602         return ret_conv;
55603 }
55604
55605 void  __attribute__((export_name("TS_FinalOnionHopData_set_total_msat"))) TS_FinalOnionHopData_set_total_msat(uint64_t this_ptr, int64_t val) {
55606         LDKFinalOnionHopData this_ptr_conv;
55607         this_ptr_conv.inner = untag_ptr(this_ptr);
55608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55610         this_ptr_conv.is_owned = false;
55611         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
55612 }
55613
55614 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_new"))) TS_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
55615         LDKThirtyTwoBytes payment_secret_arg_ref;
55616         CHECK(payment_secret_arg->arr_len == 32);
55617         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
55618         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
55619         uint64_t ret_ref = 0;
55620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55622         return ret_ref;
55623 }
55624
55625 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
55626         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
55627         uint64_t ret_ref = 0;
55628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55630         return ret_ref;
55631 }
55632 int64_t  __attribute__((export_name("TS_FinalOnionHopData_clone_ptr"))) TS_FinalOnionHopData_clone_ptr(uint64_t arg) {
55633         LDKFinalOnionHopData arg_conv;
55634         arg_conv.inner = untag_ptr(arg);
55635         arg_conv.is_owned = ptr_is_owned(arg);
55636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55637         arg_conv.is_owned = false;
55638         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
55639         return ret_conv;
55640 }
55641
55642 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_clone"))) TS_FinalOnionHopData_clone(uint64_t orig) {
55643         LDKFinalOnionHopData orig_conv;
55644         orig_conv.inner = untag_ptr(orig);
55645         orig_conv.is_owned = ptr_is_owned(orig);
55646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55647         orig_conv.is_owned = false;
55648         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
55649         uint64_t ret_ref = 0;
55650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55652         return ret_ref;
55653 }
55654
55655 void  __attribute__((export_name("TS_OnionPacket_free"))) TS_OnionPacket_free(uint64_t this_obj) {
55656         LDKOnionPacket this_obj_conv;
55657         this_obj_conv.inner = untag_ptr(this_obj);
55658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55660         OnionPacket_free(this_obj_conv);
55661 }
55662
55663 int8_t  __attribute__((export_name("TS_OnionPacket_get_version"))) TS_OnionPacket_get_version(uint64_t this_ptr) {
55664         LDKOnionPacket this_ptr_conv;
55665         this_ptr_conv.inner = untag_ptr(this_ptr);
55666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55668         this_ptr_conv.is_owned = false;
55669         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
55670         return ret_conv;
55671 }
55672
55673 void  __attribute__((export_name("TS_OnionPacket_set_version"))) TS_OnionPacket_set_version(uint64_t this_ptr, int8_t val) {
55674         LDKOnionPacket this_ptr_conv;
55675         this_ptr_conv.inner = untag_ptr(this_ptr);
55676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55678         this_ptr_conv.is_owned = false;
55679         OnionPacket_set_version(&this_ptr_conv, val);
55680 }
55681
55682 uint64_t  __attribute__((export_name("TS_OnionPacket_get_public_key"))) TS_OnionPacket_get_public_key(uint64_t this_ptr) {
55683         LDKOnionPacket this_ptr_conv;
55684         this_ptr_conv.inner = untag_ptr(this_ptr);
55685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55687         this_ptr_conv.is_owned = false;
55688         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
55689         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
55690         return tag_ptr(ret_conv, true);
55691 }
55692
55693 void  __attribute__((export_name("TS_OnionPacket_set_public_key"))) TS_OnionPacket_set_public_key(uint64_t this_ptr, uint64_t val) {
55694         LDKOnionPacket this_ptr_conv;
55695         this_ptr_conv.inner = untag_ptr(this_ptr);
55696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55698         this_ptr_conv.is_owned = false;
55699         void* val_ptr = untag_ptr(val);
55700         CHECK_ACCESS(val_ptr);
55701         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
55702         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
55703         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
55704 }
55705
55706 int8_tArray  __attribute__((export_name("TS_OnionPacket_get_hmac"))) TS_OnionPacket_get_hmac(uint64_t this_ptr) {
55707         LDKOnionPacket this_ptr_conv;
55708         this_ptr_conv.inner = untag_ptr(this_ptr);
55709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55711         this_ptr_conv.is_owned = false;
55712         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55713         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
55714         return ret_arr;
55715 }
55716
55717 void  __attribute__((export_name("TS_OnionPacket_set_hmac"))) TS_OnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
55718         LDKOnionPacket this_ptr_conv;
55719         this_ptr_conv.inner = untag_ptr(this_ptr);
55720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55722         this_ptr_conv.is_owned = false;
55723         LDKThirtyTwoBytes val_ref;
55724         CHECK(val->arr_len == 32);
55725         memcpy(val_ref.data, val->elems, 32); FREE(val);
55726         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
55727 }
55728
55729 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
55730         LDKOnionPacket ret_var = OnionPacket_clone(arg);
55731         uint64_t ret_ref = 0;
55732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55734         return ret_ref;
55735 }
55736 int64_t  __attribute__((export_name("TS_OnionPacket_clone_ptr"))) TS_OnionPacket_clone_ptr(uint64_t arg) {
55737         LDKOnionPacket arg_conv;
55738         arg_conv.inner = untag_ptr(arg);
55739         arg_conv.is_owned = ptr_is_owned(arg);
55740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55741         arg_conv.is_owned = false;
55742         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
55743         return ret_conv;
55744 }
55745
55746 uint64_t  __attribute__((export_name("TS_OnionPacket_clone"))) TS_OnionPacket_clone(uint64_t orig) {
55747         LDKOnionPacket orig_conv;
55748         orig_conv.inner = untag_ptr(orig);
55749         orig_conv.is_owned = ptr_is_owned(orig);
55750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55751         orig_conv.is_owned = false;
55752         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
55753         uint64_t ret_ref = 0;
55754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55756         return ret_ref;
55757 }
55758
55759 int64_t  __attribute__((export_name("TS_OnionPacket_hash"))) TS_OnionPacket_hash(uint64_t o) {
55760         LDKOnionPacket o_conv;
55761         o_conv.inner = untag_ptr(o);
55762         o_conv.is_owned = ptr_is_owned(o);
55763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55764         o_conv.is_owned = false;
55765         int64_t ret_conv = OnionPacket_hash(&o_conv);
55766         return ret_conv;
55767 }
55768
55769 jboolean  __attribute__((export_name("TS_OnionPacket_eq"))) TS_OnionPacket_eq(uint64_t a, uint64_t b) {
55770         LDKOnionPacket a_conv;
55771         a_conv.inner = untag_ptr(a);
55772         a_conv.is_owned = ptr_is_owned(a);
55773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55774         a_conv.is_owned = false;
55775         LDKOnionPacket b_conv;
55776         b_conv.inner = untag_ptr(b);
55777         b_conv.is_owned = ptr_is_owned(b);
55778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55779         b_conv.is_owned = false;
55780         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
55781         return ret_conv;
55782 }
55783
55784 void  __attribute__((export_name("TS_TrampolineOnionPacket_free"))) TS_TrampolineOnionPacket_free(uint64_t this_obj) {
55785         LDKTrampolineOnionPacket this_obj_conv;
55786         this_obj_conv.inner = untag_ptr(this_obj);
55787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55789         TrampolineOnionPacket_free(this_obj_conv);
55790 }
55791
55792 int8_t  __attribute__((export_name("TS_TrampolineOnionPacket_get_version"))) TS_TrampolineOnionPacket_get_version(uint64_t this_ptr) {
55793         LDKTrampolineOnionPacket this_ptr_conv;
55794         this_ptr_conv.inner = untag_ptr(this_ptr);
55795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55797         this_ptr_conv.is_owned = false;
55798         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
55799         return ret_conv;
55800 }
55801
55802 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_version"))) TS_TrampolineOnionPacket_set_version(uint64_t this_ptr, int8_t val) {
55803         LDKTrampolineOnionPacket this_ptr_conv;
55804         this_ptr_conv.inner = untag_ptr(this_ptr);
55805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55807         this_ptr_conv.is_owned = false;
55808         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
55809 }
55810
55811 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_public_key"))) TS_TrampolineOnionPacket_get_public_key(uint64_t this_ptr) {
55812         LDKTrampolineOnionPacket this_ptr_conv;
55813         this_ptr_conv.inner = untag_ptr(this_ptr);
55814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55816         this_ptr_conv.is_owned = false;
55817         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55818         memcpy(ret_arr->elems, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form, 33);
55819         return ret_arr;
55820 }
55821
55822 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_public_key"))) TS_TrampolineOnionPacket_set_public_key(uint64_t this_ptr, int8_tArray val) {
55823         LDKTrampolineOnionPacket this_ptr_conv;
55824         this_ptr_conv.inner = untag_ptr(this_ptr);
55825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55827         this_ptr_conv.is_owned = false;
55828         LDKPublicKey val_ref;
55829         CHECK(val->arr_len == 33);
55830         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
55831         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
55832 }
55833
55834 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_hop_data"))) TS_TrampolineOnionPacket_get_hop_data(uint64_t this_ptr) {
55835         LDKTrampolineOnionPacket this_ptr_conv;
55836         this_ptr_conv.inner = untag_ptr(this_ptr);
55837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55839         this_ptr_conv.is_owned = false;
55840         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
55841         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55842         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55843         CVec_u8Z_free(ret_var);
55844         return ret_arr;
55845 }
55846
55847 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_hop_data"))) TS_TrampolineOnionPacket_set_hop_data(uint64_t this_ptr, int8_tArray val) {
55848         LDKTrampolineOnionPacket this_ptr_conv;
55849         this_ptr_conv.inner = untag_ptr(this_ptr);
55850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55852         this_ptr_conv.is_owned = false;
55853         LDKCVec_u8Z val_ref;
55854         val_ref.datalen = val->arr_len;
55855         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
55856         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
55857         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
55858 }
55859
55860 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_get_hmac"))) TS_TrampolineOnionPacket_get_hmac(uint64_t this_ptr) {
55861         LDKTrampolineOnionPacket this_ptr_conv;
55862         this_ptr_conv.inner = untag_ptr(this_ptr);
55863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55865         this_ptr_conv.is_owned = false;
55866         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55867         memcpy(ret_arr->elems, *TrampolineOnionPacket_get_hmac(&this_ptr_conv), 32);
55868         return ret_arr;
55869 }
55870
55871 void  __attribute__((export_name("TS_TrampolineOnionPacket_set_hmac"))) TS_TrampolineOnionPacket_set_hmac(uint64_t this_ptr, int8_tArray val) {
55872         LDKTrampolineOnionPacket this_ptr_conv;
55873         this_ptr_conv.inner = untag_ptr(this_ptr);
55874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55876         this_ptr_conv.is_owned = false;
55877         LDKThirtyTwoBytes val_ref;
55878         CHECK(val->arr_len == 32);
55879         memcpy(val_ref.data, val->elems, 32); FREE(val);
55880         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
55881 }
55882
55883 uint64_t  __attribute__((export_name("TS_TrampolineOnionPacket_new"))) TS_TrampolineOnionPacket_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
55884         LDKPublicKey public_key_arg_ref;
55885         CHECK(public_key_arg->arr_len == 33);
55886         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
55887         LDKCVec_u8Z hop_data_arg_ref;
55888         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
55889         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
55890         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
55891         LDKThirtyTwoBytes hmac_arg_ref;
55892         CHECK(hmac_arg->arr_len == 32);
55893         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
55894         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
55895         uint64_t ret_ref = 0;
55896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55898         return ret_ref;
55899 }
55900
55901 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
55902         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
55903         uint64_t ret_ref = 0;
55904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55906         return ret_ref;
55907 }
55908 int64_t  __attribute__((export_name("TS_TrampolineOnionPacket_clone_ptr"))) TS_TrampolineOnionPacket_clone_ptr(uint64_t arg) {
55909         LDKTrampolineOnionPacket arg_conv;
55910         arg_conv.inner = untag_ptr(arg);
55911         arg_conv.is_owned = ptr_is_owned(arg);
55912         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55913         arg_conv.is_owned = false;
55914         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
55915         return ret_conv;
55916 }
55917
55918 uint64_t  __attribute__((export_name("TS_TrampolineOnionPacket_clone"))) TS_TrampolineOnionPacket_clone(uint64_t orig) {
55919         LDKTrampolineOnionPacket orig_conv;
55920         orig_conv.inner = untag_ptr(orig);
55921         orig_conv.is_owned = ptr_is_owned(orig);
55922         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55923         orig_conv.is_owned = false;
55924         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
55925         uint64_t ret_ref = 0;
55926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55928         return ret_ref;
55929 }
55930
55931 int64_t  __attribute__((export_name("TS_TrampolineOnionPacket_hash"))) TS_TrampolineOnionPacket_hash(uint64_t o) {
55932         LDKTrampolineOnionPacket o_conv;
55933         o_conv.inner = untag_ptr(o);
55934         o_conv.is_owned = ptr_is_owned(o);
55935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55936         o_conv.is_owned = false;
55937         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
55938         return ret_conv;
55939 }
55940
55941 jboolean  __attribute__((export_name("TS_TrampolineOnionPacket_eq"))) TS_TrampolineOnionPacket_eq(uint64_t a, uint64_t b) {
55942         LDKTrampolineOnionPacket a_conv;
55943         a_conv.inner = untag_ptr(a);
55944         a_conv.is_owned = ptr_is_owned(a);
55945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55946         a_conv.is_owned = false;
55947         LDKTrampolineOnionPacket b_conv;
55948         b_conv.inner = untag_ptr(b);
55949         b_conv.is_owned = ptr_is_owned(b);
55950         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55951         b_conv.is_owned = false;
55952         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
55953         return ret_conv;
55954 }
55955
55956 int8_tArray  __attribute__((export_name("TS_TrampolineOnionPacket_write"))) TS_TrampolineOnionPacket_write(uint64_t obj) {
55957         LDKTrampolineOnionPacket obj_conv;
55958         obj_conv.inner = untag_ptr(obj);
55959         obj_conv.is_owned = ptr_is_owned(obj);
55960         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55961         obj_conv.is_owned = false;
55962         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
55963         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55964         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55965         CVec_u8Z_free(ret_var);
55966         return ret_arr;
55967 }
55968
55969 jstring  __attribute__((export_name("TS_DecodeError_to_str"))) TS_DecodeError_to_str(uint64_t o) {
55970         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
55971         LDKStr ret_str = DecodeError_to_str(o_conv);
55972         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
55973         Str_free(ret_str);
55974         return ret_conv;
55975 }
55976
55977 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
55978         LDKAcceptChannel obj_conv;
55979         obj_conv.inner = untag_ptr(obj);
55980         obj_conv.is_owned = ptr_is_owned(obj);
55981         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55982         obj_conv.is_owned = false;
55983         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
55984         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55985         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55986         CVec_u8Z_free(ret_var);
55987         return ret_arr;
55988 }
55989
55990 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
55991         LDKu8slice ser_ref;
55992         ser_ref.datalen = ser->arr_len;
55993         ser_ref.data = ser->elems;
55994         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
55995         *ret_conv = AcceptChannel_read(ser_ref);
55996         FREE(ser);
55997         return tag_ptr(ret_conv, true);
55998 }
55999
56000 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
56001         LDKAcceptChannelV2 obj_conv;
56002         obj_conv.inner = untag_ptr(obj);
56003         obj_conv.is_owned = ptr_is_owned(obj);
56004         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56005         obj_conv.is_owned = false;
56006         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
56007         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56008         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56009         CVec_u8Z_free(ret_var);
56010         return ret_arr;
56011 }
56012
56013 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
56014         LDKu8slice ser_ref;
56015         ser_ref.datalen = ser->arr_len;
56016         ser_ref.data = ser->elems;
56017         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
56018         *ret_conv = AcceptChannelV2_read(ser_ref);
56019         FREE(ser);
56020         return tag_ptr(ret_conv, true);
56021 }
56022
56023 int8_tArray  __attribute__((export_name("TS_Stfu_write"))) TS_Stfu_write(uint64_t obj) {
56024         LDKStfu obj_conv;
56025         obj_conv.inner = untag_ptr(obj);
56026         obj_conv.is_owned = ptr_is_owned(obj);
56027         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56028         obj_conv.is_owned = false;
56029         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
56030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56032         CVec_u8Z_free(ret_var);
56033         return ret_arr;
56034 }
56035
56036 uint64_t  __attribute__((export_name("TS_Stfu_read"))) TS_Stfu_read(int8_tArray ser) {
56037         LDKu8slice ser_ref;
56038         ser_ref.datalen = ser->arr_len;
56039         ser_ref.data = ser->elems;
56040         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
56041         *ret_conv = Stfu_read(ser_ref);
56042         FREE(ser);
56043         return tag_ptr(ret_conv, true);
56044 }
56045
56046 int8_tArray  __attribute__((export_name("TS_Splice_write"))) TS_Splice_write(uint64_t obj) {
56047         LDKSplice obj_conv;
56048         obj_conv.inner = untag_ptr(obj);
56049         obj_conv.is_owned = ptr_is_owned(obj);
56050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56051         obj_conv.is_owned = false;
56052         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
56053         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56054         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56055         CVec_u8Z_free(ret_var);
56056         return ret_arr;
56057 }
56058
56059 uint64_t  __attribute__((export_name("TS_Splice_read"))) TS_Splice_read(int8_tArray ser) {
56060         LDKu8slice ser_ref;
56061         ser_ref.datalen = ser->arr_len;
56062         ser_ref.data = ser->elems;
56063         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
56064         *ret_conv = Splice_read(ser_ref);
56065         FREE(ser);
56066         return tag_ptr(ret_conv, true);
56067 }
56068
56069 int8_tArray  __attribute__((export_name("TS_SpliceAck_write"))) TS_SpliceAck_write(uint64_t obj) {
56070         LDKSpliceAck obj_conv;
56071         obj_conv.inner = untag_ptr(obj);
56072         obj_conv.is_owned = ptr_is_owned(obj);
56073         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56074         obj_conv.is_owned = false;
56075         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
56076         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56077         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56078         CVec_u8Z_free(ret_var);
56079         return ret_arr;
56080 }
56081
56082 uint64_t  __attribute__((export_name("TS_SpliceAck_read"))) TS_SpliceAck_read(int8_tArray ser) {
56083         LDKu8slice ser_ref;
56084         ser_ref.datalen = ser->arr_len;
56085         ser_ref.data = ser->elems;
56086         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
56087         *ret_conv = SpliceAck_read(ser_ref);
56088         FREE(ser);
56089         return tag_ptr(ret_conv, true);
56090 }
56091
56092 int8_tArray  __attribute__((export_name("TS_SpliceLocked_write"))) TS_SpliceLocked_write(uint64_t obj) {
56093         LDKSpliceLocked obj_conv;
56094         obj_conv.inner = untag_ptr(obj);
56095         obj_conv.is_owned = ptr_is_owned(obj);
56096         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56097         obj_conv.is_owned = false;
56098         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
56099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56101         CVec_u8Z_free(ret_var);
56102         return ret_arr;
56103 }
56104
56105 uint64_t  __attribute__((export_name("TS_SpliceLocked_read"))) TS_SpliceLocked_read(int8_tArray ser) {
56106         LDKu8slice ser_ref;
56107         ser_ref.datalen = ser->arr_len;
56108         ser_ref.data = ser->elems;
56109         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
56110         *ret_conv = SpliceLocked_read(ser_ref);
56111         FREE(ser);
56112         return tag_ptr(ret_conv, true);
56113 }
56114
56115 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
56116         LDKTxAddInput obj_conv;
56117         obj_conv.inner = untag_ptr(obj);
56118         obj_conv.is_owned = ptr_is_owned(obj);
56119         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56120         obj_conv.is_owned = false;
56121         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
56122         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56123         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56124         CVec_u8Z_free(ret_var);
56125         return ret_arr;
56126 }
56127
56128 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
56129         LDKu8slice ser_ref;
56130         ser_ref.datalen = ser->arr_len;
56131         ser_ref.data = ser->elems;
56132         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
56133         *ret_conv = TxAddInput_read(ser_ref);
56134         FREE(ser);
56135         return tag_ptr(ret_conv, true);
56136 }
56137
56138 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
56139         LDKTxAddOutput obj_conv;
56140         obj_conv.inner = untag_ptr(obj);
56141         obj_conv.is_owned = ptr_is_owned(obj);
56142         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56143         obj_conv.is_owned = false;
56144         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
56145         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56146         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56147         CVec_u8Z_free(ret_var);
56148         return ret_arr;
56149 }
56150
56151 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
56152         LDKu8slice ser_ref;
56153         ser_ref.datalen = ser->arr_len;
56154         ser_ref.data = ser->elems;
56155         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
56156         *ret_conv = TxAddOutput_read(ser_ref);
56157         FREE(ser);
56158         return tag_ptr(ret_conv, true);
56159 }
56160
56161 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
56162         LDKTxRemoveInput obj_conv;
56163         obj_conv.inner = untag_ptr(obj);
56164         obj_conv.is_owned = ptr_is_owned(obj);
56165         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56166         obj_conv.is_owned = false;
56167         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
56168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56170         CVec_u8Z_free(ret_var);
56171         return ret_arr;
56172 }
56173
56174 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
56175         LDKu8slice ser_ref;
56176         ser_ref.datalen = ser->arr_len;
56177         ser_ref.data = ser->elems;
56178         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
56179         *ret_conv = TxRemoveInput_read(ser_ref);
56180         FREE(ser);
56181         return tag_ptr(ret_conv, true);
56182 }
56183
56184 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
56185         LDKTxRemoveOutput obj_conv;
56186         obj_conv.inner = untag_ptr(obj);
56187         obj_conv.is_owned = ptr_is_owned(obj);
56188         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56189         obj_conv.is_owned = false;
56190         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
56191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56193         CVec_u8Z_free(ret_var);
56194         return ret_arr;
56195 }
56196
56197 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
56198         LDKu8slice ser_ref;
56199         ser_ref.datalen = ser->arr_len;
56200         ser_ref.data = ser->elems;
56201         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
56202         *ret_conv = TxRemoveOutput_read(ser_ref);
56203         FREE(ser);
56204         return tag_ptr(ret_conv, true);
56205 }
56206
56207 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
56208         LDKTxComplete obj_conv;
56209         obj_conv.inner = untag_ptr(obj);
56210         obj_conv.is_owned = ptr_is_owned(obj);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56212         obj_conv.is_owned = false;
56213         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
56214         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56215         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56216         CVec_u8Z_free(ret_var);
56217         return ret_arr;
56218 }
56219
56220 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
56221         LDKu8slice ser_ref;
56222         ser_ref.datalen = ser->arr_len;
56223         ser_ref.data = ser->elems;
56224         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
56225         *ret_conv = TxComplete_read(ser_ref);
56226         FREE(ser);
56227         return tag_ptr(ret_conv, true);
56228 }
56229
56230 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
56231         LDKTxSignatures obj_conv;
56232         obj_conv.inner = untag_ptr(obj);
56233         obj_conv.is_owned = ptr_is_owned(obj);
56234         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56235         obj_conv.is_owned = false;
56236         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
56237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56239         CVec_u8Z_free(ret_var);
56240         return ret_arr;
56241 }
56242
56243 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
56244         LDKu8slice ser_ref;
56245         ser_ref.datalen = ser->arr_len;
56246         ser_ref.data = ser->elems;
56247         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
56248         *ret_conv = TxSignatures_read(ser_ref);
56249         FREE(ser);
56250         return tag_ptr(ret_conv, true);
56251 }
56252
56253 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
56254         LDKTxInitRbf obj_conv;
56255         obj_conv.inner = untag_ptr(obj);
56256         obj_conv.is_owned = ptr_is_owned(obj);
56257         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56258         obj_conv.is_owned = false;
56259         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
56260         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56261         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56262         CVec_u8Z_free(ret_var);
56263         return ret_arr;
56264 }
56265
56266 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
56267         LDKu8slice ser_ref;
56268         ser_ref.datalen = ser->arr_len;
56269         ser_ref.data = ser->elems;
56270         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
56271         *ret_conv = TxInitRbf_read(ser_ref);
56272         FREE(ser);
56273         return tag_ptr(ret_conv, true);
56274 }
56275
56276 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
56277         LDKTxAckRbf obj_conv;
56278         obj_conv.inner = untag_ptr(obj);
56279         obj_conv.is_owned = ptr_is_owned(obj);
56280         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56281         obj_conv.is_owned = false;
56282         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
56283         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56284         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56285         CVec_u8Z_free(ret_var);
56286         return ret_arr;
56287 }
56288
56289 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
56290         LDKu8slice ser_ref;
56291         ser_ref.datalen = ser->arr_len;
56292         ser_ref.data = ser->elems;
56293         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
56294         *ret_conv = TxAckRbf_read(ser_ref);
56295         FREE(ser);
56296         return tag_ptr(ret_conv, true);
56297 }
56298
56299 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
56300         LDKTxAbort obj_conv;
56301         obj_conv.inner = untag_ptr(obj);
56302         obj_conv.is_owned = ptr_is_owned(obj);
56303         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56304         obj_conv.is_owned = false;
56305         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
56306         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56307         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56308         CVec_u8Z_free(ret_var);
56309         return ret_arr;
56310 }
56311
56312 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
56313         LDKu8slice ser_ref;
56314         ser_ref.datalen = ser->arr_len;
56315         ser_ref.data = ser->elems;
56316         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
56317         *ret_conv = TxAbort_read(ser_ref);
56318         FREE(ser);
56319         return tag_ptr(ret_conv, true);
56320 }
56321
56322 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
56323         LDKAnnouncementSignatures obj_conv;
56324         obj_conv.inner = untag_ptr(obj);
56325         obj_conv.is_owned = ptr_is_owned(obj);
56326         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56327         obj_conv.is_owned = false;
56328         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
56329         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56330         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56331         CVec_u8Z_free(ret_var);
56332         return ret_arr;
56333 }
56334
56335 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
56336         LDKu8slice ser_ref;
56337         ser_ref.datalen = ser->arr_len;
56338         ser_ref.data = ser->elems;
56339         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
56340         *ret_conv = AnnouncementSignatures_read(ser_ref);
56341         FREE(ser);
56342         return tag_ptr(ret_conv, true);
56343 }
56344
56345 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
56346         LDKChannelReestablish obj_conv;
56347         obj_conv.inner = untag_ptr(obj);
56348         obj_conv.is_owned = ptr_is_owned(obj);
56349         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56350         obj_conv.is_owned = false;
56351         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
56352         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56353         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56354         CVec_u8Z_free(ret_var);
56355         return ret_arr;
56356 }
56357
56358 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
56359         LDKu8slice ser_ref;
56360         ser_ref.datalen = ser->arr_len;
56361         ser_ref.data = ser->elems;
56362         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
56363         *ret_conv = ChannelReestablish_read(ser_ref);
56364         FREE(ser);
56365         return tag_ptr(ret_conv, true);
56366 }
56367
56368 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
56369         LDKClosingSigned obj_conv;
56370         obj_conv.inner = untag_ptr(obj);
56371         obj_conv.is_owned = ptr_is_owned(obj);
56372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56373         obj_conv.is_owned = false;
56374         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
56375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56377         CVec_u8Z_free(ret_var);
56378         return ret_arr;
56379 }
56380
56381 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
56382         LDKu8slice ser_ref;
56383         ser_ref.datalen = ser->arr_len;
56384         ser_ref.data = ser->elems;
56385         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
56386         *ret_conv = ClosingSigned_read(ser_ref);
56387         FREE(ser);
56388         return tag_ptr(ret_conv, true);
56389 }
56390
56391 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
56392         LDKClosingSignedFeeRange obj_conv;
56393         obj_conv.inner = untag_ptr(obj);
56394         obj_conv.is_owned = ptr_is_owned(obj);
56395         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56396         obj_conv.is_owned = false;
56397         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
56398         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56399         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56400         CVec_u8Z_free(ret_var);
56401         return ret_arr;
56402 }
56403
56404 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
56405         LDKu8slice ser_ref;
56406         ser_ref.datalen = ser->arr_len;
56407         ser_ref.data = ser->elems;
56408         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
56409         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
56410         FREE(ser);
56411         return tag_ptr(ret_conv, true);
56412 }
56413
56414 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
56415         LDKCommitmentSigned obj_conv;
56416         obj_conv.inner = untag_ptr(obj);
56417         obj_conv.is_owned = ptr_is_owned(obj);
56418         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56419         obj_conv.is_owned = false;
56420         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
56421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56423         CVec_u8Z_free(ret_var);
56424         return ret_arr;
56425 }
56426
56427 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
56428         LDKu8slice ser_ref;
56429         ser_ref.datalen = ser->arr_len;
56430         ser_ref.data = ser->elems;
56431         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
56432         *ret_conv = CommitmentSigned_read(ser_ref);
56433         FREE(ser);
56434         return tag_ptr(ret_conv, true);
56435 }
56436
56437 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
56438         LDKFundingCreated obj_conv;
56439         obj_conv.inner = untag_ptr(obj);
56440         obj_conv.is_owned = ptr_is_owned(obj);
56441         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56442         obj_conv.is_owned = false;
56443         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
56444         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56445         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56446         CVec_u8Z_free(ret_var);
56447         return ret_arr;
56448 }
56449
56450 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
56451         LDKu8slice ser_ref;
56452         ser_ref.datalen = ser->arr_len;
56453         ser_ref.data = ser->elems;
56454         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
56455         *ret_conv = FundingCreated_read(ser_ref);
56456         FREE(ser);
56457         return tag_ptr(ret_conv, true);
56458 }
56459
56460 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
56461         LDKFundingSigned obj_conv;
56462         obj_conv.inner = untag_ptr(obj);
56463         obj_conv.is_owned = ptr_is_owned(obj);
56464         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56465         obj_conv.is_owned = false;
56466         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
56467         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56468         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56469         CVec_u8Z_free(ret_var);
56470         return ret_arr;
56471 }
56472
56473 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
56474         LDKu8slice ser_ref;
56475         ser_ref.datalen = ser->arr_len;
56476         ser_ref.data = ser->elems;
56477         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
56478         *ret_conv = FundingSigned_read(ser_ref);
56479         FREE(ser);
56480         return tag_ptr(ret_conv, true);
56481 }
56482
56483 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
56484         LDKChannelReady obj_conv;
56485         obj_conv.inner = untag_ptr(obj);
56486         obj_conv.is_owned = ptr_is_owned(obj);
56487         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56488         obj_conv.is_owned = false;
56489         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
56490         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56491         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56492         CVec_u8Z_free(ret_var);
56493         return ret_arr;
56494 }
56495
56496 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
56497         LDKu8slice ser_ref;
56498         ser_ref.datalen = ser->arr_len;
56499         ser_ref.data = ser->elems;
56500         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
56501         *ret_conv = ChannelReady_read(ser_ref);
56502         FREE(ser);
56503         return tag_ptr(ret_conv, true);
56504 }
56505
56506 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
56507         LDKInit obj_conv;
56508         obj_conv.inner = untag_ptr(obj);
56509         obj_conv.is_owned = ptr_is_owned(obj);
56510         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56511         obj_conv.is_owned = false;
56512         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
56513         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56514         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56515         CVec_u8Z_free(ret_var);
56516         return ret_arr;
56517 }
56518
56519 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
56520         LDKu8slice ser_ref;
56521         ser_ref.datalen = ser->arr_len;
56522         ser_ref.data = ser->elems;
56523         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
56524         *ret_conv = Init_read(ser_ref);
56525         FREE(ser);
56526         return tag_ptr(ret_conv, true);
56527 }
56528
56529 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
56530         LDKOpenChannel obj_conv;
56531         obj_conv.inner = untag_ptr(obj);
56532         obj_conv.is_owned = ptr_is_owned(obj);
56533         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56534         obj_conv.is_owned = false;
56535         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
56536         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56537         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56538         CVec_u8Z_free(ret_var);
56539         return ret_arr;
56540 }
56541
56542 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
56543         LDKu8slice ser_ref;
56544         ser_ref.datalen = ser->arr_len;
56545         ser_ref.data = ser->elems;
56546         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
56547         *ret_conv = OpenChannel_read(ser_ref);
56548         FREE(ser);
56549         return tag_ptr(ret_conv, true);
56550 }
56551
56552 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
56553         LDKOpenChannelV2 obj_conv;
56554         obj_conv.inner = untag_ptr(obj);
56555         obj_conv.is_owned = ptr_is_owned(obj);
56556         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56557         obj_conv.is_owned = false;
56558         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
56559         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56560         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56561         CVec_u8Z_free(ret_var);
56562         return ret_arr;
56563 }
56564
56565 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
56566         LDKu8slice ser_ref;
56567         ser_ref.datalen = ser->arr_len;
56568         ser_ref.data = ser->elems;
56569         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
56570         *ret_conv = OpenChannelV2_read(ser_ref);
56571         FREE(ser);
56572         return tag_ptr(ret_conv, true);
56573 }
56574
56575 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
56576         LDKRevokeAndACK obj_conv;
56577         obj_conv.inner = untag_ptr(obj);
56578         obj_conv.is_owned = ptr_is_owned(obj);
56579         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56580         obj_conv.is_owned = false;
56581         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
56582         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56583         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56584         CVec_u8Z_free(ret_var);
56585         return ret_arr;
56586 }
56587
56588 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
56589         LDKu8slice ser_ref;
56590         ser_ref.datalen = ser->arr_len;
56591         ser_ref.data = ser->elems;
56592         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
56593         *ret_conv = RevokeAndACK_read(ser_ref);
56594         FREE(ser);
56595         return tag_ptr(ret_conv, true);
56596 }
56597
56598 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
56599         LDKShutdown obj_conv;
56600         obj_conv.inner = untag_ptr(obj);
56601         obj_conv.is_owned = ptr_is_owned(obj);
56602         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56603         obj_conv.is_owned = false;
56604         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
56605         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56606         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56607         CVec_u8Z_free(ret_var);
56608         return ret_arr;
56609 }
56610
56611 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
56612         LDKu8slice ser_ref;
56613         ser_ref.datalen = ser->arr_len;
56614         ser_ref.data = ser->elems;
56615         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
56616         *ret_conv = Shutdown_read(ser_ref);
56617         FREE(ser);
56618         return tag_ptr(ret_conv, true);
56619 }
56620
56621 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
56622         LDKUpdateFailHTLC obj_conv;
56623         obj_conv.inner = untag_ptr(obj);
56624         obj_conv.is_owned = ptr_is_owned(obj);
56625         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56626         obj_conv.is_owned = false;
56627         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
56628         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56629         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56630         CVec_u8Z_free(ret_var);
56631         return ret_arr;
56632 }
56633
56634 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
56635         LDKu8slice ser_ref;
56636         ser_ref.datalen = ser->arr_len;
56637         ser_ref.data = ser->elems;
56638         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
56639         *ret_conv = UpdateFailHTLC_read(ser_ref);
56640         FREE(ser);
56641         return tag_ptr(ret_conv, true);
56642 }
56643
56644 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
56645         LDKUpdateFailMalformedHTLC obj_conv;
56646         obj_conv.inner = untag_ptr(obj);
56647         obj_conv.is_owned = ptr_is_owned(obj);
56648         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56649         obj_conv.is_owned = false;
56650         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
56651         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56652         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56653         CVec_u8Z_free(ret_var);
56654         return ret_arr;
56655 }
56656
56657 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
56658         LDKu8slice ser_ref;
56659         ser_ref.datalen = ser->arr_len;
56660         ser_ref.data = ser->elems;
56661         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
56662         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
56663         FREE(ser);
56664         return tag_ptr(ret_conv, true);
56665 }
56666
56667 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
56668         LDKUpdateFee obj_conv;
56669         obj_conv.inner = untag_ptr(obj);
56670         obj_conv.is_owned = ptr_is_owned(obj);
56671         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56672         obj_conv.is_owned = false;
56673         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
56674         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56675         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56676         CVec_u8Z_free(ret_var);
56677         return ret_arr;
56678 }
56679
56680 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
56681         LDKu8slice ser_ref;
56682         ser_ref.datalen = ser->arr_len;
56683         ser_ref.data = ser->elems;
56684         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
56685         *ret_conv = UpdateFee_read(ser_ref);
56686         FREE(ser);
56687         return tag_ptr(ret_conv, true);
56688 }
56689
56690 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
56691         LDKUpdateFulfillHTLC obj_conv;
56692         obj_conv.inner = untag_ptr(obj);
56693         obj_conv.is_owned = ptr_is_owned(obj);
56694         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56695         obj_conv.is_owned = false;
56696         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
56697         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56698         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56699         CVec_u8Z_free(ret_var);
56700         return ret_arr;
56701 }
56702
56703 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
56704         LDKu8slice ser_ref;
56705         ser_ref.datalen = ser->arr_len;
56706         ser_ref.data = ser->elems;
56707         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
56708         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
56709         FREE(ser);
56710         return tag_ptr(ret_conv, true);
56711 }
56712
56713 int8_tArray  __attribute__((export_name("TS_OnionPacket_write"))) TS_OnionPacket_write(uint64_t obj) {
56714         LDKOnionPacket obj_conv;
56715         obj_conv.inner = untag_ptr(obj);
56716         obj_conv.is_owned = ptr_is_owned(obj);
56717         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56718         obj_conv.is_owned = false;
56719         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
56720         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56721         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56722         CVec_u8Z_free(ret_var);
56723         return ret_arr;
56724 }
56725
56726 uint64_t  __attribute__((export_name("TS_OnionPacket_read"))) TS_OnionPacket_read(int8_tArray ser) {
56727         LDKu8slice ser_ref;
56728         ser_ref.datalen = ser->arr_len;
56729         ser_ref.data = ser->elems;
56730         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
56731         *ret_conv = OnionPacket_read(ser_ref);
56732         FREE(ser);
56733         return tag_ptr(ret_conv, true);
56734 }
56735
56736 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
56737         LDKUpdateAddHTLC obj_conv;
56738         obj_conv.inner = untag_ptr(obj);
56739         obj_conv.is_owned = ptr_is_owned(obj);
56740         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56741         obj_conv.is_owned = false;
56742         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
56743         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56744         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56745         CVec_u8Z_free(ret_var);
56746         return ret_arr;
56747 }
56748
56749 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
56750         LDKu8slice ser_ref;
56751         ser_ref.datalen = ser->arr_len;
56752         ser_ref.data = ser->elems;
56753         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
56754         *ret_conv = UpdateAddHTLC_read(ser_ref);
56755         FREE(ser);
56756         return tag_ptr(ret_conv, true);
56757 }
56758
56759 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
56760         LDKu8slice ser_ref;
56761         ser_ref.datalen = ser->arr_len;
56762         ser_ref.data = ser->elems;
56763         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
56764         *ret_conv = OnionMessage_read(ser_ref);
56765         FREE(ser);
56766         return tag_ptr(ret_conv, true);
56767 }
56768
56769 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
56770         LDKOnionMessage obj_conv;
56771         obj_conv.inner = untag_ptr(obj);
56772         obj_conv.is_owned = ptr_is_owned(obj);
56773         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56774         obj_conv.is_owned = false;
56775         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
56776         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56777         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56778         CVec_u8Z_free(ret_var);
56779         return ret_arr;
56780 }
56781
56782 int8_tArray  __attribute__((export_name("TS_FinalOnionHopData_write"))) TS_FinalOnionHopData_write(uint64_t obj) {
56783         LDKFinalOnionHopData obj_conv;
56784         obj_conv.inner = untag_ptr(obj);
56785         obj_conv.is_owned = ptr_is_owned(obj);
56786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56787         obj_conv.is_owned = false;
56788         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
56789         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56790         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56791         CVec_u8Z_free(ret_var);
56792         return ret_arr;
56793 }
56794
56795 uint64_t  __attribute__((export_name("TS_FinalOnionHopData_read"))) TS_FinalOnionHopData_read(int8_tArray ser) {
56796         LDKu8slice ser_ref;
56797         ser_ref.datalen = ser->arr_len;
56798         ser_ref.data = ser->elems;
56799         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
56800         *ret_conv = FinalOnionHopData_read(ser_ref);
56801         FREE(ser);
56802         return tag_ptr(ret_conv, true);
56803 }
56804
56805 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
56806         LDKPing obj_conv;
56807         obj_conv.inner = untag_ptr(obj);
56808         obj_conv.is_owned = ptr_is_owned(obj);
56809         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56810         obj_conv.is_owned = false;
56811         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
56812         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56813         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56814         CVec_u8Z_free(ret_var);
56815         return ret_arr;
56816 }
56817
56818 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
56819         LDKu8slice ser_ref;
56820         ser_ref.datalen = ser->arr_len;
56821         ser_ref.data = ser->elems;
56822         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
56823         *ret_conv = Ping_read(ser_ref);
56824         FREE(ser);
56825         return tag_ptr(ret_conv, true);
56826 }
56827
56828 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
56829         LDKPong obj_conv;
56830         obj_conv.inner = untag_ptr(obj);
56831         obj_conv.is_owned = ptr_is_owned(obj);
56832         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56833         obj_conv.is_owned = false;
56834         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
56835         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56836         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56837         CVec_u8Z_free(ret_var);
56838         return ret_arr;
56839 }
56840
56841 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
56842         LDKu8slice ser_ref;
56843         ser_ref.datalen = ser->arr_len;
56844         ser_ref.data = ser->elems;
56845         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
56846         *ret_conv = Pong_read(ser_ref);
56847         FREE(ser);
56848         return tag_ptr(ret_conv, true);
56849 }
56850
56851 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
56852         LDKUnsignedChannelAnnouncement obj_conv;
56853         obj_conv.inner = untag_ptr(obj);
56854         obj_conv.is_owned = ptr_is_owned(obj);
56855         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56856         obj_conv.is_owned = false;
56857         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
56858         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56859         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56860         CVec_u8Z_free(ret_var);
56861         return ret_arr;
56862 }
56863
56864 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
56865         LDKu8slice ser_ref;
56866         ser_ref.datalen = ser->arr_len;
56867         ser_ref.data = ser->elems;
56868         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
56869         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
56870         FREE(ser);
56871         return tag_ptr(ret_conv, true);
56872 }
56873
56874 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
56875         LDKChannelAnnouncement obj_conv;
56876         obj_conv.inner = untag_ptr(obj);
56877         obj_conv.is_owned = ptr_is_owned(obj);
56878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56879         obj_conv.is_owned = false;
56880         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
56881         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56882         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56883         CVec_u8Z_free(ret_var);
56884         return ret_arr;
56885 }
56886
56887 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
56888         LDKu8slice ser_ref;
56889         ser_ref.datalen = ser->arr_len;
56890         ser_ref.data = ser->elems;
56891         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
56892         *ret_conv = ChannelAnnouncement_read(ser_ref);
56893         FREE(ser);
56894         return tag_ptr(ret_conv, true);
56895 }
56896
56897 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
56898         LDKUnsignedChannelUpdate obj_conv;
56899         obj_conv.inner = untag_ptr(obj);
56900         obj_conv.is_owned = ptr_is_owned(obj);
56901         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56902         obj_conv.is_owned = false;
56903         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
56904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56906         CVec_u8Z_free(ret_var);
56907         return ret_arr;
56908 }
56909
56910 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
56911         LDKu8slice ser_ref;
56912         ser_ref.datalen = ser->arr_len;
56913         ser_ref.data = ser->elems;
56914         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
56915         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
56916         FREE(ser);
56917         return tag_ptr(ret_conv, true);
56918 }
56919
56920 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
56921         LDKChannelUpdate obj_conv;
56922         obj_conv.inner = untag_ptr(obj);
56923         obj_conv.is_owned = ptr_is_owned(obj);
56924         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56925         obj_conv.is_owned = false;
56926         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
56927         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56928         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56929         CVec_u8Z_free(ret_var);
56930         return ret_arr;
56931 }
56932
56933 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
56934         LDKu8slice ser_ref;
56935         ser_ref.datalen = ser->arr_len;
56936         ser_ref.data = ser->elems;
56937         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
56938         *ret_conv = ChannelUpdate_read(ser_ref);
56939         FREE(ser);
56940         return tag_ptr(ret_conv, true);
56941 }
56942
56943 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
56944         LDKErrorMessage obj_conv;
56945         obj_conv.inner = untag_ptr(obj);
56946         obj_conv.is_owned = ptr_is_owned(obj);
56947         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56948         obj_conv.is_owned = false;
56949         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
56950         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56951         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56952         CVec_u8Z_free(ret_var);
56953         return ret_arr;
56954 }
56955
56956 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
56957         LDKu8slice ser_ref;
56958         ser_ref.datalen = ser->arr_len;
56959         ser_ref.data = ser->elems;
56960         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
56961         *ret_conv = ErrorMessage_read(ser_ref);
56962         FREE(ser);
56963         return tag_ptr(ret_conv, true);
56964 }
56965
56966 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
56967         LDKWarningMessage obj_conv;
56968         obj_conv.inner = untag_ptr(obj);
56969         obj_conv.is_owned = ptr_is_owned(obj);
56970         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56971         obj_conv.is_owned = false;
56972         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
56973         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56974         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56975         CVec_u8Z_free(ret_var);
56976         return ret_arr;
56977 }
56978
56979 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
56980         LDKu8slice ser_ref;
56981         ser_ref.datalen = ser->arr_len;
56982         ser_ref.data = ser->elems;
56983         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
56984         *ret_conv = WarningMessage_read(ser_ref);
56985         FREE(ser);
56986         return tag_ptr(ret_conv, true);
56987 }
56988
56989 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
56990         LDKUnsignedNodeAnnouncement obj_conv;
56991         obj_conv.inner = untag_ptr(obj);
56992         obj_conv.is_owned = ptr_is_owned(obj);
56993         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56994         obj_conv.is_owned = false;
56995         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
56996         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56997         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56998         CVec_u8Z_free(ret_var);
56999         return ret_arr;
57000 }
57001
57002 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
57003         LDKu8slice ser_ref;
57004         ser_ref.datalen = ser->arr_len;
57005         ser_ref.data = ser->elems;
57006         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
57007         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
57008         FREE(ser);
57009         return tag_ptr(ret_conv, true);
57010 }
57011
57012 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
57013         LDKNodeAnnouncement obj_conv;
57014         obj_conv.inner = untag_ptr(obj);
57015         obj_conv.is_owned = ptr_is_owned(obj);
57016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57017         obj_conv.is_owned = false;
57018         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
57019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57021         CVec_u8Z_free(ret_var);
57022         return ret_arr;
57023 }
57024
57025 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
57026         LDKu8slice ser_ref;
57027         ser_ref.datalen = ser->arr_len;
57028         ser_ref.data = ser->elems;
57029         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
57030         *ret_conv = NodeAnnouncement_read(ser_ref);
57031         FREE(ser);
57032         return tag_ptr(ret_conv, true);
57033 }
57034
57035 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
57036         LDKu8slice ser_ref;
57037         ser_ref.datalen = ser->arr_len;
57038         ser_ref.data = ser->elems;
57039         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
57040         *ret_conv = QueryShortChannelIds_read(ser_ref);
57041         FREE(ser);
57042         return tag_ptr(ret_conv, true);
57043 }
57044
57045 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
57046         LDKQueryShortChannelIds obj_conv;
57047         obj_conv.inner = untag_ptr(obj);
57048         obj_conv.is_owned = ptr_is_owned(obj);
57049         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57050         obj_conv.is_owned = false;
57051         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
57052         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57053         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57054         CVec_u8Z_free(ret_var);
57055         return ret_arr;
57056 }
57057
57058 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
57059         LDKReplyShortChannelIdsEnd obj_conv;
57060         obj_conv.inner = untag_ptr(obj);
57061         obj_conv.is_owned = ptr_is_owned(obj);
57062         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57063         obj_conv.is_owned = false;
57064         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
57065         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57066         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57067         CVec_u8Z_free(ret_var);
57068         return ret_arr;
57069 }
57070
57071 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
57072         LDKu8slice ser_ref;
57073         ser_ref.datalen = ser->arr_len;
57074         ser_ref.data = ser->elems;
57075         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
57076         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
57077         FREE(ser);
57078         return tag_ptr(ret_conv, true);
57079 }
57080
57081 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
57082         LDKQueryChannelRange this_arg_conv;
57083         this_arg_conv.inner = untag_ptr(this_arg);
57084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57086         this_arg_conv.is_owned = false;
57087         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
57088         return ret_conv;
57089 }
57090
57091 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
57092         LDKQueryChannelRange obj_conv;
57093         obj_conv.inner = untag_ptr(obj);
57094         obj_conv.is_owned = ptr_is_owned(obj);
57095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57096         obj_conv.is_owned = false;
57097         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
57098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57100         CVec_u8Z_free(ret_var);
57101         return ret_arr;
57102 }
57103
57104 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
57105         LDKu8slice ser_ref;
57106         ser_ref.datalen = ser->arr_len;
57107         ser_ref.data = ser->elems;
57108         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
57109         *ret_conv = QueryChannelRange_read(ser_ref);
57110         FREE(ser);
57111         return tag_ptr(ret_conv, true);
57112 }
57113
57114 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
57115         LDKu8slice ser_ref;
57116         ser_ref.datalen = ser->arr_len;
57117         ser_ref.data = ser->elems;
57118         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
57119         *ret_conv = ReplyChannelRange_read(ser_ref);
57120         FREE(ser);
57121         return tag_ptr(ret_conv, true);
57122 }
57123
57124 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
57125         LDKReplyChannelRange obj_conv;
57126         obj_conv.inner = untag_ptr(obj);
57127         obj_conv.is_owned = ptr_is_owned(obj);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57129         obj_conv.is_owned = false;
57130         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
57131         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57132         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57133         CVec_u8Z_free(ret_var);
57134         return ret_arr;
57135 }
57136
57137 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
57138         LDKGossipTimestampFilter obj_conv;
57139         obj_conv.inner = untag_ptr(obj);
57140         obj_conv.is_owned = ptr_is_owned(obj);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57142         obj_conv.is_owned = false;
57143         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
57144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57146         CVec_u8Z_free(ret_var);
57147         return ret_arr;
57148 }
57149
57150 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
57151         LDKu8slice ser_ref;
57152         ser_ref.datalen = ser->arr_len;
57153         ser_ref.data = ser->elems;
57154         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
57155         *ret_conv = GossipTimestampFilter_read(ser_ref);
57156         FREE(ser);
57157         return tag_ptr(ret_conv, true);
57158 }
57159
57160 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
57161         if (!ptr_is_owned(this_ptr)) return;
57162         void* this_ptr_ptr = untag_ptr(this_ptr);
57163         CHECK_ACCESS(this_ptr_ptr);
57164         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
57165         FREE(untag_ptr(this_ptr));
57166         CustomMessageHandler_free(this_ptr_conv);
57167 }
57168
57169 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
57170         LDKIgnoringMessageHandler this_obj_conv;
57171         this_obj_conv.inner = untag_ptr(this_obj);
57172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57174         IgnoringMessageHandler_free(this_obj_conv);
57175 }
57176
57177 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
57178         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
57179         uint64_t ret_ref = 0;
57180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57182         return ret_ref;
57183 }
57184
57185 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_EventsProvider"))) TS_IgnoringMessageHandler_as_EventsProvider(uint64_t this_arg) {
57186         LDKIgnoringMessageHandler 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         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
57192         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
57193         return tag_ptr(ret_ret, true);
57194 }
57195
57196 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
57197         LDKIgnoringMessageHandler this_arg_conv;
57198         this_arg_conv.inner = untag_ptr(this_arg);
57199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57201         this_arg_conv.is_owned = false;
57202         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57203         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57204         return tag_ptr(ret_ret, true);
57205 }
57206
57207 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
57208         LDKIgnoringMessageHandler this_arg_conv;
57209         this_arg_conv.inner = untag_ptr(this_arg);
57210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57212         this_arg_conv.is_owned = false;
57213         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
57214         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
57215         return tag_ptr(ret_ret, true);
57216 }
57217
57218 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
57219         LDKIgnoringMessageHandler this_arg_conv;
57220         this_arg_conv.inner = untag_ptr(this_arg);
57221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57223         this_arg_conv.is_owned = false;
57224         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
57225         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
57226         return tag_ptr(ret_ret, true);
57227 }
57228
57229 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
57230         LDKIgnoringMessageHandler this_arg_conv;
57231         this_arg_conv.inner = untag_ptr(this_arg);
57232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57234         this_arg_conv.is_owned = false;
57235         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
57236         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
57237         return tag_ptr(ret_ret, true);
57238 }
57239
57240 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
57241         LDKIgnoringMessageHandler this_arg_conv;
57242         this_arg_conv.inner = untag_ptr(this_arg);
57243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57245         this_arg_conv.is_owned = false;
57246         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
57247         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
57248         return tag_ptr(ret_ret, true);
57249 }
57250
57251 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
57252         LDKIgnoringMessageHandler this_arg_conv;
57253         this_arg_conv.inner = untag_ptr(this_arg);
57254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57256         this_arg_conv.is_owned = false;
57257         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
57258         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
57259         return tag_ptr(ret_ret, true);
57260 }
57261
57262 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
57263         LDKIgnoringMessageHandler this_arg_conv;
57264         this_arg_conv.inner = untag_ptr(this_arg);
57265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57267         this_arg_conv.is_owned = false;
57268         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
57269         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
57270         return tag_ptr(ret_ret, true);
57271 }
57272
57273 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
57274         LDKErroringMessageHandler this_obj_conv;
57275         this_obj_conv.inner = untag_ptr(this_obj);
57276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57278         ErroringMessageHandler_free(this_obj_conv);
57279 }
57280
57281 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
57282         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
57283         uint64_t ret_ref = 0;
57284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57286         return ret_ref;
57287 }
57288
57289 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
57290         LDKErroringMessageHandler this_arg_conv;
57291         this_arg_conv.inner = untag_ptr(this_arg);
57292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57294         this_arg_conv.is_owned = false;
57295         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57296         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57297         return tag_ptr(ret_ret, true);
57298 }
57299
57300 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
57301         LDKErroringMessageHandler this_arg_conv;
57302         this_arg_conv.inner = untag_ptr(this_arg);
57303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57305         this_arg_conv.is_owned = false;
57306         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
57307         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
57308         return tag_ptr(ret_ret, true);
57309 }
57310
57311 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
57312         LDKMessageHandler this_obj_conv;
57313         this_obj_conv.inner = untag_ptr(this_obj);
57314         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57316         MessageHandler_free(this_obj_conv);
57317 }
57318
57319 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
57320         LDKMessageHandler this_ptr_conv;
57321         this_ptr_conv.inner = untag_ptr(this_ptr);
57322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57324         this_ptr_conv.is_owned = false;
57325         // WARNING: This object doesn't live past this scope, needs clone!
57326         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
57327         return ret_ret;
57328 }
57329
57330 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
57331         LDKMessageHandler this_ptr_conv;
57332         this_ptr_conv.inner = untag_ptr(this_ptr);
57333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57335         this_ptr_conv.is_owned = false;
57336         void* val_ptr = untag_ptr(val);
57337         CHECK_ACCESS(val_ptr);
57338         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
57339         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
57340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57341                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
57342         }
57343         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
57344 }
57345
57346 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
57347         LDKMessageHandler this_ptr_conv;
57348         this_ptr_conv.inner = untag_ptr(this_ptr);
57349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57351         this_ptr_conv.is_owned = false;
57352         // WARNING: This object doesn't live past this scope, needs clone!
57353         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
57354         return ret_ret;
57355 }
57356
57357 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
57358         LDKMessageHandler this_ptr_conv;
57359         this_ptr_conv.inner = untag_ptr(this_ptr);
57360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57362         this_ptr_conv.is_owned = false;
57363         void* val_ptr = untag_ptr(val);
57364         CHECK_ACCESS(val_ptr);
57365         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
57366         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57367                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57368                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
57369         }
57370         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
57371 }
57372
57373 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
57374         LDKMessageHandler this_ptr_conv;
57375         this_ptr_conv.inner = untag_ptr(this_ptr);
57376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57378         this_ptr_conv.is_owned = false;
57379         // WARNING: This object doesn't live past this scope, needs clone!
57380         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
57381         return ret_ret;
57382 }
57383
57384 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
57385         LDKMessageHandler this_ptr_conv;
57386         this_ptr_conv.inner = untag_ptr(this_ptr);
57387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57389         this_ptr_conv.is_owned = false;
57390         void* val_ptr = untag_ptr(val);
57391         CHECK_ACCESS(val_ptr);
57392         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
57393         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
57394                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57395                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
57396         }
57397         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
57398 }
57399
57400 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
57401         LDKMessageHandler this_ptr_conv;
57402         this_ptr_conv.inner = untag_ptr(this_ptr);
57403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57405         this_ptr_conv.is_owned = false;
57406         // WARNING: This object doesn't live past this scope, needs clone!
57407         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
57408         return ret_ret;
57409 }
57410
57411 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
57412         LDKMessageHandler this_ptr_conv;
57413         this_ptr_conv.inner = untag_ptr(this_ptr);
57414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57416         this_ptr_conv.is_owned = false;
57417         void* val_ptr = untag_ptr(val);
57418         CHECK_ACCESS(val_ptr);
57419         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
57420         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
57421                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57422                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
57423         }
57424         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
57425 }
57426
57427 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) {
57428         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
57429         CHECK_ACCESS(chan_handler_arg_ptr);
57430         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
57431         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
57432                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57433                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
57434         }
57435         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
57436         CHECK_ACCESS(route_handler_arg_ptr);
57437         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
57438         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57440                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
57441         }
57442         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
57443         CHECK_ACCESS(onion_message_handler_arg_ptr);
57444         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
57445         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
57446                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57447                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
57448         }
57449         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
57450         CHECK_ACCESS(custom_message_handler_arg_ptr);
57451         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
57452         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
57453                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57454                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
57455         }
57456         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
57457         uint64_t ret_ref = 0;
57458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57460         return ret_ref;
57461 }
57462
57463 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
57464         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57465         *ret_ret = SocketDescriptor_clone(arg);
57466         return tag_ptr(ret_ret, true);
57467 }
57468 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
57469         void* arg_ptr = untag_ptr(arg);
57470         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
57471         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
57472         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
57473         return ret_conv;
57474 }
57475
57476 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
57477         void* orig_ptr = untag_ptr(orig);
57478         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
57479         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
57480         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57481         *ret_ret = SocketDescriptor_clone(orig_conv);
57482         return tag_ptr(ret_ret, true);
57483 }
57484
57485 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
57486         if (!ptr_is_owned(this_ptr)) return;
57487         void* this_ptr_ptr = untag_ptr(this_ptr);
57488         CHECK_ACCESS(this_ptr_ptr);
57489         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
57490         FREE(untag_ptr(this_ptr));
57491         SocketDescriptor_free(this_ptr_conv);
57492 }
57493
57494 void  __attribute__((export_name("TS_PeerDetails_free"))) TS_PeerDetails_free(uint64_t this_obj) {
57495         LDKPeerDetails this_obj_conv;
57496         this_obj_conv.inner = untag_ptr(this_obj);
57497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57499         PeerDetails_free(this_obj_conv);
57500 }
57501
57502 int8_tArray  __attribute__((export_name("TS_PeerDetails_get_counterparty_node_id"))) TS_PeerDetails_get_counterparty_node_id(uint64_t this_ptr) {
57503         LDKPeerDetails this_ptr_conv;
57504         this_ptr_conv.inner = untag_ptr(this_ptr);
57505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57507         this_ptr_conv.is_owned = false;
57508         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57509         memcpy(ret_arr->elems, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form, 33);
57510         return ret_arr;
57511 }
57512
57513 void  __attribute__((export_name("TS_PeerDetails_set_counterparty_node_id"))) TS_PeerDetails_set_counterparty_node_id(uint64_t this_ptr, int8_tArray val) {
57514         LDKPeerDetails this_ptr_conv;
57515         this_ptr_conv.inner = untag_ptr(this_ptr);
57516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57518         this_ptr_conv.is_owned = false;
57519         LDKPublicKey val_ref;
57520         CHECK(val->arr_len == 33);
57521         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57522         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
57523 }
57524
57525 uint64_t  __attribute__((export_name("TS_PeerDetails_get_socket_address"))) TS_PeerDetails_get_socket_address(uint64_t this_ptr) {
57526         LDKPeerDetails this_ptr_conv;
57527         this_ptr_conv.inner = untag_ptr(this_ptr);
57528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57530         this_ptr_conv.is_owned = false;
57531         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
57532         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
57533         uint64_t ret_ref = tag_ptr(ret_copy, true);
57534         return ret_ref;
57535 }
57536
57537 void  __attribute__((export_name("TS_PeerDetails_set_socket_address"))) TS_PeerDetails_set_socket_address(uint64_t this_ptr, uint64_t val) {
57538         LDKPeerDetails this_ptr_conv;
57539         this_ptr_conv.inner = untag_ptr(this_ptr);
57540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57542         this_ptr_conv.is_owned = false;
57543         void* val_ptr = untag_ptr(val);
57544         CHECK_ACCESS(val_ptr);
57545         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
57546         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
57547         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
57548 }
57549
57550 uint64_t  __attribute__((export_name("TS_PeerDetails_get_init_features"))) TS_PeerDetails_get_init_features(uint64_t this_ptr) {
57551         LDKPeerDetails this_ptr_conv;
57552         this_ptr_conv.inner = untag_ptr(this_ptr);
57553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57555         this_ptr_conv.is_owned = false;
57556         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
57557         uint64_t ret_ref = 0;
57558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57560         return ret_ref;
57561 }
57562
57563 void  __attribute__((export_name("TS_PeerDetails_set_init_features"))) TS_PeerDetails_set_init_features(uint64_t this_ptr, uint64_t val) {
57564         LDKPeerDetails this_ptr_conv;
57565         this_ptr_conv.inner = untag_ptr(this_ptr);
57566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57568         this_ptr_conv.is_owned = false;
57569         LDKInitFeatures val_conv;
57570         val_conv.inner = untag_ptr(val);
57571         val_conv.is_owned = ptr_is_owned(val);
57572         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57573         val_conv = InitFeatures_clone(&val_conv);
57574         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
57575 }
57576
57577 jboolean  __attribute__((export_name("TS_PeerDetails_get_is_inbound_connection"))) TS_PeerDetails_get_is_inbound_connection(uint64_t this_ptr) {
57578         LDKPeerDetails this_ptr_conv;
57579         this_ptr_conv.inner = untag_ptr(this_ptr);
57580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57582         this_ptr_conv.is_owned = false;
57583         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
57584         return ret_conv;
57585 }
57586
57587 void  __attribute__((export_name("TS_PeerDetails_set_is_inbound_connection"))) TS_PeerDetails_set_is_inbound_connection(uint64_t this_ptr, jboolean val) {
57588         LDKPeerDetails this_ptr_conv;
57589         this_ptr_conv.inner = untag_ptr(this_ptr);
57590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57592         this_ptr_conv.is_owned = false;
57593         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
57594 }
57595
57596 uint64_t  __attribute__((export_name("TS_PeerDetails_new"))) TS_PeerDetails_new(int8_tArray counterparty_node_id_arg, uint64_t socket_address_arg, uint64_t init_features_arg, jboolean is_inbound_connection_arg) {
57597         LDKPublicKey counterparty_node_id_arg_ref;
57598         CHECK(counterparty_node_id_arg->arr_len == 33);
57599         memcpy(counterparty_node_id_arg_ref.compressed_form, counterparty_node_id_arg->elems, 33); FREE(counterparty_node_id_arg);
57600         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
57601         CHECK_ACCESS(socket_address_arg_ptr);
57602         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
57603         LDKInitFeatures init_features_arg_conv;
57604         init_features_arg_conv.inner = untag_ptr(init_features_arg);
57605         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
57606         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
57607         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
57608         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
57609         uint64_t ret_ref = 0;
57610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57612         return ret_ref;
57613 }
57614
57615 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
57616         LDKPeerHandleError this_obj_conv;
57617         this_obj_conv.inner = untag_ptr(this_obj);
57618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57620         PeerHandleError_free(this_obj_conv);
57621 }
57622
57623 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
57624         LDKPeerHandleError ret_var = PeerHandleError_new();
57625         uint64_t ret_ref = 0;
57626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57628         return ret_ref;
57629 }
57630
57631 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
57632         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
57633         uint64_t ret_ref = 0;
57634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57636         return ret_ref;
57637 }
57638 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
57639         LDKPeerHandleError arg_conv;
57640         arg_conv.inner = untag_ptr(arg);
57641         arg_conv.is_owned = ptr_is_owned(arg);
57642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57643         arg_conv.is_owned = false;
57644         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
57645         return ret_conv;
57646 }
57647
57648 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
57649         LDKPeerHandleError orig_conv;
57650         orig_conv.inner = untag_ptr(orig);
57651         orig_conv.is_owned = ptr_is_owned(orig);
57652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57653         orig_conv.is_owned = false;
57654         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
57655         uint64_t ret_ref = 0;
57656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57658         return ret_ref;
57659 }
57660
57661 jstring  __attribute__((export_name("TS_PeerHandleError_to_str"))) TS_PeerHandleError_to_str(uint64_t o) {
57662         LDKPeerHandleError o_conv;
57663         o_conv.inner = untag_ptr(o);
57664         o_conv.is_owned = ptr_is_owned(o);
57665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57666         o_conv.is_owned = false;
57667         LDKStr ret_str = PeerHandleError_to_str(&o_conv);
57668         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
57669         Str_free(ret_str);
57670         return ret_conv;
57671 }
57672
57673 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
57674         LDKPeerManager this_obj_conv;
57675         this_obj_conv.inner = untag_ptr(this_obj);
57676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57678         PeerManager_free(this_obj_conv);
57679 }
57680
57681 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) {
57682         LDKMessageHandler message_handler_conv;
57683         message_handler_conv.inner = untag_ptr(message_handler);
57684         message_handler_conv.is_owned = ptr_is_owned(message_handler);
57685         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
57686         // WARNING: we need a move here but no clone is available for LDKMessageHandler
57687         
57688         uint8_t ephemeral_random_data_arr[32];
57689         CHECK(ephemeral_random_data->arr_len == 32);
57690         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
57691         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
57692         void* logger_ptr = untag_ptr(logger);
57693         CHECK_ACCESS(logger_ptr);
57694         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57695         if (logger_conv.free == LDKLogger_JCalls_free) {
57696                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57697                 LDKLogger_JCalls_cloned(&logger_conv);
57698         }
57699         void* node_signer_ptr = untag_ptr(node_signer);
57700         CHECK_ACCESS(node_signer_ptr);
57701         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
57702         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
57703                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57704                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
57705         }
57706         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
57707         uint64_t ret_ref = 0;
57708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57710         return ret_ref;
57711 }
57712
57713 uint64_tArray  __attribute__((export_name("TS_PeerManager_list_peers"))) TS_PeerManager_list_peers(uint64_t this_arg) {
57714         LDKPeerManager this_arg_conv;
57715         this_arg_conv.inner = untag_ptr(this_arg);
57716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57718         this_arg_conv.is_owned = false;
57719         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
57720         uint64_tArray ret_arr = NULL;
57721         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
57722         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
57723         for (size_t n = 0; n < ret_var.datalen; n++) {
57724                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
57725                 uint64_t ret_conv_13_ref = 0;
57726                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
57727                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
57728                 ret_arr_ptr[n] = ret_conv_13_ref;
57729         }
57730         
57731         FREE(ret_var.data);
57732         return ret_arr;
57733 }
57734
57735 uint64_t  __attribute__((export_name("TS_PeerManager_peer_by_node_id"))) TS_PeerManager_peer_by_node_id(uint64_t this_arg, int8_tArray their_node_id) {
57736         LDKPeerManager this_arg_conv;
57737         this_arg_conv.inner = untag_ptr(this_arg);
57738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57740         this_arg_conv.is_owned = false;
57741         LDKPublicKey their_node_id_ref;
57742         CHECK(their_node_id->arr_len == 33);
57743         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
57744         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
57745         uint64_t ret_ref = 0;
57746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57748         return ret_ref;
57749 }
57750
57751 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) {
57752         LDKPeerManager this_arg_conv;
57753         this_arg_conv.inner = untag_ptr(this_arg);
57754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57756         this_arg_conv.is_owned = false;
57757         LDKPublicKey their_node_id_ref;
57758         CHECK(their_node_id->arr_len == 33);
57759         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
57760         void* descriptor_ptr = untag_ptr(descriptor);
57761         CHECK_ACCESS(descriptor_ptr);
57762         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
57763         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
57764                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57765                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
57766         }
57767         void* remote_network_address_ptr = untag_ptr(remote_network_address);
57768         CHECK_ACCESS(remote_network_address_ptr);
57769         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
57770         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
57771         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
57772         return tag_ptr(ret_conv, true);
57773 }
57774
57775 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) {
57776         LDKPeerManager this_arg_conv;
57777         this_arg_conv.inner = untag_ptr(this_arg);
57778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57780         this_arg_conv.is_owned = false;
57781         void* descriptor_ptr = untag_ptr(descriptor);
57782         CHECK_ACCESS(descriptor_ptr);
57783         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
57784         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
57785                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57786                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
57787         }
57788         void* remote_network_address_ptr = untag_ptr(remote_network_address);
57789         CHECK_ACCESS(remote_network_address_ptr);
57790         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
57791         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
57792         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
57793         return tag_ptr(ret_conv, true);
57794 }
57795
57796 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
57797         LDKPeerManager this_arg_conv;
57798         this_arg_conv.inner = untag_ptr(this_arg);
57799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57801         this_arg_conv.is_owned = false;
57802         void* descriptor_ptr = untag_ptr(descriptor);
57803         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
57804         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
57805         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
57806         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
57807         return tag_ptr(ret_conv, true);
57808 }
57809
57810 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
57811         LDKPeerManager this_arg_conv;
57812         this_arg_conv.inner = untag_ptr(this_arg);
57813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57815         this_arg_conv.is_owned = false;
57816         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
57817         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
57818         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
57819         LDKu8slice data_ref;
57820         data_ref.datalen = data->arr_len;
57821         data_ref.data = data->elems;
57822         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
57823         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
57824         FREE(data);
57825         return tag_ptr(ret_conv, true);
57826 }
57827
57828 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
57829         LDKPeerManager this_arg_conv;
57830         this_arg_conv.inner = untag_ptr(this_arg);
57831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57833         this_arg_conv.is_owned = false;
57834         PeerManager_process_events(&this_arg_conv);
57835 }
57836
57837 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
57838         LDKPeerManager this_arg_conv;
57839         this_arg_conv.inner = untag_ptr(this_arg);
57840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57842         this_arg_conv.is_owned = false;
57843         void* descriptor_ptr = untag_ptr(descriptor);
57844         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
57845         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
57846         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
57847 }
57848
57849 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
57850         LDKPeerManager this_arg_conv;
57851         this_arg_conv.inner = untag_ptr(this_arg);
57852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57854         this_arg_conv.is_owned = false;
57855         LDKPublicKey node_id_ref;
57856         CHECK(node_id->arr_len == 33);
57857         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
57858         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
57859 }
57860
57861 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
57862         LDKPeerManager this_arg_conv;
57863         this_arg_conv.inner = untag_ptr(this_arg);
57864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57866         this_arg_conv.is_owned = false;
57867         PeerManager_disconnect_all_peers(&this_arg_conv);
57868 }
57869
57870 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
57871         LDKPeerManager this_arg_conv;
57872         this_arg_conv.inner = untag_ptr(this_arg);
57873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57875         this_arg_conv.is_owned = false;
57876         PeerManager_timer_tick_occurred(&this_arg_conv);
57877 }
57878
57879 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) {
57880         LDKPeerManager this_arg_conv;
57881         this_arg_conv.inner = untag_ptr(this_arg);
57882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57884         this_arg_conv.is_owned = false;
57885         LDKThreeBytes rgb_ref;
57886         CHECK(rgb->arr_len == 3);
57887         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
57888         LDKThirtyTwoBytes alias_ref;
57889         CHECK(alias->arr_len == 32);
57890         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
57891         LDKCVec_SocketAddressZ addresses_constr;
57892         addresses_constr.datalen = addresses->arr_len;
57893         if (addresses_constr.datalen > 0)
57894                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
57895         else
57896                 addresses_constr.data = NULL;
57897         uint64_t* addresses_vals = addresses->elems;
57898         for (size_t p = 0; p < addresses_constr.datalen; p++) {
57899                 uint64_t addresses_conv_15 = addresses_vals[p];
57900                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
57901                 CHECK_ACCESS(addresses_conv_15_ptr);
57902                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
57903                 addresses_constr.data[p] = addresses_conv_15_conv;
57904         }
57905         FREE(addresses);
57906         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
57907 }
57908
57909 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
57910         LDKChannelTypeFeatures channel_type_features_conv;
57911         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57912         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57913         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57914         channel_type_features_conv.is_owned = false;
57915         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
57916         return ret_conv;
57917 }
57918
57919 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
57920         LDKChannelTypeFeatures channel_type_features_conv;
57921         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57922         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57923         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57924         channel_type_features_conv.is_owned = false;
57925         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
57926         return ret_conv;
57927 }
57928
57929 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
57930         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
57931         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
57932         return ret_conv;
57933 }
57934
57935 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
57936         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
57937         return ret_conv;
57938 }
57939
57940 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
57941         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
57942         return ret_conv;
57943 }
57944
57945 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
57946         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
57947         return ret_conv;
57948 }
57949
57950 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
57951         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
57952         return ret_conv;
57953 }
57954
57955 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
57956         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
57957         return ret_conv;
57958 }
57959
57960 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
57961         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
57962         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
57963         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
57964         return ret_conv;
57965 }
57966
57967 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
57968         LDKWitness witness_ref;
57969         witness_ref.datalen = witness->arr_len;
57970         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
57971         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
57972         witness_ref.data_is_owned = true;
57973         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
57974         *ret_copy = HTLCClaim_from_witness(witness_ref);
57975         uint64_t ret_ref = tag_ptr(ret_copy, true);
57976         return ret_ref;
57977 }
57978
57979 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
57980         uint8_t commitment_seed_arr[32];
57981         CHECK(commitment_seed->arr_len == 32);
57982         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
57983         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
57984         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57985         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
57986         return ret_arr;
57987 }
57988
57989 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) {
57990         LDKCVec_u8Z to_holder_script_ref;
57991         to_holder_script_ref.datalen = to_holder_script->arr_len;
57992         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
57993         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
57994         LDKCVec_u8Z to_counterparty_script_ref;
57995         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
57996         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
57997         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
57998         LDKOutPoint funding_outpoint_conv;
57999         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58000         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58001         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58002         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58003         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);
58004         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58005         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58006         Transaction_free(ret_var);
58007         return ret_arr;
58008 }
58009
58010 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
58011         LDKCounterpartyCommitmentSecrets this_obj_conv;
58012         this_obj_conv.inner = untag_ptr(this_obj);
58013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58015         CounterpartyCommitmentSecrets_free(this_obj_conv);
58016 }
58017
58018 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
58019         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
58020         uint64_t ret_ref = 0;
58021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58023         return ret_ref;
58024 }
58025 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
58026         LDKCounterpartyCommitmentSecrets arg_conv;
58027         arg_conv.inner = untag_ptr(arg);
58028         arg_conv.is_owned = ptr_is_owned(arg);
58029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58030         arg_conv.is_owned = false;
58031         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
58032         return ret_conv;
58033 }
58034
58035 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
58036         LDKCounterpartyCommitmentSecrets orig_conv;
58037         orig_conv.inner = untag_ptr(orig);
58038         orig_conv.is_owned = ptr_is_owned(orig);
58039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58040         orig_conv.is_owned = false;
58041         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
58042         uint64_t ret_ref = 0;
58043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58045         return ret_ref;
58046 }
58047
58048 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
58049         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
58050         uint64_t ret_ref = 0;
58051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58053         return ret_ref;
58054 }
58055
58056 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
58057         LDKCounterpartyCommitmentSecrets this_arg_conv;
58058         this_arg_conv.inner = untag_ptr(this_arg);
58059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58061         this_arg_conv.is_owned = false;
58062         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
58063         return ret_conv;
58064 }
58065
58066 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
58067         LDKCounterpartyCommitmentSecrets this_arg_conv;
58068         this_arg_conv.inner = untag_ptr(this_arg);
58069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58071         this_arg_conv.is_owned = false;
58072         LDKThirtyTwoBytes secret_ref;
58073         CHECK(secret->arr_len == 32);
58074         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
58075         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
58076         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
58077         return tag_ptr(ret_conv, true);
58078 }
58079
58080 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
58081         LDKCounterpartyCommitmentSecrets this_arg_conv;
58082         this_arg_conv.inner = untag_ptr(this_arg);
58083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58085         this_arg_conv.is_owned = false;
58086         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58087         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
58088         return ret_arr;
58089 }
58090
58091 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
58092         LDKCounterpartyCommitmentSecrets obj_conv;
58093         obj_conv.inner = untag_ptr(obj);
58094         obj_conv.is_owned = ptr_is_owned(obj);
58095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58096         obj_conv.is_owned = false;
58097         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
58098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58100         CVec_u8Z_free(ret_var);
58101         return ret_arr;
58102 }
58103
58104 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
58105         LDKu8slice ser_ref;
58106         ser_ref.datalen = ser->arr_len;
58107         ser_ref.data = ser->elems;
58108         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
58109         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
58110         FREE(ser);
58111         return tag_ptr(ret_conv, true);
58112 }
58113
58114 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
58115         LDKPublicKey per_commitment_point_ref;
58116         CHECK(per_commitment_point->arr_len == 33);
58117         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
58118         uint8_t base_secret_arr[32];
58119         CHECK(base_secret->arr_len == 32);
58120         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
58121         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
58122         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58123         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
58124         return ret_arr;
58125 }
58126
58127 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) {
58128         uint8_t per_commitment_secret_arr[32];
58129         CHECK(per_commitment_secret->arr_len == 32);
58130         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
58131         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
58132         uint8_t countersignatory_revocation_base_secret_arr[32];
58133         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
58134         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
58135         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
58136         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58137         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
58138         return ret_arr;
58139 }
58140
58141 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
58142         LDKTxCreationKeys this_obj_conv;
58143         this_obj_conv.inner = untag_ptr(this_obj);
58144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58146         TxCreationKeys_free(this_obj_conv);
58147 }
58148
58149 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
58150         LDKTxCreationKeys this_ptr_conv;
58151         this_ptr_conv.inner = untag_ptr(this_ptr);
58152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58154         this_ptr_conv.is_owned = false;
58155         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58156         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
58157         return ret_arr;
58158 }
58159
58160 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
58161         LDKTxCreationKeys this_ptr_conv;
58162         this_ptr_conv.inner = untag_ptr(this_ptr);
58163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58165         this_ptr_conv.is_owned = false;
58166         LDKPublicKey val_ref;
58167         CHECK(val->arr_len == 33);
58168         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58169         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
58170 }
58171
58172 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
58173         LDKTxCreationKeys this_ptr_conv;
58174         this_ptr_conv.inner = untag_ptr(this_ptr);
58175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58177         this_ptr_conv.is_owned = false;
58178         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
58179         uint64_t ret_ref = 0;
58180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58182         return ret_ref;
58183 }
58184
58185 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, uint64_t val) {
58186         LDKTxCreationKeys this_ptr_conv;
58187         this_ptr_conv.inner = untag_ptr(this_ptr);
58188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58190         this_ptr_conv.is_owned = false;
58191         LDKRevocationKey val_conv;
58192         val_conv.inner = untag_ptr(val);
58193         val_conv.is_owned = ptr_is_owned(val);
58194         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58195         val_conv = RevocationKey_clone(&val_conv);
58196         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
58197 }
58198
58199 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
58200         LDKTxCreationKeys this_ptr_conv;
58201         this_ptr_conv.inner = untag_ptr(this_ptr);
58202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58204         this_ptr_conv.is_owned = false;
58205         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
58206         uint64_t ret_ref = 0;
58207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58209         return ret_ref;
58210 }
58211
58212 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, uint64_t val) {
58213         LDKTxCreationKeys this_ptr_conv;
58214         this_ptr_conv.inner = untag_ptr(this_ptr);
58215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58217         this_ptr_conv.is_owned = false;
58218         LDKHtlcKey val_conv;
58219         val_conv.inner = untag_ptr(val);
58220         val_conv.is_owned = ptr_is_owned(val);
58221         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58222         val_conv = HtlcKey_clone(&val_conv);
58223         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
58224 }
58225
58226 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
58227         LDKTxCreationKeys this_ptr_conv;
58228         this_ptr_conv.inner = untag_ptr(this_ptr);
58229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58231         this_ptr_conv.is_owned = false;
58232         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
58233         uint64_t ret_ref = 0;
58234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58236         return ret_ref;
58237 }
58238
58239 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, uint64_t val) {
58240         LDKTxCreationKeys this_ptr_conv;
58241         this_ptr_conv.inner = untag_ptr(this_ptr);
58242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58244         this_ptr_conv.is_owned = false;
58245         LDKHtlcKey val_conv;
58246         val_conv.inner = untag_ptr(val);
58247         val_conv.is_owned = ptr_is_owned(val);
58248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58249         val_conv = HtlcKey_clone(&val_conv);
58250         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
58251 }
58252
58253 uint64_t  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
58254         LDKTxCreationKeys this_ptr_conv;
58255         this_ptr_conv.inner = untag_ptr(this_ptr);
58256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58258         this_ptr_conv.is_owned = false;
58259         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
58260         uint64_t ret_ref = 0;
58261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58263         return ret_ref;
58264 }
58265
58266 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) {
58267         LDKTxCreationKeys this_ptr_conv;
58268         this_ptr_conv.inner = untag_ptr(this_ptr);
58269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58271         this_ptr_conv.is_owned = false;
58272         LDKDelayedPaymentKey val_conv;
58273         val_conv.inner = untag_ptr(val);
58274         val_conv.is_owned = ptr_is_owned(val);
58275         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58276         val_conv = DelayedPaymentKey_clone(&val_conv);
58277         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
58278 }
58279
58280 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) {
58281         LDKPublicKey per_commitment_point_arg_ref;
58282         CHECK(per_commitment_point_arg->arr_len == 33);
58283         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
58284         LDKRevocationKey revocation_key_arg_conv;
58285         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
58286         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
58287         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
58288         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
58289         LDKHtlcKey broadcaster_htlc_key_arg_conv;
58290         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
58291         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
58292         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
58293         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
58294         LDKHtlcKey countersignatory_htlc_key_arg_conv;
58295         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
58296         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
58297         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
58298         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
58299         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
58300         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
58301         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
58302         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
58303         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
58304         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);
58305         uint64_t ret_ref = 0;
58306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58308         return ret_ref;
58309 }
58310
58311 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
58312         LDKTxCreationKeys a_conv;
58313         a_conv.inner = untag_ptr(a);
58314         a_conv.is_owned = ptr_is_owned(a);
58315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58316         a_conv.is_owned = false;
58317         LDKTxCreationKeys b_conv;
58318         b_conv.inner = untag_ptr(b);
58319         b_conv.is_owned = ptr_is_owned(b);
58320         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58321         b_conv.is_owned = false;
58322         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
58323         return ret_conv;
58324 }
58325
58326 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
58327         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
58328         uint64_t ret_ref = 0;
58329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58331         return ret_ref;
58332 }
58333 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
58334         LDKTxCreationKeys arg_conv;
58335         arg_conv.inner = untag_ptr(arg);
58336         arg_conv.is_owned = ptr_is_owned(arg);
58337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58338         arg_conv.is_owned = false;
58339         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
58340         return ret_conv;
58341 }
58342
58343 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
58344         LDKTxCreationKeys orig_conv;
58345         orig_conv.inner = untag_ptr(orig);
58346         orig_conv.is_owned = ptr_is_owned(orig);
58347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58348         orig_conv.is_owned = false;
58349         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
58350         uint64_t ret_ref = 0;
58351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58353         return ret_ref;
58354 }
58355
58356 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
58357         LDKTxCreationKeys obj_conv;
58358         obj_conv.inner = untag_ptr(obj);
58359         obj_conv.is_owned = ptr_is_owned(obj);
58360         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58361         obj_conv.is_owned = false;
58362         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
58363         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58364         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58365         CVec_u8Z_free(ret_var);
58366         return ret_arr;
58367 }
58368
58369 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
58370         LDKu8slice ser_ref;
58371         ser_ref.datalen = ser->arr_len;
58372         ser_ref.data = ser->elems;
58373         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
58374         *ret_conv = TxCreationKeys_read(ser_ref);
58375         FREE(ser);
58376         return tag_ptr(ret_conv, true);
58377 }
58378
58379 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
58380         LDKChannelPublicKeys this_obj_conv;
58381         this_obj_conv.inner = untag_ptr(this_obj);
58382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58384         ChannelPublicKeys_free(this_obj_conv);
58385 }
58386
58387 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
58388         LDKChannelPublicKeys this_ptr_conv;
58389         this_ptr_conv.inner = untag_ptr(this_ptr);
58390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58392         this_ptr_conv.is_owned = false;
58393         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58394         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
58395         return ret_arr;
58396 }
58397
58398 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
58399         LDKChannelPublicKeys this_ptr_conv;
58400         this_ptr_conv.inner = untag_ptr(this_ptr);
58401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58403         this_ptr_conv.is_owned = false;
58404         LDKPublicKey val_ref;
58405         CHECK(val->arr_len == 33);
58406         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58407         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
58408 }
58409
58410 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
58411         LDKChannelPublicKeys this_ptr_conv;
58412         this_ptr_conv.inner = untag_ptr(this_ptr);
58413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58415         this_ptr_conv.is_owned = false;
58416         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
58417         uint64_t ret_ref = 0;
58418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58420         return ret_ref;
58421 }
58422
58423 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, uint64_t val) {
58424         LDKChannelPublicKeys this_ptr_conv;
58425         this_ptr_conv.inner = untag_ptr(this_ptr);
58426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58428         this_ptr_conv.is_owned = false;
58429         LDKRevocationBasepoint val_conv;
58430         val_conv.inner = untag_ptr(val);
58431         val_conv.is_owned = ptr_is_owned(val);
58432         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58433         val_conv = RevocationBasepoint_clone(&val_conv);
58434         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
58435 }
58436
58437 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
58438         LDKChannelPublicKeys this_ptr_conv;
58439         this_ptr_conv.inner = untag_ptr(this_ptr);
58440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58442         this_ptr_conv.is_owned = false;
58443         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58444         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
58445         return ret_arr;
58446 }
58447
58448 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
58449         LDKChannelPublicKeys this_ptr_conv;
58450         this_ptr_conv.inner = untag_ptr(this_ptr);
58451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58453         this_ptr_conv.is_owned = false;
58454         LDKPublicKey val_ref;
58455         CHECK(val->arr_len == 33);
58456         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58457         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
58458 }
58459
58460 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
58461         LDKChannelPublicKeys this_ptr_conv;
58462         this_ptr_conv.inner = untag_ptr(this_ptr);
58463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58465         this_ptr_conv.is_owned = false;
58466         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
58467         uint64_t ret_ref = 0;
58468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58470         return ret_ref;
58471 }
58472
58473 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, uint64_t val) {
58474         LDKChannelPublicKeys this_ptr_conv;
58475         this_ptr_conv.inner = untag_ptr(this_ptr);
58476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58478         this_ptr_conv.is_owned = false;
58479         LDKDelayedPaymentBasepoint val_conv;
58480         val_conv.inner = untag_ptr(val);
58481         val_conv.is_owned = ptr_is_owned(val);
58482         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58483         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
58484         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
58485 }
58486
58487 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
58488         LDKChannelPublicKeys this_ptr_conv;
58489         this_ptr_conv.inner = untag_ptr(this_ptr);
58490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58492         this_ptr_conv.is_owned = false;
58493         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
58494         uint64_t ret_ref = 0;
58495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58497         return ret_ref;
58498 }
58499
58500 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, uint64_t val) {
58501         LDKChannelPublicKeys this_ptr_conv;
58502         this_ptr_conv.inner = untag_ptr(this_ptr);
58503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58505         this_ptr_conv.is_owned = false;
58506         LDKHtlcBasepoint val_conv;
58507         val_conv.inner = untag_ptr(val);
58508         val_conv.is_owned = ptr_is_owned(val);
58509         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58510         val_conv = HtlcBasepoint_clone(&val_conv);
58511         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
58512 }
58513
58514 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) {
58515         LDKPublicKey funding_pubkey_arg_ref;
58516         CHECK(funding_pubkey_arg->arr_len == 33);
58517         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
58518         LDKRevocationBasepoint revocation_basepoint_arg_conv;
58519         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
58520         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
58521         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
58522         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
58523         LDKPublicKey payment_point_arg_ref;
58524         CHECK(payment_point_arg->arr_len == 33);
58525         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
58526         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
58527         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
58528         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
58529         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
58530         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
58531         LDKHtlcBasepoint htlc_basepoint_arg_conv;
58532         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
58533         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
58534         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
58535         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
58536         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);
58537         uint64_t ret_ref = 0;
58538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58540         return ret_ref;
58541 }
58542
58543 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
58544         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
58545         uint64_t ret_ref = 0;
58546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58548         return ret_ref;
58549 }
58550 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
58551         LDKChannelPublicKeys arg_conv;
58552         arg_conv.inner = untag_ptr(arg);
58553         arg_conv.is_owned = ptr_is_owned(arg);
58554         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58555         arg_conv.is_owned = false;
58556         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
58557         return ret_conv;
58558 }
58559
58560 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
58561         LDKChannelPublicKeys orig_conv;
58562         orig_conv.inner = untag_ptr(orig);
58563         orig_conv.is_owned = ptr_is_owned(orig);
58564         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58565         orig_conv.is_owned = false;
58566         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
58567         uint64_t ret_ref = 0;
58568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58570         return ret_ref;
58571 }
58572
58573 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_hash"))) TS_ChannelPublicKeys_hash(uint64_t o) {
58574         LDKChannelPublicKeys o_conv;
58575         o_conv.inner = untag_ptr(o);
58576         o_conv.is_owned = ptr_is_owned(o);
58577         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58578         o_conv.is_owned = false;
58579         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
58580         return ret_conv;
58581 }
58582
58583 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
58584         LDKChannelPublicKeys a_conv;
58585         a_conv.inner = untag_ptr(a);
58586         a_conv.is_owned = ptr_is_owned(a);
58587         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58588         a_conv.is_owned = false;
58589         LDKChannelPublicKeys b_conv;
58590         b_conv.inner = untag_ptr(b);
58591         b_conv.is_owned = ptr_is_owned(b);
58592         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58593         b_conv.is_owned = false;
58594         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
58595         return ret_conv;
58596 }
58597
58598 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
58599         LDKChannelPublicKeys obj_conv;
58600         obj_conv.inner = untag_ptr(obj);
58601         obj_conv.is_owned = ptr_is_owned(obj);
58602         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58603         obj_conv.is_owned = false;
58604         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
58605         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58606         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58607         CVec_u8Z_free(ret_var);
58608         return ret_arr;
58609 }
58610
58611 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
58612         LDKu8slice ser_ref;
58613         ser_ref.datalen = ser->arr_len;
58614         ser_ref.data = ser->elems;
58615         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
58616         *ret_conv = ChannelPublicKeys_read(ser_ref);
58617         FREE(ser);
58618         return tag_ptr(ret_conv, true);
58619 }
58620
58621 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) {
58622         LDKPublicKey per_commitment_point_ref;
58623         CHECK(per_commitment_point->arr_len == 33);
58624         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
58625         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
58626         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
58627         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
58628         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
58629         broadcaster_delayed_payment_base_conv.is_owned = false;
58630         LDKHtlcBasepoint broadcaster_htlc_base_conv;
58631         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
58632         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
58633         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
58634         broadcaster_htlc_base_conv.is_owned = false;
58635         LDKRevocationBasepoint countersignatory_revocation_base_conv;
58636         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
58637         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
58638         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
58639         countersignatory_revocation_base_conv.is_owned = false;
58640         LDKHtlcBasepoint countersignatory_htlc_base_conv;
58641         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
58642         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
58643         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
58644         countersignatory_htlc_base_conv.is_owned = false;
58645         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);
58646         uint64_t ret_ref = 0;
58647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58649         return ret_ref;
58650 }
58651
58652 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) {
58653         LDKPublicKey per_commitment_point_ref;
58654         CHECK(per_commitment_point->arr_len == 33);
58655         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
58656         LDKChannelPublicKeys broadcaster_keys_conv;
58657         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
58658         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
58659         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
58660         broadcaster_keys_conv.is_owned = false;
58661         LDKChannelPublicKeys countersignatory_keys_conv;
58662         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
58663         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
58664         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
58665         countersignatory_keys_conv.is_owned = false;
58666         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
58667         uint64_t ret_ref = 0;
58668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58670         return ret_ref;
58671 }
58672
58673 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) {
58674         LDKRevocationKey revocation_key_conv;
58675         revocation_key_conv.inner = untag_ptr(revocation_key);
58676         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
58677         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
58678         revocation_key_conv.is_owned = false;
58679         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
58680         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
58681         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
58682         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
58683         broadcaster_delayed_payment_key_conv.is_owned = false;
58684         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
58685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58687         CVec_u8Z_free(ret_var);
58688         return ret_arr;
58689 }
58690
58691 int8_tArray  __attribute__((export_name("TS_get_counterparty_payment_script"))) TS_get_counterparty_payment_script(uint64_t channel_type_features, int8_tArray payment_key) {
58692         LDKChannelTypeFeatures channel_type_features_conv;
58693         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58694         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58695         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58696         channel_type_features_conv.is_owned = false;
58697         LDKPublicKey payment_key_ref;
58698         CHECK(payment_key->arr_len == 33);
58699         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
58700         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
58701         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58702         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58703         CVec_u8Z_free(ret_var);
58704         return ret_arr;
58705 }
58706
58707 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
58708         LDKHTLCOutputInCommitment this_obj_conv;
58709         this_obj_conv.inner = untag_ptr(this_obj);
58710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58712         HTLCOutputInCommitment_free(this_obj_conv);
58713 }
58714
58715 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
58716         LDKHTLCOutputInCommitment this_ptr_conv;
58717         this_ptr_conv.inner = untag_ptr(this_ptr);
58718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58720         this_ptr_conv.is_owned = false;
58721         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
58722         return ret_conv;
58723 }
58724
58725 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
58726         LDKHTLCOutputInCommitment this_ptr_conv;
58727         this_ptr_conv.inner = untag_ptr(this_ptr);
58728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58730         this_ptr_conv.is_owned = false;
58731         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
58732 }
58733
58734 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
58735         LDKHTLCOutputInCommitment this_ptr_conv;
58736         this_ptr_conv.inner = untag_ptr(this_ptr);
58737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58739         this_ptr_conv.is_owned = false;
58740         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
58741         return ret_conv;
58742 }
58743
58744 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
58745         LDKHTLCOutputInCommitment this_ptr_conv;
58746         this_ptr_conv.inner = untag_ptr(this_ptr);
58747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58749         this_ptr_conv.is_owned = false;
58750         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
58751 }
58752
58753 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
58754         LDKHTLCOutputInCommitment this_ptr_conv;
58755         this_ptr_conv.inner = untag_ptr(this_ptr);
58756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58758         this_ptr_conv.is_owned = false;
58759         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
58760         return ret_conv;
58761 }
58762
58763 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
58764         LDKHTLCOutputInCommitment this_ptr_conv;
58765         this_ptr_conv.inner = untag_ptr(this_ptr);
58766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58768         this_ptr_conv.is_owned = false;
58769         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
58770 }
58771
58772 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
58773         LDKHTLCOutputInCommitment this_ptr_conv;
58774         this_ptr_conv.inner = untag_ptr(this_ptr);
58775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58777         this_ptr_conv.is_owned = false;
58778         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58779         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
58780         return ret_arr;
58781 }
58782
58783 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
58784         LDKHTLCOutputInCommitment this_ptr_conv;
58785         this_ptr_conv.inner = untag_ptr(this_ptr);
58786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58788         this_ptr_conv.is_owned = false;
58789         LDKThirtyTwoBytes val_ref;
58790         CHECK(val->arr_len == 32);
58791         memcpy(val_ref.data, val->elems, 32); FREE(val);
58792         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
58793 }
58794
58795 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
58796         LDKHTLCOutputInCommitment this_ptr_conv;
58797         this_ptr_conv.inner = untag_ptr(this_ptr);
58798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58800         this_ptr_conv.is_owned = false;
58801         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58802         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
58803         uint64_t ret_ref = tag_ptr(ret_copy, true);
58804         return ret_ref;
58805 }
58806
58807 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
58808         LDKHTLCOutputInCommitment this_ptr_conv;
58809         this_ptr_conv.inner = untag_ptr(this_ptr);
58810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58812         this_ptr_conv.is_owned = false;
58813         void* val_ptr = untag_ptr(val);
58814         CHECK_ACCESS(val_ptr);
58815         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
58816         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
58817         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
58818 }
58819
58820 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) {
58821         LDKThirtyTwoBytes payment_hash_arg_ref;
58822         CHECK(payment_hash_arg->arr_len == 32);
58823         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
58824         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
58825         CHECK_ACCESS(transaction_output_index_arg_ptr);
58826         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
58827         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
58828         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
58829         uint64_t ret_ref = 0;
58830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58832         return ret_ref;
58833 }
58834
58835 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
58836         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
58837         uint64_t ret_ref = 0;
58838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58840         return ret_ref;
58841 }
58842 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
58843         LDKHTLCOutputInCommitment arg_conv;
58844         arg_conv.inner = untag_ptr(arg);
58845         arg_conv.is_owned = ptr_is_owned(arg);
58846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58847         arg_conv.is_owned = false;
58848         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
58849         return ret_conv;
58850 }
58851
58852 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
58853         LDKHTLCOutputInCommitment orig_conv;
58854         orig_conv.inner = untag_ptr(orig);
58855         orig_conv.is_owned = ptr_is_owned(orig);
58856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58857         orig_conv.is_owned = false;
58858         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
58859         uint64_t ret_ref = 0;
58860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58862         return ret_ref;
58863 }
58864
58865 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
58866         LDKHTLCOutputInCommitment a_conv;
58867         a_conv.inner = untag_ptr(a);
58868         a_conv.is_owned = ptr_is_owned(a);
58869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58870         a_conv.is_owned = false;
58871         LDKHTLCOutputInCommitment b_conv;
58872         b_conv.inner = untag_ptr(b);
58873         b_conv.is_owned = ptr_is_owned(b);
58874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58875         b_conv.is_owned = false;
58876         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
58877         return ret_conv;
58878 }
58879
58880 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
58881         LDKHTLCOutputInCommitment obj_conv;
58882         obj_conv.inner = untag_ptr(obj);
58883         obj_conv.is_owned = ptr_is_owned(obj);
58884         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58885         obj_conv.is_owned = false;
58886         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
58887         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58888         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58889         CVec_u8Z_free(ret_var);
58890         return ret_arr;
58891 }
58892
58893 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
58894         LDKu8slice ser_ref;
58895         ser_ref.datalen = ser->arr_len;
58896         ser_ref.data = ser->elems;
58897         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
58898         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
58899         FREE(ser);
58900         return tag_ptr(ret_conv, true);
58901 }
58902
58903 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
58904         LDKHTLCOutputInCommitment htlc_conv;
58905         htlc_conv.inner = untag_ptr(htlc);
58906         htlc_conv.is_owned = ptr_is_owned(htlc);
58907         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
58908         htlc_conv.is_owned = false;
58909         LDKChannelTypeFeatures channel_type_features_conv;
58910         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58911         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58912         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58913         channel_type_features_conv.is_owned = false;
58914         LDKTxCreationKeys keys_conv;
58915         keys_conv.inner = untag_ptr(keys);
58916         keys_conv.is_owned = ptr_is_owned(keys);
58917         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
58918         keys_conv.is_owned = false;
58919         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
58920         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58921         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58922         CVec_u8Z_free(ret_var);
58923         return ret_arr;
58924 }
58925
58926 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
58927         LDKPublicKey broadcaster_ref;
58928         CHECK(broadcaster->arr_len == 33);
58929         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
58930         LDKPublicKey countersignatory_ref;
58931         CHECK(countersignatory->arr_len == 33);
58932         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
58933         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
58934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58936         CVec_u8Z_free(ret_var);
58937         return ret_arr;
58938 }
58939
58940 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) {
58941         uint8_t commitment_txid_arr[32];
58942         CHECK(commitment_txid->arr_len == 32);
58943         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
58944         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
58945         LDKHTLCOutputInCommitment htlc_conv;
58946         htlc_conv.inner = untag_ptr(htlc);
58947         htlc_conv.is_owned = ptr_is_owned(htlc);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
58949         htlc_conv.is_owned = false;
58950         LDKChannelTypeFeatures channel_type_features_conv;
58951         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58952         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58953         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58954         channel_type_features_conv.is_owned = false;
58955         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
58956         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
58957         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
58958         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
58959         broadcaster_delayed_payment_key_conv.is_owned = false;
58960         LDKRevocationKey revocation_key_conv;
58961         revocation_key_conv.inner = untag_ptr(revocation_key);
58962         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
58963         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
58964         revocation_key_conv.is_owned = false;
58965         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);
58966         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58967         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58968         Transaction_free(ret_var);
58969         return ret_arr;
58970 }
58971
58972 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) {
58973         LDKECDSASignature local_sig_ref;
58974         CHECK(local_sig->arr_len == 64);
58975         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
58976         LDKECDSASignature remote_sig_ref;
58977         CHECK(remote_sig->arr_len == 64);
58978         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
58979         void* preimage_ptr = untag_ptr(preimage);
58980         CHECK_ACCESS(preimage_ptr);
58981         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
58982         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
58983         LDKu8slice redeem_script_ref;
58984         redeem_script_ref.datalen = redeem_script->arr_len;
58985         redeem_script_ref.data = redeem_script->elems;
58986         LDKChannelTypeFeatures channel_type_features_conv;
58987         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58988         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58989         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58990         channel_type_features_conv.is_owned = false;
58991         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
58992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58994         Witness_free(ret_var);
58995         FREE(redeem_script);
58996         return ret_arr;
58997 }
58998
58999 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
59000         LDKPublicKey payment_point_ref;
59001         CHECK(payment_point->arr_len == 33);
59002         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
59003         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
59004         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59005         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59006         CVec_u8Z_free(ret_var);
59007         return ret_arr;
59008 }
59009
59010 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
59011         LDKPublicKey funding_pubkey_ref;
59012         CHECK(funding_pubkey->arr_len == 33);
59013         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
59014         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
59015         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59016         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59017         CVec_u8Z_free(ret_var);
59018         return ret_arr;
59019 }
59020
59021 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
59022         LDKPublicKey funding_key_ref;
59023         CHECK(funding_key->arr_len == 33);
59024         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
59025         LDKECDSASignature funding_sig_ref;
59026         CHECK(funding_sig->arr_len == 64);
59027         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
59028         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
59029         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59030         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59031         Witness_free(ret_var);
59032         return ret_arr;
59033 }
59034
59035 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
59036         LDKChannelTransactionParameters this_obj_conv;
59037         this_obj_conv.inner = untag_ptr(this_obj);
59038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59040         ChannelTransactionParameters_free(this_obj_conv);
59041 }
59042
59043 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
59044         LDKChannelTransactionParameters this_ptr_conv;
59045         this_ptr_conv.inner = untag_ptr(this_ptr);
59046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59048         this_ptr_conv.is_owned = false;
59049         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
59050         uint64_t ret_ref = 0;
59051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59053         return ret_ref;
59054 }
59055
59056 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
59057         LDKChannelTransactionParameters this_ptr_conv;
59058         this_ptr_conv.inner = untag_ptr(this_ptr);
59059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59061         this_ptr_conv.is_owned = false;
59062         LDKChannelPublicKeys val_conv;
59063         val_conv.inner = untag_ptr(val);
59064         val_conv.is_owned = ptr_is_owned(val);
59065         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59066         val_conv = ChannelPublicKeys_clone(&val_conv);
59067         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
59068 }
59069
59070 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
59071         LDKChannelTransactionParameters this_ptr_conv;
59072         this_ptr_conv.inner = untag_ptr(this_ptr);
59073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59075         this_ptr_conv.is_owned = false;
59076         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
59077         return ret_conv;
59078 }
59079
59080 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) {
59081         LDKChannelTransactionParameters this_ptr_conv;
59082         this_ptr_conv.inner = untag_ptr(this_ptr);
59083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59085         this_ptr_conv.is_owned = false;
59086         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
59087 }
59088
59089 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
59090         LDKChannelTransactionParameters this_ptr_conv;
59091         this_ptr_conv.inner = untag_ptr(this_ptr);
59092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59094         this_ptr_conv.is_owned = false;
59095         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
59096         return ret_conv;
59097 }
59098
59099 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
59100         LDKChannelTransactionParameters this_ptr_conv;
59101         this_ptr_conv.inner = untag_ptr(this_ptr);
59102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59104         this_ptr_conv.is_owned = false;
59105         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
59106 }
59107
59108 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
59109         LDKChannelTransactionParameters this_ptr_conv;
59110         this_ptr_conv.inner = untag_ptr(this_ptr);
59111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59113         this_ptr_conv.is_owned = false;
59114         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
59115         uint64_t ret_ref = 0;
59116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59118         return ret_ref;
59119 }
59120
59121 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
59122         LDKChannelTransactionParameters this_ptr_conv;
59123         this_ptr_conv.inner = untag_ptr(this_ptr);
59124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59126         this_ptr_conv.is_owned = false;
59127         LDKCounterpartyChannelTransactionParameters val_conv;
59128         val_conv.inner = untag_ptr(val);
59129         val_conv.is_owned = ptr_is_owned(val);
59130         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59131         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
59132         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
59133 }
59134
59135 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
59136         LDKChannelTransactionParameters this_ptr_conv;
59137         this_ptr_conv.inner = untag_ptr(this_ptr);
59138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59140         this_ptr_conv.is_owned = false;
59141         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
59142         uint64_t ret_ref = 0;
59143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59145         return ret_ref;
59146 }
59147
59148 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
59149         LDKChannelTransactionParameters this_ptr_conv;
59150         this_ptr_conv.inner = untag_ptr(this_ptr);
59151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59153         this_ptr_conv.is_owned = false;
59154         LDKOutPoint val_conv;
59155         val_conv.inner = untag_ptr(val);
59156         val_conv.is_owned = ptr_is_owned(val);
59157         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59158         val_conv = OutPoint_clone(&val_conv);
59159         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
59160 }
59161
59162 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
59163         LDKChannelTransactionParameters this_ptr_conv;
59164         this_ptr_conv.inner = untag_ptr(this_ptr);
59165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59167         this_ptr_conv.is_owned = false;
59168         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_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 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
59176         LDKChannelTransactionParameters this_ptr_conv;
59177         this_ptr_conv.inner = untag_ptr(this_ptr);
59178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59180         this_ptr_conv.is_owned = false;
59181         LDKChannelTypeFeatures val_conv;
59182         val_conv.inner = untag_ptr(val);
59183         val_conv.is_owned = ptr_is_owned(val);
59184         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59185         val_conv = ChannelTypeFeatures_clone(&val_conv);
59186         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
59187 }
59188
59189 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) {
59190         LDKChannelPublicKeys holder_pubkeys_arg_conv;
59191         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
59192         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
59193         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
59194         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
59195         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
59196         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
59197         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
59198         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
59199         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
59200         LDKOutPoint funding_outpoint_arg_conv;
59201         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
59202         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
59203         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
59204         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
59205         LDKChannelTypeFeatures channel_type_features_arg_conv;
59206         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
59207         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
59208         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
59209         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
59210         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);
59211         uint64_t ret_ref = 0;
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59214         return ret_ref;
59215 }
59216
59217 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
59218         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
59219         uint64_t ret_ref = 0;
59220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59222         return ret_ref;
59223 }
59224 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
59225         LDKChannelTransactionParameters arg_conv;
59226         arg_conv.inner = untag_ptr(arg);
59227         arg_conv.is_owned = ptr_is_owned(arg);
59228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59229         arg_conv.is_owned = false;
59230         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
59231         return ret_conv;
59232 }
59233
59234 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
59235         LDKChannelTransactionParameters orig_conv;
59236         orig_conv.inner = untag_ptr(orig);
59237         orig_conv.is_owned = ptr_is_owned(orig);
59238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59239         orig_conv.is_owned = false;
59240         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
59241         uint64_t ret_ref = 0;
59242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59244         return ret_ref;
59245 }
59246
59247 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_hash"))) TS_ChannelTransactionParameters_hash(uint64_t o) {
59248         LDKChannelTransactionParameters o_conv;
59249         o_conv.inner = untag_ptr(o);
59250         o_conv.is_owned = ptr_is_owned(o);
59251         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59252         o_conv.is_owned = false;
59253         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
59254         return ret_conv;
59255 }
59256
59257 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
59258         LDKChannelTransactionParameters a_conv;
59259         a_conv.inner = untag_ptr(a);
59260         a_conv.is_owned = ptr_is_owned(a);
59261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59262         a_conv.is_owned = false;
59263         LDKChannelTransactionParameters b_conv;
59264         b_conv.inner = untag_ptr(b);
59265         b_conv.is_owned = ptr_is_owned(b);
59266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59267         b_conv.is_owned = false;
59268         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
59269         return ret_conv;
59270 }
59271
59272 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
59273         LDKCounterpartyChannelTransactionParameters this_obj_conv;
59274         this_obj_conv.inner = untag_ptr(this_obj);
59275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59277         CounterpartyChannelTransactionParameters_free(this_obj_conv);
59278 }
59279
59280 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
59281         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59282         this_ptr_conv.inner = untag_ptr(this_ptr);
59283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59285         this_ptr_conv.is_owned = false;
59286         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
59287         uint64_t ret_ref = 0;
59288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59290         return ret_ref;
59291 }
59292
59293 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
59294         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59295         this_ptr_conv.inner = untag_ptr(this_ptr);
59296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59298         this_ptr_conv.is_owned = false;
59299         LDKChannelPublicKeys val_conv;
59300         val_conv.inner = untag_ptr(val);
59301         val_conv.is_owned = ptr_is_owned(val);
59302         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59303         val_conv = ChannelPublicKeys_clone(&val_conv);
59304         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
59305 }
59306
59307 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
59308         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59309         this_ptr_conv.inner = untag_ptr(this_ptr);
59310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59312         this_ptr_conv.is_owned = false;
59313         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
59314         return ret_conv;
59315 }
59316
59317 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
59318         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59319         this_ptr_conv.inner = untag_ptr(this_ptr);
59320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59322         this_ptr_conv.is_owned = false;
59323         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
59324 }
59325
59326 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
59327         LDKChannelPublicKeys pubkeys_arg_conv;
59328         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
59329         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
59330         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
59331         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
59332         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
59333         uint64_t ret_ref = 0;
59334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59336         return ret_ref;
59337 }
59338
59339 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
59340         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
59341         uint64_t ret_ref = 0;
59342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59344         return ret_ref;
59345 }
59346 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
59347         LDKCounterpartyChannelTransactionParameters arg_conv;
59348         arg_conv.inner = untag_ptr(arg);
59349         arg_conv.is_owned = ptr_is_owned(arg);
59350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59351         arg_conv.is_owned = false;
59352         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
59353         return ret_conv;
59354 }
59355
59356 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
59357         LDKCounterpartyChannelTransactionParameters orig_conv;
59358         orig_conv.inner = untag_ptr(orig);
59359         orig_conv.is_owned = ptr_is_owned(orig);
59360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59361         orig_conv.is_owned = false;
59362         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
59363         uint64_t ret_ref = 0;
59364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59366         return ret_ref;
59367 }
59368
59369 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_hash"))) TS_CounterpartyChannelTransactionParameters_hash(uint64_t o) {
59370         LDKCounterpartyChannelTransactionParameters o_conv;
59371         o_conv.inner = untag_ptr(o);
59372         o_conv.is_owned = ptr_is_owned(o);
59373         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59374         o_conv.is_owned = false;
59375         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
59376         return ret_conv;
59377 }
59378
59379 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
59380         LDKCounterpartyChannelTransactionParameters a_conv;
59381         a_conv.inner = untag_ptr(a);
59382         a_conv.is_owned = ptr_is_owned(a);
59383         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59384         a_conv.is_owned = false;
59385         LDKCounterpartyChannelTransactionParameters b_conv;
59386         b_conv.inner = untag_ptr(b);
59387         b_conv.is_owned = ptr_is_owned(b);
59388         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59389         b_conv.is_owned = false;
59390         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
59391         return ret_conv;
59392 }
59393
59394 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
59395         LDKChannelTransactionParameters this_arg_conv;
59396         this_arg_conv.inner = untag_ptr(this_arg);
59397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59399         this_arg_conv.is_owned = false;
59400         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
59401         return ret_conv;
59402 }
59403
59404 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
59405         LDKChannelTransactionParameters this_arg_conv;
59406         this_arg_conv.inner = untag_ptr(this_arg);
59407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59409         this_arg_conv.is_owned = false;
59410         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
59411         uint64_t ret_ref = 0;
59412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59414         return ret_ref;
59415 }
59416
59417 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
59418         LDKChannelTransactionParameters this_arg_conv;
59419         this_arg_conv.inner = untag_ptr(this_arg);
59420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59422         this_arg_conv.is_owned = false;
59423         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
59424         uint64_t ret_ref = 0;
59425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59427         return ret_ref;
59428 }
59429
59430 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
59431         LDKCounterpartyChannelTransactionParameters obj_conv;
59432         obj_conv.inner = untag_ptr(obj);
59433         obj_conv.is_owned = ptr_is_owned(obj);
59434         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59435         obj_conv.is_owned = false;
59436         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
59437         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59438         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59439         CVec_u8Z_free(ret_var);
59440         return ret_arr;
59441 }
59442
59443 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
59444         LDKu8slice ser_ref;
59445         ser_ref.datalen = ser->arr_len;
59446         ser_ref.data = ser->elems;
59447         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
59448         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
59449         FREE(ser);
59450         return tag_ptr(ret_conv, true);
59451 }
59452
59453 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
59454         LDKChannelTransactionParameters obj_conv;
59455         obj_conv.inner = untag_ptr(obj);
59456         obj_conv.is_owned = ptr_is_owned(obj);
59457         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59458         obj_conv.is_owned = false;
59459         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
59460         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59461         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59462         CVec_u8Z_free(ret_var);
59463         return ret_arr;
59464 }
59465
59466 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
59467         LDKu8slice ser_ref;
59468         ser_ref.datalen = ser->arr_len;
59469         ser_ref.data = ser->elems;
59470         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
59471         *ret_conv = ChannelTransactionParameters_read(ser_ref);
59472         FREE(ser);
59473         return tag_ptr(ret_conv, true);
59474 }
59475
59476 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
59477         LDKDirectedChannelTransactionParameters this_obj_conv;
59478         this_obj_conv.inner = untag_ptr(this_obj);
59479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59481         DirectedChannelTransactionParameters_free(this_obj_conv);
59482 }
59483
59484 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
59485         LDKDirectedChannelTransactionParameters this_arg_conv;
59486         this_arg_conv.inner = untag_ptr(this_arg);
59487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59489         this_arg_conv.is_owned = false;
59490         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
59491         uint64_t ret_ref = 0;
59492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59494         return ret_ref;
59495 }
59496
59497 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
59498         LDKDirectedChannelTransactionParameters this_arg_conv;
59499         this_arg_conv.inner = untag_ptr(this_arg);
59500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59502         this_arg_conv.is_owned = false;
59503         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
59504         uint64_t ret_ref = 0;
59505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59507         return ret_ref;
59508 }
59509
59510 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
59511         LDKDirectedChannelTransactionParameters this_arg_conv;
59512         this_arg_conv.inner = untag_ptr(this_arg);
59513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59515         this_arg_conv.is_owned = false;
59516         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
59517         return ret_conv;
59518 }
59519
59520 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
59521         LDKDirectedChannelTransactionParameters this_arg_conv;
59522         this_arg_conv.inner = untag_ptr(this_arg);
59523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59525         this_arg_conv.is_owned = false;
59526         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
59527         return ret_conv;
59528 }
59529
59530 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
59531         LDKDirectedChannelTransactionParameters this_arg_conv;
59532         this_arg_conv.inner = untag_ptr(this_arg);
59533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59535         this_arg_conv.is_owned = false;
59536         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
59537         uint64_t ret_ref = 0;
59538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59540         return ret_ref;
59541 }
59542
59543 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
59544         LDKDirectedChannelTransactionParameters this_arg_conv;
59545         this_arg_conv.inner = untag_ptr(this_arg);
59546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59548         this_arg_conv.is_owned = false;
59549         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
59550         uint64_t ret_ref = 0;
59551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59553         return ret_ref;
59554 }
59555
59556 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
59557         LDKHolderCommitmentTransaction this_obj_conv;
59558         this_obj_conv.inner = untag_ptr(this_obj);
59559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59561         HolderCommitmentTransaction_free(this_obj_conv);
59562 }
59563
59564 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
59565         LDKHolderCommitmentTransaction this_ptr_conv;
59566         this_ptr_conv.inner = untag_ptr(this_ptr);
59567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59569         this_ptr_conv.is_owned = false;
59570         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59571         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
59572         return ret_arr;
59573 }
59574
59575 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
59576         LDKHolderCommitmentTransaction this_ptr_conv;
59577         this_ptr_conv.inner = untag_ptr(this_ptr);
59578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59580         this_ptr_conv.is_owned = false;
59581         LDKECDSASignature val_ref;
59582         CHECK(val->arr_len == 64);
59583         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
59584         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
59585 }
59586
59587 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
59588         LDKHolderCommitmentTransaction this_ptr_conv;
59589         this_ptr_conv.inner = untag_ptr(this_ptr);
59590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59592         this_ptr_conv.is_owned = false;
59593         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
59594         ptrArray ret_arr = NULL;
59595         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
59596         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
59597         for (size_t m = 0; m < ret_var.datalen; m++) {
59598                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
59599                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
59600                 ret_arr_ptr[m] = ret_conv_12_arr;
59601         }
59602         
59603         FREE(ret_var.data);
59604         return ret_arr;
59605 }
59606
59607 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
59608         LDKHolderCommitmentTransaction this_ptr_conv;
59609         this_ptr_conv.inner = untag_ptr(this_ptr);
59610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59612         this_ptr_conv.is_owned = false;
59613         LDKCVec_ECDSASignatureZ val_constr;
59614         val_constr.datalen = val->arr_len;
59615         if (val_constr.datalen > 0)
59616                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
59617         else
59618                 val_constr.data = NULL;
59619         int8_tArray* val_vals = (void*) val->elems;
59620         for (size_t m = 0; m < val_constr.datalen; m++) {
59621                 int8_tArray val_conv_12 = val_vals[m];
59622                 LDKECDSASignature val_conv_12_ref;
59623                 CHECK(val_conv_12->arr_len == 64);
59624                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
59625                 val_constr.data[m] = val_conv_12_ref;
59626         }
59627         FREE(val);
59628         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
59629 }
59630
59631 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
59632         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
59633         uint64_t ret_ref = 0;
59634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59636         return ret_ref;
59637 }
59638 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
59639         LDKHolderCommitmentTransaction arg_conv;
59640         arg_conv.inner = untag_ptr(arg);
59641         arg_conv.is_owned = ptr_is_owned(arg);
59642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59643         arg_conv.is_owned = false;
59644         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
59645         return ret_conv;
59646 }
59647
59648 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
59649         LDKHolderCommitmentTransaction orig_conv;
59650         orig_conv.inner = untag_ptr(orig);
59651         orig_conv.is_owned = ptr_is_owned(orig);
59652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59653         orig_conv.is_owned = false;
59654         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
59655         uint64_t ret_ref = 0;
59656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59658         return ret_ref;
59659 }
59660
59661 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
59662         LDKHolderCommitmentTransaction obj_conv;
59663         obj_conv.inner = untag_ptr(obj);
59664         obj_conv.is_owned = ptr_is_owned(obj);
59665         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59666         obj_conv.is_owned = false;
59667         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
59668         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59669         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59670         CVec_u8Z_free(ret_var);
59671         return ret_arr;
59672 }
59673
59674 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
59675         LDKu8slice ser_ref;
59676         ser_ref.datalen = ser->arr_len;
59677         ser_ref.data = ser->elems;
59678         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
59679         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
59680         FREE(ser);
59681         return tag_ptr(ret_conv, true);
59682 }
59683
59684 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) {
59685         LDKCommitmentTransaction commitment_tx_conv;
59686         commitment_tx_conv.inner = untag_ptr(commitment_tx);
59687         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
59688         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
59689         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
59690         LDKECDSASignature counterparty_sig_ref;
59691         CHECK(counterparty_sig->arr_len == 64);
59692         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
59693         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
59694         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
59695         if (counterparty_htlc_sigs_constr.datalen > 0)
59696                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
59697         else
59698                 counterparty_htlc_sigs_constr.data = NULL;
59699         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
59700         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
59701                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
59702                 LDKECDSASignature counterparty_htlc_sigs_conv_12_ref;
59703                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
59704                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
59705                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
59706         }
59707         FREE(counterparty_htlc_sigs);
59708         LDKPublicKey holder_funding_key_ref;
59709         CHECK(holder_funding_key->arr_len == 33);
59710         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
59711         LDKPublicKey counterparty_funding_key_ref;
59712         CHECK(counterparty_funding_key->arr_len == 33);
59713         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
59714         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
59715         uint64_t ret_ref = 0;
59716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59718         return ret_ref;
59719 }
59720
59721 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
59722         LDKBuiltCommitmentTransaction this_obj_conv;
59723         this_obj_conv.inner = untag_ptr(this_obj);
59724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59726         BuiltCommitmentTransaction_free(this_obj_conv);
59727 }
59728
59729 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
59730         LDKBuiltCommitmentTransaction this_ptr_conv;
59731         this_ptr_conv.inner = untag_ptr(this_ptr);
59732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59734         this_ptr_conv.is_owned = false;
59735         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
59736         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59737         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59738         Transaction_free(ret_var);
59739         return ret_arr;
59740 }
59741
59742 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
59743         LDKBuiltCommitmentTransaction this_ptr_conv;
59744         this_ptr_conv.inner = untag_ptr(this_ptr);
59745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59747         this_ptr_conv.is_owned = false;
59748         LDKTransaction val_ref;
59749         val_ref.datalen = val->arr_len;
59750         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
59751         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
59752         val_ref.data_is_owned = true;
59753         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
59754 }
59755
59756 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
59757         LDKBuiltCommitmentTransaction this_ptr_conv;
59758         this_ptr_conv.inner = untag_ptr(this_ptr);
59759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59761         this_ptr_conv.is_owned = false;
59762         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59763         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
59764         return ret_arr;
59765 }
59766
59767 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
59768         LDKBuiltCommitmentTransaction this_ptr_conv;
59769         this_ptr_conv.inner = untag_ptr(this_ptr);
59770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59772         this_ptr_conv.is_owned = false;
59773         LDKThirtyTwoBytes val_ref;
59774         CHECK(val->arr_len == 32);
59775         memcpy(val_ref.data, val->elems, 32); FREE(val);
59776         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
59777 }
59778
59779 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
59780         LDKTransaction transaction_arg_ref;
59781         transaction_arg_ref.datalen = transaction_arg->arr_len;
59782         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
59783         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
59784         transaction_arg_ref.data_is_owned = true;
59785         LDKThirtyTwoBytes txid_arg_ref;
59786         CHECK(txid_arg->arr_len == 32);
59787         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
59788         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
59789         uint64_t ret_ref = 0;
59790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59792         return ret_ref;
59793 }
59794
59795 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
59796         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
59797         uint64_t ret_ref = 0;
59798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59800         return ret_ref;
59801 }
59802 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
59803         LDKBuiltCommitmentTransaction arg_conv;
59804         arg_conv.inner = untag_ptr(arg);
59805         arg_conv.is_owned = ptr_is_owned(arg);
59806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59807         arg_conv.is_owned = false;
59808         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
59809         return ret_conv;
59810 }
59811
59812 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
59813         LDKBuiltCommitmentTransaction orig_conv;
59814         orig_conv.inner = untag_ptr(orig);
59815         orig_conv.is_owned = ptr_is_owned(orig);
59816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59817         orig_conv.is_owned = false;
59818         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
59819         uint64_t ret_ref = 0;
59820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59822         return ret_ref;
59823 }
59824
59825 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
59826         LDKBuiltCommitmentTransaction obj_conv;
59827         obj_conv.inner = untag_ptr(obj);
59828         obj_conv.is_owned = ptr_is_owned(obj);
59829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59830         obj_conv.is_owned = false;
59831         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
59832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59834         CVec_u8Z_free(ret_var);
59835         return ret_arr;
59836 }
59837
59838 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
59839         LDKu8slice ser_ref;
59840         ser_ref.datalen = ser->arr_len;
59841         ser_ref.data = ser->elems;
59842         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
59843         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
59844         FREE(ser);
59845         return tag_ptr(ret_conv, true);
59846 }
59847
59848 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) {
59849         LDKBuiltCommitmentTransaction this_arg_conv;
59850         this_arg_conv.inner = untag_ptr(this_arg);
59851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59853         this_arg_conv.is_owned = false;
59854         LDKu8slice funding_redeemscript_ref;
59855         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
59856         funding_redeemscript_ref.data = funding_redeemscript->elems;
59857         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59858         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
59859         FREE(funding_redeemscript);
59860         return ret_arr;
59861 }
59862
59863 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) {
59864         LDKBuiltCommitmentTransaction this_arg_conv;
59865         this_arg_conv.inner = untag_ptr(this_arg);
59866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59868         this_arg_conv.is_owned = false;
59869         uint8_t funding_key_arr[32];
59870         CHECK(funding_key->arr_len == 32);
59871         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
59872         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
59873         LDKu8slice funding_redeemscript_ref;
59874         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
59875         funding_redeemscript_ref.data = funding_redeemscript->elems;
59876         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59877         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
59878         FREE(funding_redeemscript);
59879         return ret_arr;
59880 }
59881
59882 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) {
59883         LDKBuiltCommitmentTransaction this_arg_conv;
59884         this_arg_conv.inner = untag_ptr(this_arg);
59885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59887         this_arg_conv.is_owned = false;
59888         uint8_t funding_key_arr[32];
59889         CHECK(funding_key->arr_len == 32);
59890         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
59891         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
59892         LDKu8slice funding_redeemscript_ref;
59893         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
59894         funding_redeemscript_ref.data = funding_redeemscript->elems;
59895         void* entropy_source_ptr = untag_ptr(entropy_source);
59896         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
59897         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
59898         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59899         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);
59900         FREE(funding_redeemscript);
59901         return ret_arr;
59902 }
59903
59904 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
59905         LDKClosingTransaction this_obj_conv;
59906         this_obj_conv.inner = untag_ptr(this_obj);
59907         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59909         ClosingTransaction_free(this_obj_conv);
59910 }
59911
59912 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
59913         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
59914         uint64_t ret_ref = 0;
59915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59917         return ret_ref;
59918 }
59919 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
59920         LDKClosingTransaction arg_conv;
59921         arg_conv.inner = untag_ptr(arg);
59922         arg_conv.is_owned = ptr_is_owned(arg);
59923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59924         arg_conv.is_owned = false;
59925         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
59926         return ret_conv;
59927 }
59928
59929 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
59930         LDKClosingTransaction orig_conv;
59931         orig_conv.inner = untag_ptr(orig);
59932         orig_conv.is_owned = ptr_is_owned(orig);
59933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59934         orig_conv.is_owned = false;
59935         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
59936         uint64_t ret_ref = 0;
59937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59939         return ret_ref;
59940 }
59941
59942 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
59943         LDKClosingTransaction o_conv;
59944         o_conv.inner = untag_ptr(o);
59945         o_conv.is_owned = ptr_is_owned(o);
59946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59947         o_conv.is_owned = false;
59948         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
59949         return ret_conv;
59950 }
59951
59952 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
59953         LDKClosingTransaction a_conv;
59954         a_conv.inner = untag_ptr(a);
59955         a_conv.is_owned = ptr_is_owned(a);
59956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59957         a_conv.is_owned = false;
59958         LDKClosingTransaction b_conv;
59959         b_conv.inner = untag_ptr(b);
59960         b_conv.is_owned = ptr_is_owned(b);
59961         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59962         b_conv.is_owned = false;
59963         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
59964         return ret_conv;
59965 }
59966
59967 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) {
59968         LDKCVec_u8Z to_holder_script_ref;
59969         to_holder_script_ref.datalen = to_holder_script->arr_len;
59970         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
59971         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
59972         LDKCVec_u8Z to_counterparty_script_ref;
59973         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
59974         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
59975         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
59976         LDKOutPoint funding_outpoint_conv;
59977         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
59978         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
59980         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
59981         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
59982         uint64_t ret_ref = 0;
59983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59985         return ret_ref;
59986 }
59987
59988 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
59989         LDKClosingTransaction this_arg_conv;
59990         this_arg_conv.inner = untag_ptr(this_arg);
59991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59993         this_arg_conv.is_owned = false;
59994         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
59995         uint64_t ret_ref = 0;
59996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59998         return ret_ref;
59999 }
60000
60001 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
60002         LDKClosingTransaction this_arg_conv;
60003         this_arg_conv.inner = untag_ptr(this_arg);
60004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60006         this_arg_conv.is_owned = false;
60007         LDKOutPoint funding_outpoint_conv;
60008         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60009         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60010         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60011         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60012         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
60013         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
60014         return tag_ptr(ret_conv, true);
60015 }
60016
60017 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
60018         LDKClosingTransaction this_arg_conv;
60019         this_arg_conv.inner = untag_ptr(this_arg);
60020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60022         this_arg_conv.is_owned = false;
60023         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
60024         return ret_conv;
60025 }
60026
60027 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
60028         LDKClosingTransaction this_arg_conv;
60029         this_arg_conv.inner = untag_ptr(this_arg);
60030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60032         this_arg_conv.is_owned = false;
60033         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
60034         return ret_conv;
60035 }
60036
60037 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
60038         LDKClosingTransaction this_arg_conv;
60039         this_arg_conv.inner = untag_ptr(this_arg);
60040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60042         this_arg_conv.is_owned = false;
60043         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
60044         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60045         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60046         return ret_arr;
60047 }
60048
60049 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
60050         LDKClosingTransaction this_arg_conv;
60051         this_arg_conv.inner = untag_ptr(this_arg);
60052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60054         this_arg_conv.is_owned = false;
60055         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
60056         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60057         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60058         return ret_arr;
60059 }
60060
60061 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
60062         LDKTrustedClosingTransaction this_obj_conv;
60063         this_obj_conv.inner = untag_ptr(this_obj);
60064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60066         TrustedClosingTransaction_free(this_obj_conv);
60067 }
60068
60069 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
60070         LDKTrustedClosingTransaction this_arg_conv;
60071         this_arg_conv.inner = untag_ptr(this_arg);
60072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60074         this_arg_conv.is_owned = false;
60075         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
60076         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60077         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60078         Transaction_free(ret_var);
60079         return ret_arr;
60080 }
60081
60082 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) {
60083         LDKTrustedClosingTransaction this_arg_conv;
60084         this_arg_conv.inner = untag_ptr(this_arg);
60085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60087         this_arg_conv.is_owned = false;
60088         LDKu8slice funding_redeemscript_ref;
60089         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60090         funding_redeemscript_ref.data = funding_redeemscript->elems;
60091         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60092         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
60093         FREE(funding_redeemscript);
60094         return ret_arr;
60095 }
60096
60097 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) {
60098         LDKTrustedClosingTransaction this_arg_conv;
60099         this_arg_conv.inner = untag_ptr(this_arg);
60100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60102         this_arg_conv.is_owned = false;
60103         uint8_t funding_key_arr[32];
60104         CHECK(funding_key->arr_len == 32);
60105         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
60106         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60107         LDKu8slice funding_redeemscript_ref;
60108         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60109         funding_redeemscript_ref.data = funding_redeemscript->elems;
60110         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60111         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
60112         FREE(funding_redeemscript);
60113         return ret_arr;
60114 }
60115
60116 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
60117         LDKCommitmentTransaction this_obj_conv;
60118         this_obj_conv.inner = untag_ptr(this_obj);
60119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60121         CommitmentTransaction_free(this_obj_conv);
60122 }
60123
60124 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
60125         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
60126         uint64_t ret_ref = 0;
60127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60129         return ret_ref;
60130 }
60131 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
60132         LDKCommitmentTransaction arg_conv;
60133         arg_conv.inner = untag_ptr(arg);
60134         arg_conv.is_owned = ptr_is_owned(arg);
60135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60136         arg_conv.is_owned = false;
60137         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
60138         return ret_conv;
60139 }
60140
60141 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
60142         LDKCommitmentTransaction orig_conv;
60143         orig_conv.inner = untag_ptr(orig);
60144         orig_conv.is_owned = ptr_is_owned(orig);
60145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60146         orig_conv.is_owned = false;
60147         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
60148         uint64_t ret_ref = 0;
60149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60151         return ret_ref;
60152 }
60153
60154 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
60155         LDKCommitmentTransaction obj_conv;
60156         obj_conv.inner = untag_ptr(obj);
60157         obj_conv.is_owned = ptr_is_owned(obj);
60158         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60159         obj_conv.is_owned = false;
60160         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
60161         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60162         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60163         CVec_u8Z_free(ret_var);
60164         return ret_arr;
60165 }
60166
60167 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
60168         LDKu8slice ser_ref;
60169         ser_ref.datalen = ser->arr_len;
60170         ser_ref.data = ser->elems;
60171         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
60172         *ret_conv = CommitmentTransaction_read(ser_ref);
60173         FREE(ser);
60174         return tag_ptr(ret_conv, true);
60175 }
60176
60177 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
60178         LDKCommitmentTransaction this_arg_conv;
60179         this_arg_conv.inner = untag_ptr(this_arg);
60180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60182         this_arg_conv.is_owned = false;
60183         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
60184         return ret_conv;
60185 }
60186
60187 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_per_commitment_point"))) TS_CommitmentTransaction_per_commitment_point(uint64_t this_arg) {
60188         LDKCommitmentTransaction this_arg_conv;
60189         this_arg_conv.inner = untag_ptr(this_arg);
60190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60192         this_arg_conv.is_owned = false;
60193         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60194         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
60195         return ret_arr;
60196 }
60197
60198 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
60199         LDKCommitmentTransaction this_arg_conv;
60200         this_arg_conv.inner = untag_ptr(this_arg);
60201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60203         this_arg_conv.is_owned = false;
60204         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
60205         return ret_conv;
60206 }
60207
60208 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
60209         LDKCommitmentTransaction this_arg_conv;
60210         this_arg_conv.inner = untag_ptr(this_arg);
60211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60213         this_arg_conv.is_owned = false;
60214         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
60215         return ret_conv;
60216 }
60217
60218 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
60219         LDKCommitmentTransaction this_arg_conv;
60220         this_arg_conv.inner = untag_ptr(this_arg);
60221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60223         this_arg_conv.is_owned = false;
60224         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
60225         return ret_conv;
60226 }
60227
60228 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
60229         LDKCommitmentTransaction this_arg_conv;
60230         this_arg_conv.inner = untag_ptr(this_arg);
60231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60233         this_arg_conv.is_owned = false;
60234         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
60235         uint64_t ret_ref = 0;
60236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60238         return ret_ref;
60239 }
60240
60241 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) {
60242         LDKCommitmentTransaction this_arg_conv;
60243         this_arg_conv.inner = untag_ptr(this_arg);
60244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60246         this_arg_conv.is_owned = false;
60247         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60248         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60249         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60250         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60251         channel_parameters_conv.is_owned = false;
60252         LDKChannelPublicKeys broadcaster_keys_conv;
60253         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
60254         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
60255         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
60256         broadcaster_keys_conv.is_owned = false;
60257         LDKChannelPublicKeys countersignatory_keys_conv;
60258         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
60259         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
60260         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
60261         countersignatory_keys_conv.is_owned = false;
60262         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
60263         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
60264         return tag_ptr(ret_conv, true);
60265 }
60266
60267 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
60268         LDKTrustedCommitmentTransaction this_obj_conv;
60269         this_obj_conv.inner = untag_ptr(this_obj);
60270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60272         TrustedCommitmentTransaction_free(this_obj_conv);
60273 }
60274
60275 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
60276         LDKTrustedCommitmentTransaction this_arg_conv;
60277         this_arg_conv.inner = untag_ptr(this_arg);
60278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60280         this_arg_conv.is_owned = false;
60281         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60282         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
60283         return ret_arr;
60284 }
60285
60286 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
60287         LDKTrustedCommitmentTransaction this_arg_conv;
60288         this_arg_conv.inner = untag_ptr(this_arg);
60289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60291         this_arg_conv.is_owned = false;
60292         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
60293         uint64_t ret_ref = 0;
60294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60296         return ret_ref;
60297 }
60298
60299 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
60300         LDKTrustedCommitmentTransaction this_arg_conv;
60301         this_arg_conv.inner = untag_ptr(this_arg);
60302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60304         this_arg_conv.is_owned = false;
60305         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
60306         uint64_t ret_ref = 0;
60307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60309         return ret_ref;
60310 }
60311
60312 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
60313         LDKTrustedCommitmentTransaction this_arg_conv;
60314         this_arg_conv.inner = untag_ptr(this_arg);
60315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60317         this_arg_conv.is_owned = false;
60318         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
60319         uint64_t ret_ref = 0;
60320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60322         return ret_ref;
60323 }
60324
60325 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) {
60326         LDKTrustedCommitmentTransaction this_arg_conv;
60327         this_arg_conv.inner = untag_ptr(this_arg);
60328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60330         this_arg_conv.is_owned = false;
60331         uint8_t htlc_base_key_arr[32];
60332         CHECK(htlc_base_key->arr_len == 32);
60333         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
60334         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
60335         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60336         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60337         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60338         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60339         channel_parameters_conv.is_owned = false;
60340         void* entropy_source_ptr = untag_ptr(entropy_source);
60341         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60342         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60343         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
60344         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
60345         return tag_ptr(ret_conv, true);
60346 }
60347
60348 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_revokeable_output_index"))) TS_TrustedCommitmentTransaction_revokeable_output_index(uint64_t this_arg) {
60349         LDKTrustedCommitmentTransaction this_arg_conv;
60350         this_arg_conv.inner = untag_ptr(this_arg);
60351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60353         this_arg_conv.is_owned = false;
60354         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
60355         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
60356         uint64_t ret_ref = tag_ptr(ret_copy, true);
60357         return ret_ref;
60358 }
60359
60360 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) {
60361         LDKTrustedCommitmentTransaction this_arg_conv;
60362         this_arg_conv.inner = untag_ptr(this_arg);
60363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60365         this_arg_conv.is_owned = false;
60366         LDKCVec_u8Z destination_script_ref;
60367         destination_script_ref.datalen = destination_script->arr_len;
60368         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
60369         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
60370         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
60371         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
60372         return tag_ptr(ret_conv, true);
60373 }
60374
60375 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) {
60376         LDKPublicKey broadcaster_payment_basepoint_ref;
60377         CHECK(broadcaster_payment_basepoint->arr_len == 33);
60378         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
60379         LDKPublicKey countersignatory_payment_basepoint_ref;
60380         CHECK(countersignatory_payment_basepoint->arr_len == 33);
60381         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
60382         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
60383         return ret_conv;
60384 }
60385
60386 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
60387         LDKInitFeatures a_conv;
60388         a_conv.inner = untag_ptr(a);
60389         a_conv.is_owned = ptr_is_owned(a);
60390         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60391         a_conv.is_owned = false;
60392         LDKInitFeatures b_conv;
60393         b_conv.inner = untag_ptr(b);
60394         b_conv.is_owned = ptr_is_owned(b);
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60396         b_conv.is_owned = false;
60397         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
60398         return ret_conv;
60399 }
60400
60401 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
60402         LDKNodeFeatures a_conv;
60403         a_conv.inner = untag_ptr(a);
60404         a_conv.is_owned = ptr_is_owned(a);
60405         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60406         a_conv.is_owned = false;
60407         LDKNodeFeatures b_conv;
60408         b_conv.inner = untag_ptr(b);
60409         b_conv.is_owned = ptr_is_owned(b);
60410         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60411         b_conv.is_owned = false;
60412         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
60413         return ret_conv;
60414 }
60415
60416 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
60417         LDKChannelFeatures a_conv;
60418         a_conv.inner = untag_ptr(a);
60419         a_conv.is_owned = ptr_is_owned(a);
60420         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60421         a_conv.is_owned = false;
60422         LDKChannelFeatures b_conv;
60423         b_conv.inner = untag_ptr(b);
60424         b_conv.is_owned = ptr_is_owned(b);
60425         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60426         b_conv.is_owned = false;
60427         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
60428         return ret_conv;
60429 }
60430
60431 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
60432         LDKBolt11InvoiceFeatures a_conv;
60433         a_conv.inner = untag_ptr(a);
60434         a_conv.is_owned = ptr_is_owned(a);
60435         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60436         a_conv.is_owned = false;
60437         LDKBolt11InvoiceFeatures b_conv;
60438         b_conv.inner = untag_ptr(b);
60439         b_conv.is_owned = ptr_is_owned(b);
60440         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60441         b_conv.is_owned = false;
60442         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
60443         return ret_conv;
60444 }
60445
60446 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
60447         LDKOfferFeatures a_conv;
60448         a_conv.inner = untag_ptr(a);
60449         a_conv.is_owned = ptr_is_owned(a);
60450         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60451         a_conv.is_owned = false;
60452         LDKOfferFeatures b_conv;
60453         b_conv.inner = untag_ptr(b);
60454         b_conv.is_owned = ptr_is_owned(b);
60455         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60456         b_conv.is_owned = false;
60457         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
60458         return ret_conv;
60459 }
60460
60461 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
60462         LDKInvoiceRequestFeatures a_conv;
60463         a_conv.inner = untag_ptr(a);
60464         a_conv.is_owned = ptr_is_owned(a);
60465         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60466         a_conv.is_owned = false;
60467         LDKInvoiceRequestFeatures b_conv;
60468         b_conv.inner = untag_ptr(b);
60469         b_conv.is_owned = ptr_is_owned(b);
60470         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60471         b_conv.is_owned = false;
60472         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
60473         return ret_conv;
60474 }
60475
60476 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
60477         LDKBolt12InvoiceFeatures a_conv;
60478         a_conv.inner = untag_ptr(a);
60479         a_conv.is_owned = ptr_is_owned(a);
60480         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60481         a_conv.is_owned = false;
60482         LDKBolt12InvoiceFeatures b_conv;
60483         b_conv.inner = untag_ptr(b);
60484         b_conv.is_owned = ptr_is_owned(b);
60485         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60486         b_conv.is_owned = false;
60487         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
60488         return ret_conv;
60489 }
60490
60491 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
60492         LDKBlindedHopFeatures a_conv;
60493         a_conv.inner = untag_ptr(a);
60494         a_conv.is_owned = ptr_is_owned(a);
60495         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60496         a_conv.is_owned = false;
60497         LDKBlindedHopFeatures b_conv;
60498         b_conv.inner = untag_ptr(b);
60499         b_conv.is_owned = ptr_is_owned(b);
60500         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60501         b_conv.is_owned = false;
60502         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
60503         return ret_conv;
60504 }
60505
60506 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
60507         LDKChannelTypeFeatures a_conv;
60508         a_conv.inner = untag_ptr(a);
60509         a_conv.is_owned = ptr_is_owned(a);
60510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60511         a_conv.is_owned = false;
60512         LDKChannelTypeFeatures b_conv;
60513         b_conv.inner = untag_ptr(b);
60514         b_conv.is_owned = ptr_is_owned(b);
60515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60516         b_conv.is_owned = false;
60517         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
60518         return ret_conv;
60519 }
60520
60521 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
60522         LDKInitFeatures ret_var = InitFeatures_clone(arg);
60523         uint64_t ret_ref = 0;
60524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60526         return ret_ref;
60527 }
60528 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
60529         LDKInitFeatures arg_conv;
60530         arg_conv.inner = untag_ptr(arg);
60531         arg_conv.is_owned = ptr_is_owned(arg);
60532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60533         arg_conv.is_owned = false;
60534         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
60535         return ret_conv;
60536 }
60537
60538 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
60539         LDKInitFeatures orig_conv;
60540         orig_conv.inner = untag_ptr(orig);
60541         orig_conv.is_owned = ptr_is_owned(orig);
60542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60543         orig_conv.is_owned = false;
60544         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
60545         uint64_t ret_ref = 0;
60546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60548         return ret_ref;
60549 }
60550
60551 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
60552         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
60553         uint64_t ret_ref = 0;
60554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60556         return ret_ref;
60557 }
60558 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
60559         LDKNodeFeatures arg_conv;
60560         arg_conv.inner = untag_ptr(arg);
60561         arg_conv.is_owned = ptr_is_owned(arg);
60562         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60563         arg_conv.is_owned = false;
60564         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
60565         return ret_conv;
60566 }
60567
60568 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
60569         LDKNodeFeatures orig_conv;
60570         orig_conv.inner = untag_ptr(orig);
60571         orig_conv.is_owned = ptr_is_owned(orig);
60572         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60573         orig_conv.is_owned = false;
60574         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
60575         uint64_t ret_ref = 0;
60576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60578         return ret_ref;
60579 }
60580
60581 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
60582         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
60583         uint64_t ret_ref = 0;
60584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60586         return ret_ref;
60587 }
60588 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
60589         LDKChannelFeatures arg_conv;
60590         arg_conv.inner = untag_ptr(arg);
60591         arg_conv.is_owned = ptr_is_owned(arg);
60592         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60593         arg_conv.is_owned = false;
60594         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
60595         return ret_conv;
60596 }
60597
60598 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
60599         LDKChannelFeatures orig_conv;
60600         orig_conv.inner = untag_ptr(orig);
60601         orig_conv.is_owned = ptr_is_owned(orig);
60602         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60603         orig_conv.is_owned = false;
60604         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
60605         uint64_t ret_ref = 0;
60606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60608         return ret_ref;
60609 }
60610
60611 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
60612         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
60613         uint64_t ret_ref = 0;
60614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60616         return ret_ref;
60617 }
60618 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
60619         LDKBolt11InvoiceFeatures arg_conv;
60620         arg_conv.inner = untag_ptr(arg);
60621         arg_conv.is_owned = ptr_is_owned(arg);
60622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60623         arg_conv.is_owned = false;
60624         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
60625         return ret_conv;
60626 }
60627
60628 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
60629         LDKBolt11InvoiceFeatures orig_conv;
60630         orig_conv.inner = untag_ptr(orig);
60631         orig_conv.is_owned = ptr_is_owned(orig);
60632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60633         orig_conv.is_owned = false;
60634         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
60635         uint64_t ret_ref = 0;
60636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60638         return ret_ref;
60639 }
60640
60641 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
60642         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
60643         uint64_t ret_ref = 0;
60644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60646         return ret_ref;
60647 }
60648 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
60649         LDKOfferFeatures arg_conv;
60650         arg_conv.inner = untag_ptr(arg);
60651         arg_conv.is_owned = ptr_is_owned(arg);
60652         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60653         arg_conv.is_owned = false;
60654         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
60655         return ret_conv;
60656 }
60657
60658 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
60659         LDKOfferFeatures orig_conv;
60660         orig_conv.inner = untag_ptr(orig);
60661         orig_conv.is_owned = ptr_is_owned(orig);
60662         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60663         orig_conv.is_owned = false;
60664         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
60665         uint64_t ret_ref = 0;
60666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60668         return ret_ref;
60669 }
60670
60671 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
60672         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
60673         uint64_t ret_ref = 0;
60674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60676         return ret_ref;
60677 }
60678 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
60679         LDKInvoiceRequestFeatures arg_conv;
60680         arg_conv.inner = untag_ptr(arg);
60681         arg_conv.is_owned = ptr_is_owned(arg);
60682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60683         arg_conv.is_owned = false;
60684         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
60685         return ret_conv;
60686 }
60687
60688 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
60689         LDKInvoiceRequestFeatures orig_conv;
60690         orig_conv.inner = untag_ptr(orig);
60691         orig_conv.is_owned = ptr_is_owned(orig);
60692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60693         orig_conv.is_owned = false;
60694         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_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 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
60702         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
60703         uint64_t ret_ref = 0;
60704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60706         return ret_ref;
60707 }
60708 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
60709         LDKBolt12InvoiceFeatures arg_conv;
60710         arg_conv.inner = untag_ptr(arg);
60711         arg_conv.is_owned = ptr_is_owned(arg);
60712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60713         arg_conv.is_owned = false;
60714         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
60715         return ret_conv;
60716 }
60717
60718 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
60719         LDKBolt12InvoiceFeatures orig_conv;
60720         orig_conv.inner = untag_ptr(orig);
60721         orig_conv.is_owned = ptr_is_owned(orig);
60722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60723         orig_conv.is_owned = false;
60724         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
60725         uint64_t ret_ref = 0;
60726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60728         return ret_ref;
60729 }
60730
60731 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
60732         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
60733         uint64_t ret_ref = 0;
60734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60736         return ret_ref;
60737 }
60738 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
60739         LDKBlindedHopFeatures arg_conv;
60740         arg_conv.inner = untag_ptr(arg);
60741         arg_conv.is_owned = ptr_is_owned(arg);
60742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60743         arg_conv.is_owned = false;
60744         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
60745         return ret_conv;
60746 }
60747
60748 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
60749         LDKBlindedHopFeatures orig_conv;
60750         orig_conv.inner = untag_ptr(orig);
60751         orig_conv.is_owned = ptr_is_owned(orig);
60752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60753         orig_conv.is_owned = false;
60754         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_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 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
60762         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
60763         uint64_t ret_ref = 0;
60764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60766         return ret_ref;
60767 }
60768 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
60769         LDKChannelTypeFeatures arg_conv;
60770         arg_conv.inner = untag_ptr(arg);
60771         arg_conv.is_owned = ptr_is_owned(arg);
60772         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60773         arg_conv.is_owned = false;
60774         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
60775         return ret_conv;
60776 }
60777
60778 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
60779         LDKChannelTypeFeatures orig_conv;
60780         orig_conv.inner = untag_ptr(orig);
60781         orig_conv.is_owned = ptr_is_owned(orig);
60782         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60783         orig_conv.is_owned = false;
60784         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
60785         uint64_t ret_ref = 0;
60786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60788         return ret_ref;
60789 }
60790
60791 int64_t  __attribute__((export_name("TS_InitFeatures_hash"))) TS_InitFeatures_hash(uint64_t o) {
60792         LDKInitFeatures o_conv;
60793         o_conv.inner = untag_ptr(o);
60794         o_conv.is_owned = ptr_is_owned(o);
60795         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60796         o_conv.is_owned = false;
60797         int64_t ret_conv = InitFeatures_hash(&o_conv);
60798         return ret_conv;
60799 }
60800
60801 int64_t  __attribute__((export_name("TS_NodeFeatures_hash"))) TS_NodeFeatures_hash(uint64_t o) {
60802         LDKNodeFeatures o_conv;
60803         o_conv.inner = untag_ptr(o);
60804         o_conv.is_owned = ptr_is_owned(o);
60805         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60806         o_conv.is_owned = false;
60807         int64_t ret_conv = NodeFeatures_hash(&o_conv);
60808         return ret_conv;
60809 }
60810
60811 int64_t  __attribute__((export_name("TS_ChannelFeatures_hash"))) TS_ChannelFeatures_hash(uint64_t o) {
60812         LDKChannelFeatures o_conv;
60813         o_conv.inner = untag_ptr(o);
60814         o_conv.is_owned = ptr_is_owned(o);
60815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60816         o_conv.is_owned = false;
60817         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
60818         return ret_conv;
60819 }
60820
60821 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_hash"))) TS_Bolt11InvoiceFeatures_hash(uint64_t o) {
60822         LDKBolt11InvoiceFeatures o_conv;
60823         o_conv.inner = untag_ptr(o);
60824         o_conv.is_owned = ptr_is_owned(o);
60825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60826         o_conv.is_owned = false;
60827         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
60828         return ret_conv;
60829 }
60830
60831 int64_t  __attribute__((export_name("TS_OfferFeatures_hash"))) TS_OfferFeatures_hash(uint64_t o) {
60832         LDKOfferFeatures o_conv;
60833         o_conv.inner = untag_ptr(o);
60834         o_conv.is_owned = ptr_is_owned(o);
60835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60836         o_conv.is_owned = false;
60837         int64_t ret_conv = OfferFeatures_hash(&o_conv);
60838         return ret_conv;
60839 }
60840
60841 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_hash"))) TS_InvoiceRequestFeatures_hash(uint64_t o) {
60842         LDKInvoiceRequestFeatures o_conv;
60843         o_conv.inner = untag_ptr(o);
60844         o_conv.is_owned = ptr_is_owned(o);
60845         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60846         o_conv.is_owned = false;
60847         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
60848         return ret_conv;
60849 }
60850
60851 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_hash"))) TS_Bolt12InvoiceFeatures_hash(uint64_t o) {
60852         LDKBolt12InvoiceFeatures o_conv;
60853         o_conv.inner = untag_ptr(o);
60854         o_conv.is_owned = ptr_is_owned(o);
60855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60856         o_conv.is_owned = false;
60857         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
60858         return ret_conv;
60859 }
60860
60861 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_hash"))) TS_BlindedHopFeatures_hash(uint64_t o) {
60862         LDKBlindedHopFeatures o_conv;
60863         o_conv.inner = untag_ptr(o);
60864         o_conv.is_owned = ptr_is_owned(o);
60865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60866         o_conv.is_owned = false;
60867         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
60868         return ret_conv;
60869 }
60870
60871 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_hash"))) TS_ChannelTypeFeatures_hash(uint64_t o) {
60872         LDKChannelTypeFeatures o_conv;
60873         o_conv.inner = untag_ptr(o);
60874         o_conv.is_owned = ptr_is_owned(o);
60875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60876         o_conv.is_owned = false;
60877         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
60878         return ret_conv;
60879 }
60880
60881 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
60882         LDKInitFeatures this_obj_conv;
60883         this_obj_conv.inner = untag_ptr(this_obj);
60884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60886         InitFeatures_free(this_obj_conv);
60887 }
60888
60889 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
60890         LDKNodeFeatures this_obj_conv;
60891         this_obj_conv.inner = untag_ptr(this_obj);
60892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60894         NodeFeatures_free(this_obj_conv);
60895 }
60896
60897 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
60898         LDKChannelFeatures this_obj_conv;
60899         this_obj_conv.inner = untag_ptr(this_obj);
60900         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60902         ChannelFeatures_free(this_obj_conv);
60903 }
60904
60905 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
60906         LDKBolt11InvoiceFeatures this_obj_conv;
60907         this_obj_conv.inner = untag_ptr(this_obj);
60908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60910         Bolt11InvoiceFeatures_free(this_obj_conv);
60911 }
60912
60913 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
60914         LDKOfferFeatures this_obj_conv;
60915         this_obj_conv.inner = untag_ptr(this_obj);
60916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60918         OfferFeatures_free(this_obj_conv);
60919 }
60920
60921 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
60922         LDKInvoiceRequestFeatures this_obj_conv;
60923         this_obj_conv.inner = untag_ptr(this_obj);
60924         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60926         InvoiceRequestFeatures_free(this_obj_conv);
60927 }
60928
60929 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
60930         LDKBolt12InvoiceFeatures this_obj_conv;
60931         this_obj_conv.inner = untag_ptr(this_obj);
60932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60934         Bolt12InvoiceFeatures_free(this_obj_conv);
60935 }
60936
60937 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
60938         LDKBlindedHopFeatures this_obj_conv;
60939         this_obj_conv.inner = untag_ptr(this_obj);
60940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60942         BlindedHopFeatures_free(this_obj_conv);
60943 }
60944
60945 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
60946         LDKChannelTypeFeatures this_obj_conv;
60947         this_obj_conv.inner = untag_ptr(this_obj);
60948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60950         ChannelTypeFeatures_free(this_obj_conv);
60951 }
60952
60953 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
60954         LDKInitFeatures ret_var = InitFeatures_empty();
60955         uint64_t ret_ref = 0;
60956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60958         return ret_ref;
60959 }
60960
60961 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
60962         LDKInitFeatures this_arg_conv;
60963         this_arg_conv.inner = untag_ptr(this_arg);
60964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60966         this_arg_conv.is_owned = false;
60967         LDKInitFeatures other_conv;
60968         other_conv.inner = untag_ptr(other);
60969         other_conv.is_owned = ptr_is_owned(other);
60970         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60971         other_conv.is_owned = false;
60972         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60973         return ret_conv;
60974 }
60975
60976 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
60977         LDKInitFeatures this_arg_conv;
60978         this_arg_conv.inner = untag_ptr(this_arg);
60979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60981         this_arg_conv.is_owned = false;
60982         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
60983         return ret_conv;
60984 }
60985
60986 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_feature_bit"))) TS_InitFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
60987         LDKInitFeatures this_arg_conv;
60988         this_arg_conv.inner = untag_ptr(this_arg);
60989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60991         this_arg_conv.is_owned = false;
60992         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60993         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
60994         return tag_ptr(ret_conv, true);
60995 }
60996
60997 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_feature_bit"))) TS_InitFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
60998         LDKInitFeatures this_arg_conv;
60999         this_arg_conv.inner = untag_ptr(this_arg);
61000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61002         this_arg_conv.is_owned = false;
61003         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61004         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61005         return tag_ptr(ret_conv, true);
61006 }
61007
61008 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61009         LDKInitFeatures this_arg_conv;
61010         this_arg_conv.inner = untag_ptr(this_arg);
61011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61013         this_arg_conv.is_owned = false;
61014         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61015         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
61016         return tag_ptr(ret_conv, true);
61017 }
61018
61019 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61020         LDKInitFeatures this_arg_conv;
61021         this_arg_conv.inner = untag_ptr(this_arg);
61022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61024         this_arg_conv.is_owned = false;
61025         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61026         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61027         return tag_ptr(ret_conv, true);
61028 }
61029
61030 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
61031         LDKNodeFeatures ret_var = NodeFeatures_empty();
61032         uint64_t ret_ref = 0;
61033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61035         return ret_ref;
61036 }
61037
61038 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61039         LDKNodeFeatures this_arg_conv;
61040         this_arg_conv.inner = untag_ptr(this_arg);
61041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61043         this_arg_conv.is_owned = false;
61044         LDKNodeFeatures other_conv;
61045         other_conv.inner = untag_ptr(other);
61046         other_conv.is_owned = ptr_is_owned(other);
61047         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61048         other_conv.is_owned = false;
61049         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61050         return ret_conv;
61051 }
61052
61053 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
61054         LDKNodeFeatures this_arg_conv;
61055         this_arg_conv.inner = untag_ptr(this_arg);
61056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61058         this_arg_conv.is_owned = false;
61059         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
61060         return ret_conv;
61061 }
61062
61063 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_feature_bit"))) TS_NodeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61064         LDKNodeFeatures this_arg_conv;
61065         this_arg_conv.inner = untag_ptr(this_arg);
61066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61068         this_arg_conv.is_owned = false;
61069         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61070         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61071         return tag_ptr(ret_conv, true);
61072 }
61073
61074 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_feature_bit"))) TS_NodeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61075         LDKNodeFeatures this_arg_conv;
61076         this_arg_conv.inner = untag_ptr(this_arg);
61077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61079         this_arg_conv.is_owned = false;
61080         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61081         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61082         return tag_ptr(ret_conv, true);
61083 }
61084
61085 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61086         LDKNodeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61092         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61093         return tag_ptr(ret_conv, true);
61094 }
61095
61096 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61097         LDKNodeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61103         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61104         return tag_ptr(ret_conv, true);
61105 }
61106
61107 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
61108         LDKChannelFeatures ret_var = ChannelFeatures_empty();
61109         uint64_t ret_ref = 0;
61110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61112         return ret_ref;
61113 }
61114
61115 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61116         LDKChannelFeatures this_arg_conv;
61117         this_arg_conv.inner = untag_ptr(this_arg);
61118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61120         this_arg_conv.is_owned = false;
61121         LDKChannelFeatures other_conv;
61122         other_conv.inner = untag_ptr(other);
61123         other_conv.is_owned = ptr_is_owned(other);
61124         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61125         other_conv.is_owned = false;
61126         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61127         return ret_conv;
61128 }
61129
61130 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
61131         LDKChannelFeatures this_arg_conv;
61132         this_arg_conv.inner = untag_ptr(this_arg);
61133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61135         this_arg_conv.is_owned = false;
61136         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
61137         return ret_conv;
61138 }
61139
61140 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_feature_bit"))) TS_ChannelFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61141         LDKChannelFeatures this_arg_conv;
61142         this_arg_conv.inner = untag_ptr(this_arg);
61143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61145         this_arg_conv.is_owned = false;
61146         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61147         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
61148         return tag_ptr(ret_conv, true);
61149 }
61150
61151 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_feature_bit"))) TS_ChannelFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61152         LDKChannelFeatures this_arg_conv;
61153         this_arg_conv.inner = untag_ptr(this_arg);
61154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61156         this_arg_conv.is_owned = false;
61157         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61158         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61159         return tag_ptr(ret_conv, true);
61160 }
61161
61162 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61163         LDKChannelFeatures this_arg_conv;
61164         this_arg_conv.inner = untag_ptr(this_arg);
61165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61167         this_arg_conv.is_owned = false;
61168         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61169         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
61170         return tag_ptr(ret_conv, true);
61171 }
61172
61173 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61174         LDKChannelFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61180         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61181         return tag_ptr(ret_conv, true);
61182 }
61183
61184 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
61185         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
61186         uint64_t ret_ref = 0;
61187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61189         return ret_ref;
61190 }
61191
61192 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61193         LDKBolt11InvoiceFeatures this_arg_conv;
61194         this_arg_conv.inner = untag_ptr(this_arg);
61195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61197         this_arg_conv.is_owned = false;
61198         LDKBolt11InvoiceFeatures other_conv;
61199         other_conv.inner = untag_ptr(other);
61200         other_conv.is_owned = ptr_is_owned(other);
61201         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61202         other_conv.is_owned = false;
61203         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61204         return ret_conv;
61205 }
61206
61207 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
61208         LDKBolt11InvoiceFeatures this_arg_conv;
61209         this_arg_conv.inner = untag_ptr(this_arg);
61210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61212         this_arg_conv.is_owned = false;
61213         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61214         return ret_conv;
61215 }
61216
61217 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_feature_bit"))) TS_Bolt11InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61218         LDKBolt11InvoiceFeatures this_arg_conv;
61219         this_arg_conv.inner = untag_ptr(this_arg);
61220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61222         this_arg_conv.is_owned = false;
61223         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61224         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61225         return tag_ptr(ret_conv, true);
61226 }
61227
61228 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt11InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61229         LDKBolt11InvoiceFeatures this_arg_conv;
61230         this_arg_conv.inner = untag_ptr(this_arg);
61231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61233         this_arg_conv.is_owned = false;
61234         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61235         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61236         return tag_ptr(ret_conv, true);
61237 }
61238
61239 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61240         LDKBolt11InvoiceFeatures this_arg_conv;
61241         this_arg_conv.inner = untag_ptr(this_arg);
61242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61244         this_arg_conv.is_owned = false;
61245         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61246         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61247         return tag_ptr(ret_conv, true);
61248 }
61249
61250 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61251         LDKBolt11InvoiceFeatures this_arg_conv;
61252         this_arg_conv.inner = untag_ptr(this_arg);
61253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61255         this_arg_conv.is_owned = false;
61256         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61257         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61258         return tag_ptr(ret_conv, true);
61259 }
61260
61261 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
61262         LDKOfferFeatures ret_var = OfferFeatures_empty();
61263         uint64_t ret_ref = 0;
61264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61266         return ret_ref;
61267 }
61268
61269 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61270         LDKOfferFeatures this_arg_conv;
61271         this_arg_conv.inner = untag_ptr(this_arg);
61272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61274         this_arg_conv.is_owned = false;
61275         LDKOfferFeatures other_conv;
61276         other_conv.inner = untag_ptr(other);
61277         other_conv.is_owned = ptr_is_owned(other);
61278         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61279         other_conv.is_owned = false;
61280         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61281         return ret_conv;
61282 }
61283
61284 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
61285         LDKOfferFeatures this_arg_conv;
61286         this_arg_conv.inner = untag_ptr(this_arg);
61287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61289         this_arg_conv.is_owned = false;
61290         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
61291         return ret_conv;
61292 }
61293
61294 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_feature_bit"))) TS_OfferFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61295         LDKOfferFeatures this_arg_conv;
61296         this_arg_conv.inner = untag_ptr(this_arg);
61297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61299         this_arg_conv.is_owned = false;
61300         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61301         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
61302         return tag_ptr(ret_conv, true);
61303 }
61304
61305 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_feature_bit"))) TS_OfferFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61306         LDKOfferFeatures this_arg_conv;
61307         this_arg_conv.inner = untag_ptr(this_arg);
61308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61310         this_arg_conv.is_owned = false;
61311         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61312         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61313         return tag_ptr(ret_conv, true);
61314 }
61315
61316 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61317         LDKOfferFeatures this_arg_conv;
61318         this_arg_conv.inner = untag_ptr(this_arg);
61319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61321         this_arg_conv.is_owned = false;
61322         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61323         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
61324         return tag_ptr(ret_conv, true);
61325 }
61326
61327 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61328         LDKOfferFeatures this_arg_conv;
61329         this_arg_conv.inner = untag_ptr(this_arg);
61330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61332         this_arg_conv.is_owned = false;
61333         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61334         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61335         return tag_ptr(ret_conv, true);
61336 }
61337
61338 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
61339         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
61340         uint64_t ret_ref = 0;
61341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61343         return ret_ref;
61344 }
61345
61346 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61347         LDKInvoiceRequestFeatures this_arg_conv;
61348         this_arg_conv.inner = untag_ptr(this_arg);
61349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61351         this_arg_conv.is_owned = false;
61352         LDKInvoiceRequestFeatures other_conv;
61353         other_conv.inner = untag_ptr(other);
61354         other_conv.is_owned = ptr_is_owned(other);
61355         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61356         other_conv.is_owned = false;
61357         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61358         return ret_conv;
61359 }
61360
61361 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
61362         LDKInvoiceRequestFeatures this_arg_conv;
61363         this_arg_conv.inner = untag_ptr(this_arg);
61364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61366         this_arg_conv.is_owned = false;
61367         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
61368         return ret_conv;
61369 }
61370
61371 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_feature_bit"))) TS_InvoiceRequestFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61372         LDKInvoiceRequestFeatures this_arg_conv;
61373         this_arg_conv.inner = untag_ptr(this_arg);
61374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61376         this_arg_conv.is_owned = false;
61377         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61378         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
61379         return tag_ptr(ret_conv, true);
61380 }
61381
61382 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_feature_bit"))) TS_InvoiceRequestFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61383         LDKInvoiceRequestFeatures this_arg_conv;
61384         this_arg_conv.inner = untag_ptr(this_arg);
61385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61387         this_arg_conv.is_owned = false;
61388         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61389         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61390         return tag_ptr(ret_conv, true);
61391 }
61392
61393 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61394         LDKInvoiceRequestFeatures this_arg_conv;
61395         this_arg_conv.inner = untag_ptr(this_arg);
61396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61398         this_arg_conv.is_owned = false;
61399         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61400         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
61401         return tag_ptr(ret_conv, true);
61402 }
61403
61404 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61405         LDKInvoiceRequestFeatures this_arg_conv;
61406         this_arg_conv.inner = untag_ptr(this_arg);
61407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61409         this_arg_conv.is_owned = false;
61410         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61411         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61412         return tag_ptr(ret_conv, true);
61413 }
61414
61415 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
61416         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
61417         uint64_t ret_ref = 0;
61418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61420         return ret_ref;
61421 }
61422
61423 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61424         LDKBolt12InvoiceFeatures this_arg_conv;
61425         this_arg_conv.inner = untag_ptr(this_arg);
61426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61428         this_arg_conv.is_owned = false;
61429         LDKBolt12InvoiceFeatures other_conv;
61430         other_conv.inner = untag_ptr(other);
61431         other_conv.is_owned = ptr_is_owned(other);
61432         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61433         other_conv.is_owned = false;
61434         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61435         return ret_conv;
61436 }
61437
61438 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
61439         LDKBolt12InvoiceFeatures this_arg_conv;
61440         this_arg_conv.inner = untag_ptr(this_arg);
61441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61443         this_arg_conv.is_owned = false;
61444         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61445         return ret_conv;
61446 }
61447
61448 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_feature_bit"))) TS_Bolt12InvoiceFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61449         LDKBolt12InvoiceFeatures this_arg_conv;
61450         this_arg_conv.inner = untag_ptr(this_arg);
61451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61453         this_arg_conv.is_owned = false;
61454         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61455         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61456         return tag_ptr(ret_conv, true);
61457 }
61458
61459 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_feature_bit"))) TS_Bolt12InvoiceFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61460         LDKBolt12InvoiceFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61466         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61467         return tag_ptr(ret_conv, true);
61468 }
61469
61470 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61471         LDKBolt12InvoiceFeatures this_arg_conv;
61472         this_arg_conv.inner = untag_ptr(this_arg);
61473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61475         this_arg_conv.is_owned = false;
61476         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61477         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61478         return tag_ptr(ret_conv, true);
61479 }
61480
61481 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61482         LDKBolt12InvoiceFeatures this_arg_conv;
61483         this_arg_conv.inner = untag_ptr(this_arg);
61484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61486         this_arg_conv.is_owned = false;
61487         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61488         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61489         return tag_ptr(ret_conv, true);
61490 }
61491
61492 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
61493         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
61494         uint64_t ret_ref = 0;
61495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61497         return ret_ref;
61498 }
61499
61500 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61501         LDKBlindedHopFeatures this_arg_conv;
61502         this_arg_conv.inner = untag_ptr(this_arg);
61503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61505         this_arg_conv.is_owned = false;
61506         LDKBlindedHopFeatures other_conv;
61507         other_conv.inner = untag_ptr(other);
61508         other_conv.is_owned = ptr_is_owned(other);
61509         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61510         other_conv.is_owned = false;
61511         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61512         return ret_conv;
61513 }
61514
61515 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
61516         LDKBlindedHopFeatures this_arg_conv;
61517         this_arg_conv.inner = untag_ptr(this_arg);
61518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61520         this_arg_conv.is_owned = false;
61521         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
61522         return ret_conv;
61523 }
61524
61525 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_feature_bit"))) TS_BlindedHopFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61526         LDKBlindedHopFeatures this_arg_conv;
61527         this_arg_conv.inner = untag_ptr(this_arg);
61528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61530         this_arg_conv.is_owned = false;
61531         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61532         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
61533         return tag_ptr(ret_conv, true);
61534 }
61535
61536 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_feature_bit"))) TS_BlindedHopFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61537         LDKBlindedHopFeatures this_arg_conv;
61538         this_arg_conv.inner = untag_ptr(this_arg);
61539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61541         this_arg_conv.is_owned = false;
61542         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61543         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61544         return tag_ptr(ret_conv, true);
61545 }
61546
61547 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61548         LDKBlindedHopFeatures this_arg_conv;
61549         this_arg_conv.inner = untag_ptr(this_arg);
61550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61552         this_arg_conv.is_owned = false;
61553         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61554         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
61555         return tag_ptr(ret_conv, true);
61556 }
61557
61558 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61559         LDKBlindedHopFeatures this_arg_conv;
61560         this_arg_conv.inner = untag_ptr(this_arg);
61561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61563         this_arg_conv.is_owned = false;
61564         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61565         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61566         return tag_ptr(ret_conv, true);
61567 }
61568
61569 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
61570         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
61571         uint64_t ret_ref = 0;
61572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61574         return ret_ref;
61575 }
61576
61577 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
61578         LDKChannelTypeFeatures this_arg_conv;
61579         this_arg_conv.inner = untag_ptr(this_arg);
61580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61582         this_arg_conv.is_owned = false;
61583         LDKChannelTypeFeatures other_conv;
61584         other_conv.inner = untag_ptr(other);
61585         other_conv.is_owned = ptr_is_owned(other);
61586         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61587         other_conv.is_owned = false;
61588         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61589         return ret_conv;
61590 }
61591
61592 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
61593         LDKChannelTypeFeatures this_arg_conv;
61594         this_arg_conv.inner = untag_ptr(this_arg);
61595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61597         this_arg_conv.is_owned = false;
61598         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
61599         return ret_conv;
61600 }
61601
61602 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_feature_bit"))) TS_ChannelTypeFeatures_set_required_feature_bit(uint64_t this_arg, uint32_t bit) {
61603         LDKChannelTypeFeatures this_arg_conv;
61604         this_arg_conv.inner = untag_ptr(this_arg);
61605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61607         this_arg_conv.is_owned = false;
61608         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61609         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61610         return tag_ptr(ret_conv, true);
61611 }
61612
61613 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_feature_bit"))) TS_ChannelTypeFeatures_set_optional_feature_bit(uint64_t this_arg, uint32_t bit) {
61614         LDKChannelTypeFeatures this_arg_conv;
61615         this_arg_conv.inner = untag_ptr(this_arg);
61616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61618         this_arg_conv.is_owned = false;
61619         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61620         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61621         return tag_ptr(ret_conv, true);
61622 }
61623
61624 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
61625         LDKChannelTypeFeatures this_arg_conv;
61626         this_arg_conv.inner = untag_ptr(this_arg);
61627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61629         this_arg_conv.is_owned = false;
61630         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61631         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61632         return tag_ptr(ret_conv, true);
61633 }
61634
61635 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
61636         LDKChannelTypeFeatures this_arg_conv;
61637         this_arg_conv.inner = untag_ptr(this_arg);
61638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61640         this_arg_conv.is_owned = false;
61641         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61642         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61643         return tag_ptr(ret_conv, true);
61644 }
61645
61646 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
61647         LDKInitFeatures obj_conv;
61648         obj_conv.inner = untag_ptr(obj);
61649         obj_conv.is_owned = ptr_is_owned(obj);
61650         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61651         obj_conv.is_owned = false;
61652         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
61653         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61654         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61655         CVec_u8Z_free(ret_var);
61656         return ret_arr;
61657 }
61658
61659 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
61660         LDKu8slice ser_ref;
61661         ser_ref.datalen = ser->arr_len;
61662         ser_ref.data = ser->elems;
61663         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
61664         *ret_conv = InitFeatures_read(ser_ref);
61665         FREE(ser);
61666         return tag_ptr(ret_conv, true);
61667 }
61668
61669 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
61670         LDKChannelFeatures obj_conv;
61671         obj_conv.inner = untag_ptr(obj);
61672         obj_conv.is_owned = ptr_is_owned(obj);
61673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61674         obj_conv.is_owned = false;
61675         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
61676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61678         CVec_u8Z_free(ret_var);
61679         return ret_arr;
61680 }
61681
61682 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
61683         LDKu8slice ser_ref;
61684         ser_ref.datalen = ser->arr_len;
61685         ser_ref.data = ser->elems;
61686         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
61687         *ret_conv = ChannelFeatures_read(ser_ref);
61688         FREE(ser);
61689         return tag_ptr(ret_conv, true);
61690 }
61691
61692 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
61693         LDKNodeFeatures obj_conv;
61694         obj_conv.inner = untag_ptr(obj);
61695         obj_conv.is_owned = ptr_is_owned(obj);
61696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61697         obj_conv.is_owned = false;
61698         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
61699         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61700         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61701         CVec_u8Z_free(ret_var);
61702         return ret_arr;
61703 }
61704
61705 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
61706         LDKu8slice ser_ref;
61707         ser_ref.datalen = ser->arr_len;
61708         ser_ref.data = ser->elems;
61709         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
61710         *ret_conv = NodeFeatures_read(ser_ref);
61711         FREE(ser);
61712         return tag_ptr(ret_conv, true);
61713 }
61714
61715 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
61716         LDKBolt11InvoiceFeatures obj_conv;
61717         obj_conv.inner = untag_ptr(obj);
61718         obj_conv.is_owned = ptr_is_owned(obj);
61719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61720         obj_conv.is_owned = false;
61721         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
61722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61724         CVec_u8Z_free(ret_var);
61725         return ret_arr;
61726 }
61727
61728 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
61729         LDKu8slice ser_ref;
61730         ser_ref.datalen = ser->arr_len;
61731         ser_ref.data = ser->elems;
61732         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
61733         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
61734         FREE(ser);
61735         return tag_ptr(ret_conv, true);
61736 }
61737
61738 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
61739         LDKBolt12InvoiceFeatures obj_conv;
61740         obj_conv.inner = untag_ptr(obj);
61741         obj_conv.is_owned = ptr_is_owned(obj);
61742         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61743         obj_conv.is_owned = false;
61744         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
61745         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61746         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61747         CVec_u8Z_free(ret_var);
61748         return ret_arr;
61749 }
61750
61751 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
61752         LDKu8slice ser_ref;
61753         ser_ref.datalen = ser->arr_len;
61754         ser_ref.data = ser->elems;
61755         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
61756         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
61757         FREE(ser);
61758         return tag_ptr(ret_conv, true);
61759 }
61760
61761 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
61762         LDKBlindedHopFeatures obj_conv;
61763         obj_conv.inner = untag_ptr(obj);
61764         obj_conv.is_owned = ptr_is_owned(obj);
61765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61766         obj_conv.is_owned = false;
61767         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
61768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61770         CVec_u8Z_free(ret_var);
61771         return ret_arr;
61772 }
61773
61774 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
61775         LDKu8slice ser_ref;
61776         ser_ref.datalen = ser->arr_len;
61777         ser_ref.data = ser->elems;
61778         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
61779         *ret_conv = BlindedHopFeatures_read(ser_ref);
61780         FREE(ser);
61781         return tag_ptr(ret_conv, true);
61782 }
61783
61784 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
61785         LDKChannelTypeFeatures obj_conv;
61786         obj_conv.inner = untag_ptr(obj);
61787         obj_conv.is_owned = ptr_is_owned(obj);
61788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61789         obj_conv.is_owned = false;
61790         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
61791         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61792         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61793         CVec_u8Z_free(ret_var);
61794         return ret_arr;
61795 }
61796
61797 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
61798         LDKu8slice ser_ref;
61799         ser_ref.datalen = ser->arr_len;
61800         ser_ref.data = ser->elems;
61801         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
61802         *ret_conv = ChannelTypeFeatures_read(ser_ref);
61803         FREE(ser);
61804         return tag_ptr(ret_conv, true);
61805 }
61806
61807 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
61808         LDKInitFeatures 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         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
61814 }
61815
61816 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
61817         LDKInitFeatures this_arg_conv;
61818         this_arg_conv.inner = untag_ptr(this_arg);
61819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61821         this_arg_conv.is_owned = false;
61822         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
61823 }
61824
61825 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
61826         LDKInitFeatures this_arg_conv;
61827         this_arg_conv.inner = untag_ptr(this_arg);
61828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61830         this_arg_conv.is_owned = false;
61831         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
61832         return ret_conv;
61833 }
61834
61835 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
61836         LDKNodeFeatures this_arg_conv;
61837         this_arg_conv.inner = untag_ptr(this_arg);
61838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61840         this_arg_conv.is_owned = false;
61841         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
61842 }
61843
61844 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
61845         LDKNodeFeatures this_arg_conv;
61846         this_arg_conv.inner = untag_ptr(this_arg);
61847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61849         this_arg_conv.is_owned = false;
61850         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
61851 }
61852
61853 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
61854         LDKNodeFeatures this_arg_conv;
61855         this_arg_conv.inner = untag_ptr(this_arg);
61856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61858         this_arg_conv.is_owned = false;
61859         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
61860         return ret_conv;
61861 }
61862
61863 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
61864         LDKInitFeatures this_arg_conv;
61865         this_arg_conv.inner = untag_ptr(this_arg);
61866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61868         this_arg_conv.is_owned = false;
61869         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
61870         return ret_conv;
61871 }
61872
61873 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
61874         LDKNodeFeatures this_arg_conv;
61875         this_arg_conv.inner = untag_ptr(this_arg);
61876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61878         this_arg_conv.is_owned = false;
61879         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
61880         return ret_conv;
61881 }
61882
61883 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
61884         LDKInitFeatures this_arg_conv;
61885         this_arg_conv.inner = untag_ptr(this_arg);
61886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61888         this_arg_conv.is_owned = false;
61889         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
61890 }
61891
61892 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
61893         LDKInitFeatures this_arg_conv;
61894         this_arg_conv.inner = untag_ptr(this_arg);
61895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61897         this_arg_conv.is_owned = false;
61898         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
61899 }
61900
61901 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
61902         LDKInitFeatures this_arg_conv;
61903         this_arg_conv.inner = untag_ptr(this_arg);
61904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61906         this_arg_conv.is_owned = false;
61907         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
61908         return ret_conv;
61909 }
61910
61911 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
61912         LDKInitFeatures this_arg_conv;
61913         this_arg_conv.inner = untag_ptr(this_arg);
61914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61916         this_arg_conv.is_owned = false;
61917         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
61918 }
61919
61920 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
61921         LDKInitFeatures this_arg_conv;
61922         this_arg_conv.inner = untag_ptr(this_arg);
61923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61925         this_arg_conv.is_owned = false;
61926         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
61927 }
61928
61929 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
61930         LDKInitFeatures this_arg_conv;
61931         this_arg_conv.inner = untag_ptr(this_arg);
61932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61934         this_arg_conv.is_owned = false;
61935         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
61936         return ret_conv;
61937 }
61938
61939 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
61940         LDKNodeFeatures this_arg_conv;
61941         this_arg_conv.inner = untag_ptr(this_arg);
61942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61944         this_arg_conv.is_owned = false;
61945         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
61946 }
61947
61948 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
61949         LDKNodeFeatures this_arg_conv;
61950         this_arg_conv.inner = untag_ptr(this_arg);
61951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61953         this_arg_conv.is_owned = false;
61954         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
61955 }
61956
61957 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
61958         LDKNodeFeatures this_arg_conv;
61959         this_arg_conv.inner = untag_ptr(this_arg);
61960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61962         this_arg_conv.is_owned = false;
61963         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
61964         return ret_conv;
61965 }
61966
61967 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
61968         LDKInitFeatures this_arg_conv;
61969         this_arg_conv.inner = untag_ptr(this_arg);
61970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61972         this_arg_conv.is_owned = false;
61973         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
61974         return ret_conv;
61975 }
61976
61977 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
61978         LDKNodeFeatures this_arg_conv;
61979         this_arg_conv.inner = untag_ptr(this_arg);
61980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61982         this_arg_conv.is_owned = false;
61983         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
61984         return ret_conv;
61985 }
61986
61987 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
61988         LDKInitFeatures this_arg_conv;
61989         this_arg_conv.inner = untag_ptr(this_arg);
61990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61992         this_arg_conv.is_owned = false;
61993         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
61994 }
61995
61996 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
61997         LDKInitFeatures this_arg_conv;
61998         this_arg_conv.inner = untag_ptr(this_arg);
61999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62001         this_arg_conv.is_owned = false;
62002         InitFeatures_set_gossip_queries_required(&this_arg_conv);
62003 }
62004
62005 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
62006         LDKInitFeatures this_arg_conv;
62007         this_arg_conv.inner = untag_ptr(this_arg);
62008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62010         this_arg_conv.is_owned = false;
62011         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
62012         return ret_conv;
62013 }
62014
62015 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
62016         LDKNodeFeatures this_arg_conv;
62017         this_arg_conv.inner = untag_ptr(this_arg);
62018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62020         this_arg_conv.is_owned = false;
62021         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
62022 }
62023
62024 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
62025         LDKNodeFeatures this_arg_conv;
62026         this_arg_conv.inner = untag_ptr(this_arg);
62027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62029         this_arg_conv.is_owned = false;
62030         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
62031 }
62032
62033 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
62034         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
62040         return ret_conv;
62041 }
62042
62043 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
62044         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
62050         return ret_conv;
62051 }
62052
62053 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
62054         LDKNodeFeatures this_arg_conv;
62055         this_arg_conv.inner = untag_ptr(this_arg);
62056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62058         this_arg_conv.is_owned = false;
62059         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
62060         return ret_conv;
62061 }
62062
62063 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
62064         LDKInitFeatures this_arg_conv;
62065         this_arg_conv.inner = untag_ptr(this_arg);
62066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62068         this_arg_conv.is_owned = false;
62069         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
62070 }
62071
62072 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
62073         LDKInitFeatures this_arg_conv;
62074         this_arg_conv.inner = untag_ptr(this_arg);
62075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62077         this_arg_conv.is_owned = false;
62078         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
62079 }
62080
62081 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
62082         LDKInitFeatures this_arg_conv;
62083         this_arg_conv.inner = untag_ptr(this_arg);
62084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62086         this_arg_conv.is_owned = false;
62087         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
62088         return ret_conv;
62089 }
62090
62091 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
62092         LDKNodeFeatures this_arg_conv;
62093         this_arg_conv.inner = untag_ptr(this_arg);
62094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62096         this_arg_conv.is_owned = false;
62097         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
62098 }
62099
62100 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
62101         LDKNodeFeatures this_arg_conv;
62102         this_arg_conv.inner = untag_ptr(this_arg);
62103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62105         this_arg_conv.is_owned = false;
62106         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
62107 }
62108
62109 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
62110         LDKNodeFeatures this_arg_conv;
62111         this_arg_conv.inner = untag_ptr(this_arg);
62112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62114         this_arg_conv.is_owned = false;
62115         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
62116         return ret_conv;
62117 }
62118
62119 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
62120         LDKBolt11InvoiceFeatures this_arg_conv;
62121         this_arg_conv.inner = untag_ptr(this_arg);
62122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62124         this_arg_conv.is_owned = false;
62125         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
62126 }
62127
62128 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
62129         LDKBolt11InvoiceFeatures this_arg_conv;
62130         this_arg_conv.inner = untag_ptr(this_arg);
62131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62133         this_arg_conv.is_owned = false;
62134         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
62135 }
62136
62137 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
62138         LDKBolt11InvoiceFeatures this_arg_conv;
62139         this_arg_conv.inner = untag_ptr(this_arg);
62140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62142         this_arg_conv.is_owned = false;
62143         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
62144         return ret_conv;
62145 }
62146
62147 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
62148         LDKInitFeatures this_arg_conv;
62149         this_arg_conv.inner = untag_ptr(this_arg);
62150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62152         this_arg_conv.is_owned = false;
62153         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
62154         return ret_conv;
62155 }
62156
62157 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
62158         LDKNodeFeatures this_arg_conv;
62159         this_arg_conv.inner = untag_ptr(this_arg);
62160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62162         this_arg_conv.is_owned = false;
62163         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
62164         return ret_conv;
62165 }
62166
62167 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
62168         LDKBolt11InvoiceFeatures this_arg_conv;
62169         this_arg_conv.inner = untag_ptr(this_arg);
62170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62172         this_arg_conv.is_owned = false;
62173         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
62174         return ret_conv;
62175 }
62176
62177 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
62178         LDKInitFeatures this_arg_conv;
62179         this_arg_conv.inner = untag_ptr(this_arg);
62180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62182         this_arg_conv.is_owned = false;
62183         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
62184 }
62185
62186 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
62187         LDKInitFeatures this_arg_conv;
62188         this_arg_conv.inner = untag_ptr(this_arg);
62189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62191         this_arg_conv.is_owned = false;
62192         InitFeatures_set_static_remote_key_required(&this_arg_conv);
62193 }
62194
62195 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
62196         LDKInitFeatures this_arg_conv;
62197         this_arg_conv.inner = untag_ptr(this_arg);
62198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62200         this_arg_conv.is_owned = false;
62201         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
62202         return ret_conv;
62203 }
62204
62205 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
62206         LDKNodeFeatures this_arg_conv;
62207         this_arg_conv.inner = untag_ptr(this_arg);
62208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62210         this_arg_conv.is_owned = false;
62211         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
62212 }
62213
62214 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
62215         LDKNodeFeatures this_arg_conv;
62216         this_arg_conv.inner = untag_ptr(this_arg);
62217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62219         this_arg_conv.is_owned = false;
62220         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
62221 }
62222
62223 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
62224         LDKNodeFeatures this_arg_conv;
62225         this_arg_conv.inner = untag_ptr(this_arg);
62226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62228         this_arg_conv.is_owned = false;
62229         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
62230         return ret_conv;
62231 }
62232
62233 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
62234         LDKChannelTypeFeatures this_arg_conv;
62235         this_arg_conv.inner = untag_ptr(this_arg);
62236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62238         this_arg_conv.is_owned = false;
62239         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
62240 }
62241
62242 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
62243         LDKChannelTypeFeatures this_arg_conv;
62244         this_arg_conv.inner = untag_ptr(this_arg);
62245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62247         this_arg_conv.is_owned = false;
62248         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
62249 }
62250
62251 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
62252         LDKChannelTypeFeatures this_arg_conv;
62253         this_arg_conv.inner = untag_ptr(this_arg);
62254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62256         this_arg_conv.is_owned = false;
62257         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
62258         return ret_conv;
62259 }
62260
62261 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
62262         LDKInitFeatures this_arg_conv;
62263         this_arg_conv.inner = untag_ptr(this_arg);
62264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62266         this_arg_conv.is_owned = false;
62267         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
62268         return ret_conv;
62269 }
62270
62271 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
62272         LDKNodeFeatures this_arg_conv;
62273         this_arg_conv.inner = untag_ptr(this_arg);
62274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62276         this_arg_conv.is_owned = false;
62277         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
62278         return ret_conv;
62279 }
62280
62281 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
62282         LDKChannelTypeFeatures this_arg_conv;
62283         this_arg_conv.inner = untag_ptr(this_arg);
62284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62286         this_arg_conv.is_owned = false;
62287         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
62288         return ret_conv;
62289 }
62290
62291 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
62292         LDKInitFeatures this_arg_conv;
62293         this_arg_conv.inner = untag_ptr(this_arg);
62294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62296         this_arg_conv.is_owned = false;
62297         InitFeatures_set_payment_secret_optional(&this_arg_conv);
62298 }
62299
62300 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
62301         LDKInitFeatures this_arg_conv;
62302         this_arg_conv.inner = untag_ptr(this_arg);
62303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62305         this_arg_conv.is_owned = false;
62306         InitFeatures_set_payment_secret_required(&this_arg_conv);
62307 }
62308
62309 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
62310         LDKInitFeatures this_arg_conv;
62311         this_arg_conv.inner = untag_ptr(this_arg);
62312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62314         this_arg_conv.is_owned = false;
62315         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
62316         return ret_conv;
62317 }
62318
62319 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
62320         LDKNodeFeatures this_arg_conv;
62321         this_arg_conv.inner = untag_ptr(this_arg);
62322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62324         this_arg_conv.is_owned = false;
62325         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
62326 }
62327
62328 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
62329         LDKNodeFeatures this_arg_conv;
62330         this_arg_conv.inner = untag_ptr(this_arg);
62331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62333         this_arg_conv.is_owned = false;
62334         NodeFeatures_set_payment_secret_required(&this_arg_conv);
62335 }
62336
62337 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
62338         LDKNodeFeatures this_arg_conv;
62339         this_arg_conv.inner = untag_ptr(this_arg);
62340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62342         this_arg_conv.is_owned = false;
62343         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
62344         return ret_conv;
62345 }
62346
62347 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
62348         LDKBolt11InvoiceFeatures this_arg_conv;
62349         this_arg_conv.inner = untag_ptr(this_arg);
62350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62352         this_arg_conv.is_owned = false;
62353         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
62354 }
62355
62356 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
62357         LDKBolt11InvoiceFeatures this_arg_conv;
62358         this_arg_conv.inner = untag_ptr(this_arg);
62359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62361         this_arg_conv.is_owned = false;
62362         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
62363 }
62364
62365 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
62366         LDKBolt11InvoiceFeatures this_arg_conv;
62367         this_arg_conv.inner = untag_ptr(this_arg);
62368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62370         this_arg_conv.is_owned = false;
62371         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
62372         return ret_conv;
62373 }
62374
62375 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
62376         LDKInitFeatures this_arg_conv;
62377         this_arg_conv.inner = untag_ptr(this_arg);
62378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62380         this_arg_conv.is_owned = false;
62381         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
62382         return ret_conv;
62383 }
62384
62385 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
62386         LDKNodeFeatures this_arg_conv;
62387         this_arg_conv.inner = untag_ptr(this_arg);
62388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62390         this_arg_conv.is_owned = false;
62391         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
62392         return ret_conv;
62393 }
62394
62395 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
62396         LDKBolt11InvoiceFeatures this_arg_conv;
62397         this_arg_conv.inner = untag_ptr(this_arg);
62398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62400         this_arg_conv.is_owned = false;
62401         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
62402         return ret_conv;
62403 }
62404
62405 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
62406         LDKInitFeatures this_arg_conv;
62407         this_arg_conv.inner = untag_ptr(this_arg);
62408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62410         this_arg_conv.is_owned = false;
62411         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
62412 }
62413
62414 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
62415         LDKInitFeatures this_arg_conv;
62416         this_arg_conv.inner = untag_ptr(this_arg);
62417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62419         this_arg_conv.is_owned = false;
62420         InitFeatures_set_basic_mpp_required(&this_arg_conv);
62421 }
62422
62423 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
62424         LDKInitFeatures this_arg_conv;
62425         this_arg_conv.inner = untag_ptr(this_arg);
62426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62428         this_arg_conv.is_owned = false;
62429         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
62430         return ret_conv;
62431 }
62432
62433 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
62434         LDKNodeFeatures this_arg_conv;
62435         this_arg_conv.inner = untag_ptr(this_arg);
62436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62438         this_arg_conv.is_owned = false;
62439         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
62440 }
62441
62442 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
62443         LDKNodeFeatures this_arg_conv;
62444         this_arg_conv.inner = untag_ptr(this_arg);
62445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62447         this_arg_conv.is_owned = false;
62448         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
62449 }
62450
62451 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
62452         LDKNodeFeatures this_arg_conv;
62453         this_arg_conv.inner = untag_ptr(this_arg);
62454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62456         this_arg_conv.is_owned = false;
62457         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
62458         return ret_conv;
62459 }
62460
62461 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
62462         LDKBolt11InvoiceFeatures this_arg_conv;
62463         this_arg_conv.inner = untag_ptr(this_arg);
62464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62466         this_arg_conv.is_owned = false;
62467         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62468 }
62469
62470 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
62471         LDKBolt11InvoiceFeatures this_arg_conv;
62472         this_arg_conv.inner = untag_ptr(this_arg);
62473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62475         this_arg_conv.is_owned = false;
62476         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62477 }
62478
62479 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
62480         LDKBolt11InvoiceFeatures this_arg_conv;
62481         this_arg_conv.inner = untag_ptr(this_arg);
62482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62484         this_arg_conv.is_owned = false;
62485         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62486         return ret_conv;
62487 }
62488
62489 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
62490         LDKBolt12InvoiceFeatures this_arg_conv;
62491         this_arg_conv.inner = untag_ptr(this_arg);
62492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62494         this_arg_conv.is_owned = false;
62495         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62496 }
62497
62498 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
62499         LDKBolt12InvoiceFeatures this_arg_conv;
62500         this_arg_conv.inner = untag_ptr(this_arg);
62501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62503         this_arg_conv.is_owned = false;
62504         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62505 }
62506
62507 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
62508         LDKBolt12InvoiceFeatures this_arg_conv;
62509         this_arg_conv.inner = untag_ptr(this_arg);
62510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62512         this_arg_conv.is_owned = false;
62513         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62514         return ret_conv;
62515 }
62516
62517 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
62518         LDKInitFeatures this_arg_conv;
62519         this_arg_conv.inner = untag_ptr(this_arg);
62520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62522         this_arg_conv.is_owned = false;
62523         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
62524         return ret_conv;
62525 }
62526
62527 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
62528         LDKNodeFeatures this_arg_conv;
62529         this_arg_conv.inner = untag_ptr(this_arg);
62530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62532         this_arg_conv.is_owned = false;
62533         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
62534         return ret_conv;
62535 }
62536
62537 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
62538         LDKBolt11InvoiceFeatures this_arg_conv;
62539         this_arg_conv.inner = untag_ptr(this_arg);
62540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62542         this_arg_conv.is_owned = false;
62543         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62544         return ret_conv;
62545 }
62546
62547 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
62548         LDKBolt12InvoiceFeatures this_arg_conv;
62549         this_arg_conv.inner = untag_ptr(this_arg);
62550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62552         this_arg_conv.is_owned = false;
62553         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62554         return ret_conv;
62555 }
62556
62557 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
62558         LDKInitFeatures this_arg_conv;
62559         this_arg_conv.inner = untag_ptr(this_arg);
62560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62562         this_arg_conv.is_owned = false;
62563         InitFeatures_set_wumbo_optional(&this_arg_conv);
62564 }
62565
62566 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
62567         LDKInitFeatures this_arg_conv;
62568         this_arg_conv.inner = untag_ptr(this_arg);
62569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62571         this_arg_conv.is_owned = false;
62572         InitFeatures_set_wumbo_required(&this_arg_conv);
62573 }
62574
62575 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
62576         LDKInitFeatures this_arg_conv;
62577         this_arg_conv.inner = untag_ptr(this_arg);
62578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62580         this_arg_conv.is_owned = false;
62581         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
62582         return ret_conv;
62583 }
62584
62585 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
62586         LDKNodeFeatures this_arg_conv;
62587         this_arg_conv.inner = untag_ptr(this_arg);
62588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62590         this_arg_conv.is_owned = false;
62591         NodeFeatures_set_wumbo_optional(&this_arg_conv);
62592 }
62593
62594 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
62595         LDKNodeFeatures this_arg_conv;
62596         this_arg_conv.inner = untag_ptr(this_arg);
62597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62599         this_arg_conv.is_owned = false;
62600         NodeFeatures_set_wumbo_required(&this_arg_conv);
62601 }
62602
62603 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
62604         LDKNodeFeatures this_arg_conv;
62605         this_arg_conv.inner = untag_ptr(this_arg);
62606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62608         this_arg_conv.is_owned = false;
62609         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
62610         return ret_conv;
62611 }
62612
62613 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
62614         LDKInitFeatures this_arg_conv;
62615         this_arg_conv.inner = untag_ptr(this_arg);
62616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62618         this_arg_conv.is_owned = false;
62619         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
62620         return ret_conv;
62621 }
62622
62623 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
62624         LDKNodeFeatures this_arg_conv;
62625         this_arg_conv.inner = untag_ptr(this_arg);
62626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62628         this_arg_conv.is_owned = false;
62629         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
62630         return ret_conv;
62631 }
62632
62633 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) {
62634         LDKInitFeatures this_arg_conv;
62635         this_arg_conv.inner = untag_ptr(this_arg);
62636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62638         this_arg_conv.is_owned = false;
62639         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62640 }
62641
62642 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) {
62643         LDKInitFeatures this_arg_conv;
62644         this_arg_conv.inner = untag_ptr(this_arg);
62645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62647         this_arg_conv.is_owned = false;
62648         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62649 }
62650
62651 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
62652         LDKInitFeatures this_arg_conv;
62653         this_arg_conv.inner = untag_ptr(this_arg);
62654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62656         this_arg_conv.is_owned = false;
62657         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62658         return ret_conv;
62659 }
62660
62661 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) {
62662         LDKNodeFeatures this_arg_conv;
62663         this_arg_conv.inner = untag_ptr(this_arg);
62664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62666         this_arg_conv.is_owned = false;
62667         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62668 }
62669
62670 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) {
62671         LDKNodeFeatures this_arg_conv;
62672         this_arg_conv.inner = untag_ptr(this_arg);
62673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62675         this_arg_conv.is_owned = false;
62676         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62677 }
62678
62679 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
62680         LDKNodeFeatures this_arg_conv;
62681         this_arg_conv.inner = untag_ptr(this_arg);
62682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62684         this_arg_conv.is_owned = false;
62685         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62686         return ret_conv;
62687 }
62688
62689 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) {
62690         LDKChannelTypeFeatures this_arg_conv;
62691         this_arg_conv.inner = untag_ptr(this_arg);
62692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62694         this_arg_conv.is_owned = false;
62695         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62696 }
62697
62698 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) {
62699         LDKChannelTypeFeatures this_arg_conv;
62700         this_arg_conv.inner = untag_ptr(this_arg);
62701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62703         this_arg_conv.is_owned = false;
62704         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62705 }
62706
62707 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
62708         LDKChannelTypeFeatures this_arg_conv;
62709         this_arg_conv.inner = untag_ptr(this_arg);
62710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62712         this_arg_conv.is_owned = false;
62713         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62714         return ret_conv;
62715 }
62716
62717 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
62718         LDKInitFeatures this_arg_conv;
62719         this_arg_conv.inner = untag_ptr(this_arg);
62720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62722         this_arg_conv.is_owned = false;
62723         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62724         return ret_conv;
62725 }
62726
62727 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
62728         LDKNodeFeatures this_arg_conv;
62729         this_arg_conv.inner = untag_ptr(this_arg);
62730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62732         this_arg_conv.is_owned = false;
62733         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62734         return ret_conv;
62735 }
62736
62737 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
62738         LDKChannelTypeFeatures this_arg_conv;
62739         this_arg_conv.inner = untag_ptr(this_arg);
62740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62742         this_arg_conv.is_owned = false;
62743         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62744         return ret_conv;
62745 }
62746
62747 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) {
62748         LDKInitFeatures this_arg_conv;
62749         this_arg_conv.inner = untag_ptr(this_arg);
62750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62752         this_arg_conv.is_owned = false;
62753         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62754 }
62755
62756 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) {
62757         LDKInitFeatures this_arg_conv;
62758         this_arg_conv.inner = untag_ptr(this_arg);
62759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62761         this_arg_conv.is_owned = false;
62762         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62763 }
62764
62765 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
62766         LDKInitFeatures this_arg_conv;
62767         this_arg_conv.inner = untag_ptr(this_arg);
62768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62770         this_arg_conv.is_owned = false;
62771         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62772         return ret_conv;
62773 }
62774
62775 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) {
62776         LDKNodeFeatures this_arg_conv;
62777         this_arg_conv.inner = untag_ptr(this_arg);
62778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62780         this_arg_conv.is_owned = false;
62781         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62782 }
62783
62784 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) {
62785         LDKNodeFeatures this_arg_conv;
62786         this_arg_conv.inner = untag_ptr(this_arg);
62787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62789         this_arg_conv.is_owned = false;
62790         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62791 }
62792
62793 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
62794         LDKNodeFeatures this_arg_conv;
62795         this_arg_conv.inner = untag_ptr(this_arg);
62796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62798         this_arg_conv.is_owned = false;
62799         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62800         return ret_conv;
62801 }
62802
62803 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) {
62804         LDKChannelTypeFeatures this_arg_conv;
62805         this_arg_conv.inner = untag_ptr(this_arg);
62806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62808         this_arg_conv.is_owned = false;
62809         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62810 }
62811
62812 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) {
62813         LDKChannelTypeFeatures this_arg_conv;
62814         this_arg_conv.inner = untag_ptr(this_arg);
62815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62817         this_arg_conv.is_owned = false;
62818         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62819 }
62820
62821 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
62822         LDKChannelTypeFeatures this_arg_conv;
62823         this_arg_conv.inner = untag_ptr(this_arg);
62824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62826         this_arg_conv.is_owned = false;
62827         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62828         return ret_conv;
62829 }
62830
62831 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
62832         LDKInitFeatures this_arg_conv;
62833         this_arg_conv.inner = untag_ptr(this_arg);
62834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62836         this_arg_conv.is_owned = false;
62837         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
62838         return ret_conv;
62839 }
62840
62841 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
62842         LDKNodeFeatures this_arg_conv;
62843         this_arg_conv.inner = untag_ptr(this_arg);
62844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62846         this_arg_conv.is_owned = false;
62847         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
62848         return ret_conv;
62849 }
62850
62851 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
62852         LDKChannelTypeFeatures this_arg_conv;
62853         this_arg_conv.inner = untag_ptr(this_arg);
62854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62856         this_arg_conv.is_owned = false;
62857         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
62858         return ret_conv;
62859 }
62860
62861 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_optional"))) TS_InitFeatures_set_route_blinding_optional(uint64_t this_arg) {
62862         LDKInitFeatures this_arg_conv;
62863         this_arg_conv.inner = untag_ptr(this_arg);
62864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62866         this_arg_conv.is_owned = false;
62867         InitFeatures_set_route_blinding_optional(&this_arg_conv);
62868 }
62869
62870 void  __attribute__((export_name("TS_InitFeatures_set_route_blinding_required"))) TS_InitFeatures_set_route_blinding_required(uint64_t this_arg) {
62871         LDKInitFeatures this_arg_conv;
62872         this_arg_conv.inner = untag_ptr(this_arg);
62873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62875         this_arg_conv.is_owned = false;
62876         InitFeatures_set_route_blinding_required(&this_arg_conv);
62877 }
62878
62879 jboolean  __attribute__((export_name("TS_InitFeatures_supports_route_blinding"))) TS_InitFeatures_supports_route_blinding(uint64_t this_arg) {
62880         LDKInitFeatures this_arg_conv;
62881         this_arg_conv.inner = untag_ptr(this_arg);
62882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62884         this_arg_conv.is_owned = false;
62885         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
62886         return ret_conv;
62887 }
62888
62889 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_optional"))) TS_NodeFeatures_set_route_blinding_optional(uint64_t this_arg) {
62890         LDKNodeFeatures this_arg_conv;
62891         this_arg_conv.inner = untag_ptr(this_arg);
62892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62894         this_arg_conv.is_owned = false;
62895         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
62896 }
62897
62898 void  __attribute__((export_name("TS_NodeFeatures_set_route_blinding_required"))) TS_NodeFeatures_set_route_blinding_required(uint64_t this_arg) {
62899         LDKNodeFeatures this_arg_conv;
62900         this_arg_conv.inner = untag_ptr(this_arg);
62901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62903         this_arg_conv.is_owned = false;
62904         NodeFeatures_set_route_blinding_required(&this_arg_conv);
62905 }
62906
62907 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_route_blinding"))) TS_NodeFeatures_supports_route_blinding(uint64_t this_arg) {
62908         LDKNodeFeatures this_arg_conv;
62909         this_arg_conv.inner = untag_ptr(this_arg);
62910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62912         this_arg_conv.is_owned = false;
62913         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
62914         return ret_conv;
62915 }
62916
62917 jboolean  __attribute__((export_name("TS_InitFeatures_requires_route_blinding"))) TS_InitFeatures_requires_route_blinding(uint64_t this_arg) {
62918         LDKInitFeatures this_arg_conv;
62919         this_arg_conv.inner = untag_ptr(this_arg);
62920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62922         this_arg_conv.is_owned = false;
62923         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
62924         return ret_conv;
62925 }
62926
62927 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_route_blinding"))) TS_NodeFeatures_requires_route_blinding(uint64_t this_arg) {
62928         LDKNodeFeatures this_arg_conv;
62929         this_arg_conv.inner = untag_ptr(this_arg);
62930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62932         this_arg_conv.is_owned = false;
62933         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
62934         return ret_conv;
62935 }
62936
62937 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
62938         LDKInitFeatures this_arg_conv;
62939         this_arg_conv.inner = untag_ptr(this_arg);
62940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62942         this_arg_conv.is_owned = false;
62943         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
62944 }
62945
62946 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
62947         LDKInitFeatures this_arg_conv;
62948         this_arg_conv.inner = untag_ptr(this_arg);
62949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62951         this_arg_conv.is_owned = false;
62952         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
62953 }
62954
62955 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
62956         LDKInitFeatures this_arg_conv;
62957         this_arg_conv.inner = untag_ptr(this_arg);
62958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62960         this_arg_conv.is_owned = false;
62961         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
62962         return ret_conv;
62963 }
62964
62965 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
62966         LDKNodeFeatures this_arg_conv;
62967         this_arg_conv.inner = untag_ptr(this_arg);
62968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62970         this_arg_conv.is_owned = false;
62971         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
62972 }
62973
62974 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
62975         LDKNodeFeatures this_arg_conv;
62976         this_arg_conv.inner = untag_ptr(this_arg);
62977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62979         this_arg_conv.is_owned = false;
62980         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
62981 }
62982
62983 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
62984         LDKNodeFeatures this_arg_conv;
62985         this_arg_conv.inner = untag_ptr(this_arg);
62986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62988         this_arg_conv.is_owned = false;
62989         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
62990         return ret_conv;
62991 }
62992
62993 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
62994         LDKInitFeatures this_arg_conv;
62995         this_arg_conv.inner = untag_ptr(this_arg);
62996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62998         this_arg_conv.is_owned = false;
62999         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63000         return ret_conv;
63001 }
63002
63003 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
63004         LDKNodeFeatures this_arg_conv;
63005         this_arg_conv.inner = untag_ptr(this_arg);
63006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63008         this_arg_conv.is_owned = false;
63009         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63010         return ret_conv;
63011 }
63012
63013 void  __attribute__((export_name("TS_InitFeatures_set_taproot_optional"))) TS_InitFeatures_set_taproot_optional(uint64_t this_arg) {
63014         LDKInitFeatures this_arg_conv;
63015         this_arg_conv.inner = untag_ptr(this_arg);
63016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63018         this_arg_conv.is_owned = false;
63019         InitFeatures_set_taproot_optional(&this_arg_conv);
63020 }
63021
63022 void  __attribute__((export_name("TS_InitFeatures_set_taproot_required"))) TS_InitFeatures_set_taproot_required(uint64_t this_arg) {
63023         LDKInitFeatures this_arg_conv;
63024         this_arg_conv.inner = untag_ptr(this_arg);
63025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63027         this_arg_conv.is_owned = false;
63028         InitFeatures_set_taproot_required(&this_arg_conv);
63029 }
63030
63031 jboolean  __attribute__((export_name("TS_InitFeatures_supports_taproot"))) TS_InitFeatures_supports_taproot(uint64_t this_arg) {
63032         LDKInitFeatures this_arg_conv;
63033         this_arg_conv.inner = untag_ptr(this_arg);
63034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63036         this_arg_conv.is_owned = false;
63037         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
63038         return ret_conv;
63039 }
63040
63041 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_optional"))) TS_NodeFeatures_set_taproot_optional(uint64_t this_arg) {
63042         LDKNodeFeatures this_arg_conv;
63043         this_arg_conv.inner = untag_ptr(this_arg);
63044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63046         this_arg_conv.is_owned = false;
63047         NodeFeatures_set_taproot_optional(&this_arg_conv);
63048 }
63049
63050 void  __attribute__((export_name("TS_NodeFeatures_set_taproot_required"))) TS_NodeFeatures_set_taproot_required(uint64_t this_arg) {
63051         LDKNodeFeatures this_arg_conv;
63052         this_arg_conv.inner = untag_ptr(this_arg);
63053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63055         this_arg_conv.is_owned = false;
63056         NodeFeatures_set_taproot_required(&this_arg_conv);
63057 }
63058
63059 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_taproot"))) TS_NodeFeatures_supports_taproot(uint64_t this_arg) {
63060         LDKNodeFeatures this_arg_conv;
63061         this_arg_conv.inner = untag_ptr(this_arg);
63062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63064         this_arg_conv.is_owned = false;
63065         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
63066         return ret_conv;
63067 }
63068
63069 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_optional"))) TS_ChannelTypeFeatures_set_taproot_optional(uint64_t this_arg) {
63070         LDKChannelTypeFeatures this_arg_conv;
63071         this_arg_conv.inner = untag_ptr(this_arg);
63072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63074         this_arg_conv.is_owned = false;
63075         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
63076 }
63077
63078 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_taproot_required"))) TS_ChannelTypeFeatures_set_taproot_required(uint64_t this_arg) {
63079         LDKChannelTypeFeatures this_arg_conv;
63080         this_arg_conv.inner = untag_ptr(this_arg);
63081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63083         this_arg_conv.is_owned = false;
63084         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
63085 }
63086
63087 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_taproot"))) TS_ChannelTypeFeatures_supports_taproot(uint64_t this_arg) {
63088         LDKChannelTypeFeatures this_arg_conv;
63089         this_arg_conv.inner = untag_ptr(this_arg);
63090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63092         this_arg_conv.is_owned = false;
63093         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
63094         return ret_conv;
63095 }
63096
63097 jboolean  __attribute__((export_name("TS_InitFeatures_requires_taproot"))) TS_InitFeatures_requires_taproot(uint64_t this_arg) {
63098         LDKInitFeatures this_arg_conv;
63099         this_arg_conv.inner = untag_ptr(this_arg);
63100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63102         this_arg_conv.is_owned = false;
63103         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
63104         return ret_conv;
63105 }
63106
63107 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_taproot"))) TS_NodeFeatures_requires_taproot(uint64_t this_arg) {
63108         LDKNodeFeatures this_arg_conv;
63109         this_arg_conv.inner = untag_ptr(this_arg);
63110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63112         this_arg_conv.is_owned = false;
63113         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
63114         return ret_conv;
63115 }
63116
63117 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_taproot"))) TS_ChannelTypeFeatures_requires_taproot(uint64_t this_arg) {
63118         LDKChannelTypeFeatures this_arg_conv;
63119         this_arg_conv.inner = untag_ptr(this_arg);
63120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63122         this_arg_conv.is_owned = false;
63123         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
63124         return ret_conv;
63125 }
63126
63127 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
63128         LDKInitFeatures this_arg_conv;
63129         this_arg_conv.inner = untag_ptr(this_arg);
63130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63132         this_arg_conv.is_owned = false;
63133         InitFeatures_set_onion_messages_optional(&this_arg_conv);
63134 }
63135
63136 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
63137         LDKInitFeatures this_arg_conv;
63138         this_arg_conv.inner = untag_ptr(this_arg);
63139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63141         this_arg_conv.is_owned = false;
63142         InitFeatures_set_onion_messages_required(&this_arg_conv);
63143 }
63144
63145 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
63146         LDKInitFeatures this_arg_conv;
63147         this_arg_conv.inner = untag_ptr(this_arg);
63148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63150         this_arg_conv.is_owned = false;
63151         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
63152         return ret_conv;
63153 }
63154
63155 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
63156         LDKNodeFeatures this_arg_conv;
63157         this_arg_conv.inner = untag_ptr(this_arg);
63158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63160         this_arg_conv.is_owned = false;
63161         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
63162 }
63163
63164 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
63165         LDKNodeFeatures this_arg_conv;
63166         this_arg_conv.inner = untag_ptr(this_arg);
63167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63169         this_arg_conv.is_owned = false;
63170         NodeFeatures_set_onion_messages_required(&this_arg_conv);
63171 }
63172
63173 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
63174         LDKNodeFeatures this_arg_conv;
63175         this_arg_conv.inner = untag_ptr(this_arg);
63176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63178         this_arg_conv.is_owned = false;
63179         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
63180         return ret_conv;
63181 }
63182
63183 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
63184         LDKInitFeatures this_arg_conv;
63185         this_arg_conv.inner = untag_ptr(this_arg);
63186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63188         this_arg_conv.is_owned = false;
63189         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
63190         return ret_conv;
63191 }
63192
63193 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
63194         LDKNodeFeatures this_arg_conv;
63195         this_arg_conv.inner = untag_ptr(this_arg);
63196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63198         this_arg_conv.is_owned = false;
63199         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
63200         return ret_conv;
63201 }
63202
63203 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
63204         LDKInitFeatures this_arg_conv;
63205         this_arg_conv.inner = untag_ptr(this_arg);
63206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63208         this_arg_conv.is_owned = false;
63209         InitFeatures_set_channel_type_optional(&this_arg_conv);
63210 }
63211
63212 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
63213         LDKInitFeatures this_arg_conv;
63214         this_arg_conv.inner = untag_ptr(this_arg);
63215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63217         this_arg_conv.is_owned = false;
63218         InitFeatures_set_channel_type_required(&this_arg_conv);
63219 }
63220
63221 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
63222         LDKInitFeatures this_arg_conv;
63223         this_arg_conv.inner = untag_ptr(this_arg);
63224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63226         this_arg_conv.is_owned = false;
63227         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
63228         return ret_conv;
63229 }
63230
63231 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
63232         LDKNodeFeatures this_arg_conv;
63233         this_arg_conv.inner = untag_ptr(this_arg);
63234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63236         this_arg_conv.is_owned = false;
63237         NodeFeatures_set_channel_type_optional(&this_arg_conv);
63238 }
63239
63240 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
63241         LDKNodeFeatures this_arg_conv;
63242         this_arg_conv.inner = untag_ptr(this_arg);
63243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63245         this_arg_conv.is_owned = false;
63246         NodeFeatures_set_channel_type_required(&this_arg_conv);
63247 }
63248
63249 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
63250         LDKNodeFeatures this_arg_conv;
63251         this_arg_conv.inner = untag_ptr(this_arg);
63252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63254         this_arg_conv.is_owned = false;
63255         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
63256         return ret_conv;
63257 }
63258
63259 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
63260         LDKInitFeatures this_arg_conv;
63261         this_arg_conv.inner = untag_ptr(this_arg);
63262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63264         this_arg_conv.is_owned = false;
63265         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
63266         return ret_conv;
63267 }
63268
63269 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
63270         LDKNodeFeatures this_arg_conv;
63271         this_arg_conv.inner = untag_ptr(this_arg);
63272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63274         this_arg_conv.is_owned = false;
63275         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
63276         return ret_conv;
63277 }
63278
63279 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
63280         LDKInitFeatures this_arg_conv;
63281         this_arg_conv.inner = untag_ptr(this_arg);
63282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63284         this_arg_conv.is_owned = false;
63285         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
63286 }
63287
63288 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
63289         LDKInitFeatures this_arg_conv;
63290         this_arg_conv.inner = untag_ptr(this_arg);
63291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63293         this_arg_conv.is_owned = false;
63294         InitFeatures_set_scid_privacy_required(&this_arg_conv);
63295 }
63296
63297 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
63298         LDKInitFeatures this_arg_conv;
63299         this_arg_conv.inner = untag_ptr(this_arg);
63300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63302         this_arg_conv.is_owned = false;
63303         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
63304         return ret_conv;
63305 }
63306
63307 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
63308         LDKNodeFeatures this_arg_conv;
63309         this_arg_conv.inner = untag_ptr(this_arg);
63310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63312         this_arg_conv.is_owned = false;
63313         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
63314 }
63315
63316 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
63317         LDKNodeFeatures this_arg_conv;
63318         this_arg_conv.inner = untag_ptr(this_arg);
63319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63321         this_arg_conv.is_owned = false;
63322         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
63323 }
63324
63325 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
63326         LDKNodeFeatures this_arg_conv;
63327         this_arg_conv.inner = untag_ptr(this_arg);
63328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63330         this_arg_conv.is_owned = false;
63331         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
63332         return ret_conv;
63333 }
63334
63335 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
63336         LDKChannelTypeFeatures this_arg_conv;
63337         this_arg_conv.inner = untag_ptr(this_arg);
63338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63340         this_arg_conv.is_owned = false;
63341         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
63342 }
63343
63344 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
63345         LDKChannelTypeFeatures this_arg_conv;
63346         this_arg_conv.inner = untag_ptr(this_arg);
63347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63349         this_arg_conv.is_owned = false;
63350         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
63351 }
63352
63353 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
63354         LDKChannelTypeFeatures this_arg_conv;
63355         this_arg_conv.inner = untag_ptr(this_arg);
63356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63358         this_arg_conv.is_owned = false;
63359         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
63360         return ret_conv;
63361 }
63362
63363 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
63364         LDKInitFeatures this_arg_conv;
63365         this_arg_conv.inner = untag_ptr(this_arg);
63366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63368         this_arg_conv.is_owned = false;
63369         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
63370         return ret_conv;
63371 }
63372
63373 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
63374         LDKNodeFeatures this_arg_conv;
63375         this_arg_conv.inner = untag_ptr(this_arg);
63376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63378         this_arg_conv.is_owned = false;
63379         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
63380         return ret_conv;
63381 }
63382
63383 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
63384         LDKChannelTypeFeatures this_arg_conv;
63385         this_arg_conv.inner = untag_ptr(this_arg);
63386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63388         this_arg_conv.is_owned = false;
63389         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
63390         return ret_conv;
63391 }
63392
63393 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
63394         LDKBolt11InvoiceFeatures this_arg_conv;
63395         this_arg_conv.inner = untag_ptr(this_arg);
63396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63398         this_arg_conv.is_owned = false;
63399         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
63400 }
63401
63402 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
63403         LDKBolt11InvoiceFeatures this_arg_conv;
63404         this_arg_conv.inner = untag_ptr(this_arg);
63405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63407         this_arg_conv.is_owned = false;
63408         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
63409 }
63410
63411 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
63412         LDKBolt11InvoiceFeatures this_arg_conv;
63413         this_arg_conv.inner = untag_ptr(this_arg);
63414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63416         this_arg_conv.is_owned = false;
63417         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
63418         return ret_conv;
63419 }
63420
63421 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
63422         LDKBolt11InvoiceFeatures this_arg_conv;
63423         this_arg_conv.inner = untag_ptr(this_arg);
63424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63426         this_arg_conv.is_owned = false;
63427         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
63428         return ret_conv;
63429 }
63430
63431 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
63432         LDKInitFeatures this_arg_conv;
63433         this_arg_conv.inner = untag_ptr(this_arg);
63434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63436         this_arg_conv.is_owned = false;
63437         InitFeatures_set_zero_conf_optional(&this_arg_conv);
63438 }
63439
63440 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
63441         LDKInitFeatures this_arg_conv;
63442         this_arg_conv.inner = untag_ptr(this_arg);
63443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63445         this_arg_conv.is_owned = false;
63446         InitFeatures_set_zero_conf_required(&this_arg_conv);
63447 }
63448
63449 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
63450         LDKInitFeatures this_arg_conv;
63451         this_arg_conv.inner = untag_ptr(this_arg);
63452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63454         this_arg_conv.is_owned = false;
63455         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
63456         return ret_conv;
63457 }
63458
63459 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
63460         LDKNodeFeatures this_arg_conv;
63461         this_arg_conv.inner = untag_ptr(this_arg);
63462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63464         this_arg_conv.is_owned = false;
63465         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
63466 }
63467
63468 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
63469         LDKNodeFeatures this_arg_conv;
63470         this_arg_conv.inner = untag_ptr(this_arg);
63471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63473         this_arg_conv.is_owned = false;
63474         NodeFeatures_set_zero_conf_required(&this_arg_conv);
63475 }
63476
63477 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
63478         LDKNodeFeatures this_arg_conv;
63479         this_arg_conv.inner = untag_ptr(this_arg);
63480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63482         this_arg_conv.is_owned = false;
63483         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
63484         return ret_conv;
63485 }
63486
63487 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
63488         LDKChannelTypeFeatures this_arg_conv;
63489         this_arg_conv.inner = untag_ptr(this_arg);
63490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63492         this_arg_conv.is_owned = false;
63493         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
63494 }
63495
63496 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
63497         LDKChannelTypeFeatures this_arg_conv;
63498         this_arg_conv.inner = untag_ptr(this_arg);
63499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63501         this_arg_conv.is_owned = false;
63502         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
63503 }
63504
63505 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
63506         LDKChannelTypeFeatures this_arg_conv;
63507         this_arg_conv.inner = untag_ptr(this_arg);
63508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63510         this_arg_conv.is_owned = false;
63511         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
63512         return ret_conv;
63513 }
63514
63515 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
63516         LDKInitFeatures this_arg_conv;
63517         this_arg_conv.inner = untag_ptr(this_arg);
63518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63520         this_arg_conv.is_owned = false;
63521         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
63522         return ret_conv;
63523 }
63524
63525 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
63526         LDKNodeFeatures this_arg_conv;
63527         this_arg_conv.inner = untag_ptr(this_arg);
63528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63530         this_arg_conv.is_owned = false;
63531         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
63532         return ret_conv;
63533 }
63534
63535 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
63536         LDKChannelTypeFeatures 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         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
63542         return ret_conv;
63543 }
63544
63545 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
63546         LDKNodeFeatures this_arg_conv;
63547         this_arg_conv.inner = untag_ptr(this_arg);
63548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63550         this_arg_conv.is_owned = false;
63551         NodeFeatures_set_keysend_optional(&this_arg_conv);
63552 }
63553
63554 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
63555         LDKNodeFeatures this_arg_conv;
63556         this_arg_conv.inner = untag_ptr(this_arg);
63557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63559         this_arg_conv.is_owned = false;
63560         NodeFeatures_set_keysend_required(&this_arg_conv);
63561 }
63562
63563 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
63564         LDKNodeFeatures this_arg_conv;
63565         this_arg_conv.inner = untag_ptr(this_arg);
63566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63568         this_arg_conv.is_owned = false;
63569         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
63570         return ret_conv;
63571 }
63572
63573 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
63574         LDKNodeFeatures this_arg_conv;
63575         this_arg_conv.inner = untag_ptr(this_arg);
63576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63578         this_arg_conv.is_owned = false;
63579         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
63580         return ret_conv;
63581 }
63582
63583 void  __attribute__((export_name("TS_InitFeatures_set_trampoline_routing_optional"))) TS_InitFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
63584         LDKInitFeatures this_arg_conv;
63585         this_arg_conv.inner = untag_ptr(this_arg);
63586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63588         this_arg_conv.is_owned = false;
63589         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
63590 }
63591
63592 void  __attribute__((export_name("TS_InitFeatures_set_trampoline_routing_required"))) TS_InitFeatures_set_trampoline_routing_required(uint64_t this_arg) {
63593         LDKInitFeatures this_arg_conv;
63594         this_arg_conv.inner = untag_ptr(this_arg);
63595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63597         this_arg_conv.is_owned = false;
63598         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
63599 }
63600
63601 jboolean  __attribute__((export_name("TS_InitFeatures_supports_trampoline_routing"))) TS_InitFeatures_supports_trampoline_routing(uint64_t this_arg) {
63602         LDKInitFeatures this_arg_conv;
63603         this_arg_conv.inner = untag_ptr(this_arg);
63604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63606         this_arg_conv.is_owned = false;
63607         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
63608         return ret_conv;
63609 }
63610
63611 void  __attribute__((export_name("TS_NodeFeatures_set_trampoline_routing_optional"))) TS_NodeFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
63612         LDKNodeFeatures this_arg_conv;
63613         this_arg_conv.inner = untag_ptr(this_arg);
63614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63616         this_arg_conv.is_owned = false;
63617         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
63618 }
63619
63620 void  __attribute__((export_name("TS_NodeFeatures_set_trampoline_routing_required"))) TS_NodeFeatures_set_trampoline_routing_required(uint64_t this_arg) {
63621         LDKNodeFeatures this_arg_conv;
63622         this_arg_conv.inner = untag_ptr(this_arg);
63623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63625         this_arg_conv.is_owned = false;
63626         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
63627 }
63628
63629 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_trampoline_routing"))) TS_NodeFeatures_supports_trampoline_routing(uint64_t this_arg) {
63630         LDKNodeFeatures this_arg_conv;
63631         this_arg_conv.inner = untag_ptr(this_arg);
63632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63634         this_arg_conv.is_owned = false;
63635         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
63636         return ret_conv;
63637 }
63638
63639 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_trampoline_routing_optional"))) TS_Bolt11InvoiceFeatures_set_trampoline_routing_optional(uint64_t this_arg) {
63640         LDKBolt11InvoiceFeatures this_arg_conv;
63641         this_arg_conv.inner = untag_ptr(this_arg);
63642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63644         this_arg_conv.is_owned = false;
63645         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
63646 }
63647
63648 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_trampoline_routing_required"))) TS_Bolt11InvoiceFeatures_set_trampoline_routing_required(uint64_t this_arg) {
63649         LDKBolt11InvoiceFeatures 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         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
63655 }
63656
63657 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_trampoline_routing"))) TS_Bolt11InvoiceFeatures_supports_trampoline_routing(uint64_t this_arg) {
63658         LDKBolt11InvoiceFeatures 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         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
63664         return ret_conv;
63665 }
63666
63667 jboolean  __attribute__((export_name("TS_InitFeatures_requires_trampoline_routing"))) TS_InitFeatures_requires_trampoline_routing(uint64_t this_arg) {
63668         LDKInitFeatures this_arg_conv;
63669         this_arg_conv.inner = untag_ptr(this_arg);
63670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63672         this_arg_conv.is_owned = false;
63673         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
63674         return ret_conv;
63675 }
63676
63677 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_trampoline_routing"))) TS_NodeFeatures_requires_trampoline_routing(uint64_t this_arg) {
63678         LDKNodeFeatures this_arg_conv;
63679         this_arg_conv.inner = untag_ptr(this_arg);
63680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63682         this_arg_conv.is_owned = false;
63683         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
63684         return ret_conv;
63685 }
63686
63687 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_trampoline_routing"))) TS_Bolt11InvoiceFeatures_requires_trampoline_routing(uint64_t this_arg) {
63688         LDKBolt11InvoiceFeatures this_arg_conv;
63689         this_arg_conv.inner = untag_ptr(this_arg);
63690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63692         this_arg_conv.is_owned = false;
63693         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
63694         return ret_conv;
63695 }
63696
63697 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
63698         LDKShutdownScript this_obj_conv;
63699         this_obj_conv.inner = untag_ptr(this_obj);
63700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63702         ShutdownScript_free(this_obj_conv);
63703 }
63704
63705 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
63706         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
63707         uint64_t ret_ref = 0;
63708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63710         return ret_ref;
63711 }
63712 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
63713         LDKShutdownScript arg_conv;
63714         arg_conv.inner = untag_ptr(arg);
63715         arg_conv.is_owned = ptr_is_owned(arg);
63716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63717         arg_conv.is_owned = false;
63718         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
63719         return ret_conv;
63720 }
63721
63722 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
63723         LDKShutdownScript orig_conv;
63724         orig_conv.inner = untag_ptr(orig);
63725         orig_conv.is_owned = ptr_is_owned(orig);
63726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63727         orig_conv.is_owned = false;
63728         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
63729         uint64_t ret_ref = 0;
63730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63732         return ret_ref;
63733 }
63734
63735 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
63736         LDKShutdownScript a_conv;
63737         a_conv.inner = untag_ptr(a);
63738         a_conv.is_owned = ptr_is_owned(a);
63739         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63740         a_conv.is_owned = false;
63741         LDKShutdownScript b_conv;
63742         b_conv.inner = untag_ptr(b);
63743         b_conv.is_owned = ptr_is_owned(b);
63744         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63745         b_conv.is_owned = false;
63746         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
63747         return ret_conv;
63748 }
63749
63750 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
63751         LDKInvalidShutdownScript this_obj_conv;
63752         this_obj_conv.inner = untag_ptr(this_obj);
63753         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63755         InvalidShutdownScript_free(this_obj_conv);
63756 }
63757
63758 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
63759         LDKInvalidShutdownScript this_ptr_conv;
63760         this_ptr_conv.inner = untag_ptr(this_ptr);
63761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63763         this_ptr_conv.is_owned = false;
63764         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
63765         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63766         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63767         CVec_u8Z_free(ret_var);
63768         return ret_arr;
63769 }
63770
63771 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
63772         LDKInvalidShutdownScript this_ptr_conv;
63773         this_ptr_conv.inner = untag_ptr(this_ptr);
63774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63776         this_ptr_conv.is_owned = false;
63777         LDKCVec_u8Z val_ref;
63778         val_ref.datalen = val->arr_len;
63779         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
63780         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
63781         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
63782 }
63783
63784 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
63785         LDKCVec_u8Z script_arg_ref;
63786         script_arg_ref.datalen = script_arg->arr_len;
63787         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
63788         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
63789         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
63790         uint64_t ret_ref = 0;
63791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63793         return ret_ref;
63794 }
63795
63796 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
63797         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
63798         uint64_t ret_ref = 0;
63799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63801         return ret_ref;
63802 }
63803 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
63804         LDKInvalidShutdownScript arg_conv;
63805         arg_conv.inner = untag_ptr(arg);
63806         arg_conv.is_owned = ptr_is_owned(arg);
63807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63808         arg_conv.is_owned = false;
63809         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
63810         return ret_conv;
63811 }
63812
63813 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
63814         LDKInvalidShutdownScript orig_conv;
63815         orig_conv.inner = untag_ptr(orig);
63816         orig_conv.is_owned = ptr_is_owned(orig);
63817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63818         orig_conv.is_owned = false;
63819         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
63820         uint64_t ret_ref = 0;
63821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63823         return ret_ref;
63824 }
63825
63826 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
63827         LDKShutdownScript obj_conv;
63828         obj_conv.inner = untag_ptr(obj);
63829         obj_conv.is_owned = ptr_is_owned(obj);
63830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63831         obj_conv.is_owned = false;
63832         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
63833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63835         CVec_u8Z_free(ret_var);
63836         return ret_arr;
63837 }
63838
63839 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
63840         LDKu8slice ser_ref;
63841         ser_ref.datalen = ser->arr_len;
63842         ser_ref.data = ser->elems;
63843         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
63844         *ret_conv = ShutdownScript_read(ser_ref);
63845         FREE(ser);
63846         return tag_ptr(ret_conv, true);
63847 }
63848
63849 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
63850         uint8_t pubkey_hash_arr[20];
63851         CHECK(pubkey_hash->arr_len == 20);
63852         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
63853         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
63854         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
63855         uint64_t ret_ref = 0;
63856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63858         return ret_ref;
63859 }
63860
63861 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
63862         uint8_t script_hash_arr[32];
63863         CHECK(script_hash->arr_len == 32);
63864         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
63865         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
63866         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
63867         uint64_t ret_ref = 0;
63868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63870         return ret_ref;
63871 }
63872
63873 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(uint64_t witness_program) {
63874         void* witness_program_ptr = untag_ptr(witness_program);
63875         CHECK_ACCESS(witness_program_ptr);
63876         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
63877         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
63878         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
63879         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
63880         return tag_ptr(ret_conv, true);
63881 }
63882
63883 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
63884         LDKShutdownScript this_arg_conv;
63885         this_arg_conv.inner = untag_ptr(this_arg);
63886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63888         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
63889         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
63890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63892         CVec_u8Z_free(ret_var);
63893         return ret_arr;
63894 }
63895
63896 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
63897         LDKShutdownScript this_arg_conv;
63898         this_arg_conv.inner = untag_ptr(this_arg);
63899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63901         this_arg_conv.is_owned = false;
63902         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63903         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
63904         return ret_arr;
63905 }
63906
63907 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
63908         LDKShutdownScript this_arg_conv;
63909         this_arg_conv.inner = untag_ptr(this_arg);
63910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63912         this_arg_conv.is_owned = false;
63913         LDKInitFeatures features_conv;
63914         features_conv.inner = untag_ptr(features);
63915         features_conv.is_owned = ptr_is_owned(features);
63916         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63917         features_conv.is_owned = false;
63918         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
63919         return ret_conv;
63920 }
63921
63922 jstring  __attribute__((export_name("TS_ShutdownScript_to_str"))) TS_ShutdownScript_to_str(uint64_t o) {
63923         LDKShutdownScript o_conv;
63924         o_conv.inner = untag_ptr(o);
63925         o_conv.is_owned = ptr_is_owned(o);
63926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63927         o_conv.is_owned = false;
63928         LDKStr ret_str = ShutdownScript_to_str(&o_conv);
63929         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63930         Str_free(ret_str);
63931         return ret_conv;
63932 }
63933
63934 void  __attribute__((export_name("TS_ChannelId_free"))) TS_ChannelId_free(uint64_t this_obj) {
63935         LDKChannelId this_obj_conv;
63936         this_obj_conv.inner = untag_ptr(this_obj);
63937         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63939         ChannelId_free(this_obj_conv);
63940 }
63941
63942 int8_tArray  __attribute__((export_name("TS_ChannelId_get_a"))) TS_ChannelId_get_a(uint64_t this_ptr) {
63943         LDKChannelId this_ptr_conv;
63944         this_ptr_conv.inner = untag_ptr(this_ptr);
63945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63947         this_ptr_conv.is_owned = false;
63948         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63949         memcpy(ret_arr->elems, *ChannelId_get_a(&this_ptr_conv), 32);
63950         return ret_arr;
63951 }
63952
63953 void  __attribute__((export_name("TS_ChannelId_set_a"))) TS_ChannelId_set_a(uint64_t this_ptr, int8_tArray val) {
63954         LDKChannelId this_ptr_conv;
63955         this_ptr_conv.inner = untag_ptr(this_ptr);
63956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63958         this_ptr_conv.is_owned = false;
63959         LDKThirtyTwoBytes val_ref;
63960         CHECK(val->arr_len == 32);
63961         memcpy(val_ref.data, val->elems, 32); FREE(val);
63962         ChannelId_set_a(&this_ptr_conv, val_ref);
63963 }
63964
63965 uint64_t  __attribute__((export_name("TS_ChannelId_new"))) TS_ChannelId_new(int8_tArray a_arg) {
63966         LDKThirtyTwoBytes a_arg_ref;
63967         CHECK(a_arg->arr_len == 32);
63968         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63969         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
63970         uint64_t ret_ref = 0;
63971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63973         return ret_ref;
63974 }
63975
63976 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
63977         LDKChannelId ret_var = ChannelId_clone(arg);
63978         uint64_t ret_ref = 0;
63979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63981         return ret_ref;
63982 }
63983 int64_t  __attribute__((export_name("TS_ChannelId_clone_ptr"))) TS_ChannelId_clone_ptr(uint64_t arg) {
63984         LDKChannelId arg_conv;
63985         arg_conv.inner = untag_ptr(arg);
63986         arg_conv.is_owned = ptr_is_owned(arg);
63987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63988         arg_conv.is_owned = false;
63989         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
63990         return ret_conv;
63991 }
63992
63993 uint64_t  __attribute__((export_name("TS_ChannelId_clone"))) TS_ChannelId_clone(uint64_t orig) {
63994         LDKChannelId orig_conv;
63995         orig_conv.inner = untag_ptr(orig);
63996         orig_conv.is_owned = ptr_is_owned(orig);
63997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63998         orig_conv.is_owned = false;
63999         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
64000         uint64_t ret_ref = 0;
64001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64003         return ret_ref;
64004 }
64005
64006 jboolean  __attribute__((export_name("TS_ChannelId_eq"))) TS_ChannelId_eq(uint64_t a, uint64_t b) {
64007         LDKChannelId a_conv;
64008         a_conv.inner = untag_ptr(a);
64009         a_conv.is_owned = ptr_is_owned(a);
64010         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64011         a_conv.is_owned = false;
64012         LDKChannelId b_conv;
64013         b_conv.inner = untag_ptr(b);
64014         b_conv.is_owned = ptr_is_owned(b);
64015         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64016         b_conv.is_owned = false;
64017         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
64018         return ret_conv;
64019 }
64020
64021 int64_t  __attribute__((export_name("TS_ChannelId_hash"))) TS_ChannelId_hash(uint64_t o) {
64022         LDKChannelId o_conv;
64023         o_conv.inner = untag_ptr(o);
64024         o_conv.is_owned = ptr_is_owned(o);
64025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64026         o_conv.is_owned = false;
64027         int64_t ret_conv = ChannelId_hash(&o_conv);
64028         return ret_conv;
64029 }
64030
64031 uint64_t  __attribute__((export_name("TS_ChannelId_v1_from_funding_txid"))) TS_ChannelId_v1_from_funding_txid(int8_tArray txid, int16_t output_index) {
64032         uint8_t txid_arr[32];
64033         CHECK(txid->arr_len == 32);
64034         memcpy(txid_arr, txid->elems, 32); FREE(txid);
64035         uint8_t (*txid_ref)[32] = &txid_arr;
64036         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
64037         uint64_t ret_ref = 0;
64038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64040         return ret_ref;
64041 }
64042
64043 uint64_t  __attribute__((export_name("TS_ChannelId_v1_from_funding_outpoint"))) TS_ChannelId_v1_from_funding_outpoint(uint64_t outpoint) {
64044         LDKOutPoint outpoint_conv;
64045         outpoint_conv.inner = untag_ptr(outpoint);
64046         outpoint_conv.is_owned = ptr_is_owned(outpoint);
64047         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
64048         outpoint_conv = OutPoint_clone(&outpoint_conv);
64049         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
64050         uint64_t ret_ref = 0;
64051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64053         return ret_ref;
64054 }
64055
64056 uint64_t  __attribute__((export_name("TS_ChannelId_temporary_from_entropy_source"))) TS_ChannelId_temporary_from_entropy_source(uint64_t entropy_source) {
64057         void* entropy_source_ptr = untag_ptr(entropy_source);
64058         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64059         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64060         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
64061         uint64_t ret_ref = 0;
64062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64064         return ret_ref;
64065 }
64066
64067 uint64_t  __attribute__((export_name("TS_ChannelId_from_bytes"))) TS_ChannelId_from_bytes(int8_tArray data) {
64068         LDKThirtyTwoBytes data_ref;
64069         CHECK(data->arr_len == 32);
64070         memcpy(data_ref.data, data->elems, 32); FREE(data);
64071         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
64072         uint64_t ret_ref = 0;
64073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64075         return ret_ref;
64076 }
64077
64078 uint64_t  __attribute__((export_name("TS_ChannelId_new_zero"))) TS_ChannelId_new_zero() {
64079         LDKChannelId ret_var = ChannelId_new_zero();
64080         uint64_t ret_ref = 0;
64081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64083         return ret_ref;
64084 }
64085
64086 jboolean  __attribute__((export_name("TS_ChannelId_is_zero"))) TS_ChannelId_is_zero(uint64_t this_arg) {
64087         LDKChannelId this_arg_conv;
64088         this_arg_conv.inner = untag_ptr(this_arg);
64089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64091         this_arg_conv.is_owned = false;
64092         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
64093         return ret_conv;
64094 }
64095
64096 uint64_t  __attribute__((export_name("TS_ChannelId_v2_from_revocation_basepoints"))) TS_ChannelId_v2_from_revocation_basepoints(uint64_t ours, uint64_t theirs) {
64097         LDKRevocationBasepoint ours_conv;
64098         ours_conv.inner = untag_ptr(ours);
64099         ours_conv.is_owned = ptr_is_owned(ours);
64100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
64101         ours_conv.is_owned = false;
64102         LDKRevocationBasepoint theirs_conv;
64103         theirs_conv.inner = untag_ptr(theirs);
64104         theirs_conv.is_owned = ptr_is_owned(theirs);
64105         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
64106         theirs_conv.is_owned = false;
64107         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
64108         uint64_t ret_ref = 0;
64109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64111         return ret_ref;
64112 }
64113
64114 uint64_t  __attribute__((export_name("TS_ChannelId_temporary_v2_from_revocation_basepoint"))) TS_ChannelId_temporary_v2_from_revocation_basepoint(uint64_t our_revocation_basepoint) {
64115         LDKRevocationBasepoint our_revocation_basepoint_conv;
64116         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
64117         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
64118         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
64119         our_revocation_basepoint_conv.is_owned = false;
64120         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
64121         uint64_t ret_ref = 0;
64122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64124         return ret_ref;
64125 }
64126
64127 int8_tArray  __attribute__((export_name("TS_ChannelId_write"))) TS_ChannelId_write(uint64_t obj) {
64128         LDKChannelId obj_conv;
64129         obj_conv.inner = untag_ptr(obj);
64130         obj_conv.is_owned = ptr_is_owned(obj);
64131         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64132         obj_conv.is_owned = false;
64133         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
64134         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64135         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64136         CVec_u8Z_free(ret_var);
64137         return ret_arr;
64138 }
64139
64140 uint64_t  __attribute__((export_name("TS_ChannelId_read"))) TS_ChannelId_read(int8_tArray ser) {
64141         LDKu8slice ser_ref;
64142         ser_ref.datalen = ser->arr_len;
64143         ser_ref.data = ser->elems;
64144         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
64145         *ret_conv = ChannelId_read(ser_ref);
64146         FREE(ser);
64147         return tag_ptr(ret_conv, true);
64148 }
64149
64150 jstring  __attribute__((export_name("TS_ChannelId_to_str"))) TS_ChannelId_to_str(uint64_t o) {
64151         LDKChannelId o_conv;
64152         o_conv.inner = untag_ptr(o);
64153         o_conv.is_owned = ptr_is_owned(o);
64154         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64155         o_conv.is_owned = false;
64156         LDKStr ret_str = ChannelId_to_str(&o_conv);
64157         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64158         Str_free(ret_str);
64159         return ret_conv;
64160 }
64161
64162 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
64163         if (!ptr_is_owned(this_ptr)) return;
64164         void* this_ptr_ptr = untag_ptr(this_ptr);
64165         CHECK_ACCESS(this_ptr_ptr);
64166         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
64167         FREE(untag_ptr(this_ptr));
64168         Retry_free(this_ptr_conv);
64169 }
64170
64171 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
64172         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64173         *ret_copy = Retry_clone(arg);
64174         uint64_t ret_ref = tag_ptr(ret_copy, true);
64175         return ret_ref;
64176 }
64177 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
64178         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
64179         int64_t ret_conv = Retry_clone_ptr(arg_conv);
64180         return ret_conv;
64181 }
64182
64183 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
64184         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
64185         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64186         *ret_copy = Retry_clone(orig_conv);
64187         uint64_t ret_ref = tag_ptr(ret_copy, true);
64188         return ret_ref;
64189 }
64190
64191 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(int32_t a) {
64192         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64193         *ret_copy = Retry_attempts(a);
64194         uint64_t ret_ref = tag_ptr(ret_copy, true);
64195         return ret_ref;
64196 }
64197
64198 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
64199         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
64200         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
64201         jboolean ret_conv = Retry_eq(a_conv, b_conv);
64202         return ret_conv;
64203 }
64204
64205 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
64206         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
64207         int64_t ret_conv = Retry_hash(o_conv);
64208         return ret_conv;
64209 }
64210
64211 int8_tArray  __attribute__((export_name("TS_Retry_write"))) TS_Retry_write(uint64_t obj) {
64212         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
64213         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
64214         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64215         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64216         CVec_u8Z_free(ret_var);
64217         return ret_arr;
64218 }
64219
64220 uint64_t  __attribute__((export_name("TS_Retry_read"))) TS_Retry_read(int8_tArray ser) {
64221         LDKu8slice ser_ref;
64222         ser_ref.datalen = ser->arr_len;
64223         ser_ref.data = ser->elems;
64224         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
64225         *ret_conv = Retry_read(ser_ref);
64226         FREE(ser);
64227         return tag_ptr(ret_conv, true);
64228 }
64229
64230 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
64231         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
64232         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
64233         return ret_conv;
64234 }
64235
64236 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
64237         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
64238         return ret_conv;
64239 }
64240
64241 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
64242         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
64243         return ret_conv;
64244 }
64245
64246 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
64247         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
64248         return ret_conv;
64249 }
64250
64251 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
64252         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
64253         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
64254         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
64255         return ret_conv;
64256 }
64257
64258 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
64259         if (!ptr_is_owned(this_ptr)) return;
64260         void* this_ptr_ptr = untag_ptr(this_ptr);
64261         CHECK_ACCESS(this_ptr_ptr);
64262         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
64263         FREE(untag_ptr(this_ptr));
64264         PaymentSendFailure_free(this_ptr_conv);
64265 }
64266
64267 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
64268         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64269         *ret_copy = PaymentSendFailure_clone(arg);
64270         uint64_t ret_ref = tag_ptr(ret_copy, true);
64271         return ret_ref;
64272 }
64273 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
64274         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
64275         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
64276         return ret_conv;
64277 }
64278
64279 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
64280         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
64281         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64282         *ret_copy = PaymentSendFailure_clone(orig_conv);
64283         uint64_t ret_ref = tag_ptr(ret_copy, true);
64284         return ret_ref;
64285 }
64286
64287 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
64288         void* a_ptr = untag_ptr(a);
64289         CHECK_ACCESS(a_ptr);
64290         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
64291         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
64292         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64293         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
64294         uint64_t ret_ref = tag_ptr(ret_copy, true);
64295         return ret_ref;
64296 }
64297
64298 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
64299         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
64300         a_constr.datalen = a->arr_len;
64301         if (a_constr.datalen > 0)
64302                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64303         else
64304                 a_constr.data = NULL;
64305         uint64_t* a_vals = a->elems;
64306         for (size_t w = 0; w < a_constr.datalen; w++) {
64307                 uint64_t a_conv_22 = a_vals[w];
64308                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
64309                 CHECK_ACCESS(a_conv_22_ptr);
64310                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
64311                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
64312                 a_constr.data[w] = a_conv_22_conv;
64313         }
64314         FREE(a);
64315         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64316         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
64317         uint64_t ret_ref = tag_ptr(ret_copy, true);
64318         return ret_ref;
64319 }
64320
64321 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
64322         LDKCVec_APIErrorZ a_constr;
64323         a_constr.datalen = a->arr_len;
64324         if (a_constr.datalen > 0)
64325                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
64326         else
64327                 a_constr.data = NULL;
64328         uint64_t* a_vals = a->elems;
64329         for (size_t k = 0; k < a_constr.datalen; k++) {
64330                 uint64_t a_conv_10 = a_vals[k];
64331                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
64332                 CHECK_ACCESS(a_conv_10_ptr);
64333                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
64334                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
64335                 a_constr.data[k] = a_conv_10_conv;
64336         }
64337         FREE(a);
64338         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64339         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
64340         uint64_t ret_ref = tag_ptr(ret_copy, true);
64341         return ret_ref;
64342 }
64343
64344 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
64345         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64346         *ret_copy = PaymentSendFailure_duplicate_payment();
64347         uint64_t ret_ref = tag_ptr(ret_copy, true);
64348         return ret_ref;
64349 }
64350
64351 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) {
64352         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
64353         results_constr.datalen = results->arr_len;
64354         if (results_constr.datalen > 0)
64355                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64356         else
64357                 results_constr.data = NULL;
64358         uint64_t* results_vals = results->elems;
64359         for (size_t w = 0; w < results_constr.datalen; w++) {
64360                 uint64_t results_conv_22 = results_vals[w];
64361                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
64362                 CHECK_ACCESS(results_conv_22_ptr);
64363                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
64364                 results_constr.data[w] = results_conv_22_conv;
64365         }
64366         FREE(results);
64367         LDKRouteParameters failed_paths_retry_conv;
64368         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
64369         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
64370         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
64371         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
64372         LDKThirtyTwoBytes payment_id_ref;
64373         CHECK(payment_id->arr_len == 32);
64374         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64375         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64376         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
64377         uint64_t ret_ref = tag_ptr(ret_copy, true);
64378         return ret_ref;
64379 }
64380
64381 jboolean  __attribute__((export_name("TS_PaymentSendFailure_eq"))) TS_PaymentSendFailure_eq(uint64_t a, uint64_t b) {
64382         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
64383         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
64384         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
64385         return ret_conv;
64386 }
64387
64388 void  __attribute__((export_name("TS_ProbeSendFailure_free"))) TS_ProbeSendFailure_free(uint64_t this_ptr) {
64389         if (!ptr_is_owned(this_ptr)) return;
64390         void* this_ptr_ptr = untag_ptr(this_ptr);
64391         CHECK_ACCESS(this_ptr_ptr);
64392         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
64393         FREE(untag_ptr(this_ptr));
64394         ProbeSendFailure_free(this_ptr_conv);
64395 }
64396
64397 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
64398         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64399         *ret_copy = ProbeSendFailure_clone(arg);
64400         uint64_t ret_ref = tag_ptr(ret_copy, true);
64401         return ret_ref;
64402 }
64403 int64_t  __attribute__((export_name("TS_ProbeSendFailure_clone_ptr"))) TS_ProbeSendFailure_clone_ptr(uint64_t arg) {
64404         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
64405         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
64406         return ret_conv;
64407 }
64408
64409 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_clone"))) TS_ProbeSendFailure_clone(uint64_t orig) {
64410         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
64411         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64412         *ret_copy = ProbeSendFailure_clone(orig_conv);
64413         uint64_t ret_ref = tag_ptr(ret_copy, true);
64414         return ret_ref;
64415 }
64416
64417 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_route_not_found"))) TS_ProbeSendFailure_route_not_found() {
64418         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64419         *ret_copy = ProbeSendFailure_route_not_found();
64420         uint64_t ret_ref = tag_ptr(ret_copy, true);
64421         return ret_ref;
64422 }
64423
64424 uint64_t  __attribute__((export_name("TS_ProbeSendFailure_sending_failed"))) TS_ProbeSendFailure_sending_failed(uint64_t a) {
64425         void* a_ptr = untag_ptr(a);
64426         CHECK_ACCESS(a_ptr);
64427         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
64428         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
64429         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64430         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
64431         uint64_t ret_ref = tag_ptr(ret_copy, true);
64432         return ret_ref;
64433 }
64434
64435 jboolean  __attribute__((export_name("TS_ProbeSendFailure_eq"))) TS_ProbeSendFailure_eq(uint64_t a, uint64_t b) {
64436         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
64437         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
64438         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
64439         return ret_conv;
64440 }
64441
64442 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
64443         LDKRecipientOnionFields this_obj_conv;
64444         this_obj_conv.inner = untag_ptr(this_obj);
64445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64447         RecipientOnionFields_free(this_obj_conv);
64448 }
64449
64450 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
64451         LDKRecipientOnionFields this_ptr_conv;
64452         this_ptr_conv.inner = untag_ptr(this_ptr);
64453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64455         this_ptr_conv.is_owned = false;
64456         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
64457         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
64458         uint64_t ret_ref = tag_ptr(ret_copy, true);
64459         return ret_ref;
64460 }
64461
64462 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
64463         LDKRecipientOnionFields this_ptr_conv;
64464         this_ptr_conv.inner = untag_ptr(this_ptr);
64465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64467         this_ptr_conv.is_owned = false;
64468         void* val_ptr = untag_ptr(val);
64469         CHECK_ACCESS(val_ptr);
64470         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
64471         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
64472         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
64473 }
64474
64475 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
64476         LDKRecipientOnionFields this_ptr_conv;
64477         this_ptr_conv.inner = untag_ptr(this_ptr);
64478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64480         this_ptr_conv.is_owned = false;
64481         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64482         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
64483         uint64_t ret_ref = tag_ptr(ret_copy, true);
64484         return ret_ref;
64485 }
64486
64487 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
64488         LDKRecipientOnionFields this_ptr_conv;
64489         this_ptr_conv.inner = untag_ptr(this_ptr);
64490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64492         this_ptr_conv.is_owned = false;
64493         void* val_ptr = untag_ptr(val);
64494         CHECK_ACCESS(val_ptr);
64495         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
64496         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
64497         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
64498 }
64499
64500 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
64501         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
64502         uint64_t ret_ref = 0;
64503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64505         return ret_ref;
64506 }
64507 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
64508         LDKRecipientOnionFields arg_conv;
64509         arg_conv.inner = untag_ptr(arg);
64510         arg_conv.is_owned = ptr_is_owned(arg);
64511         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64512         arg_conv.is_owned = false;
64513         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
64514         return ret_conv;
64515 }
64516
64517 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
64518         LDKRecipientOnionFields orig_conv;
64519         orig_conv.inner = untag_ptr(orig);
64520         orig_conv.is_owned = ptr_is_owned(orig);
64521         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64522         orig_conv.is_owned = false;
64523         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
64524         uint64_t ret_ref = 0;
64525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64527         return ret_ref;
64528 }
64529
64530 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
64531         LDKRecipientOnionFields a_conv;
64532         a_conv.inner = untag_ptr(a);
64533         a_conv.is_owned = ptr_is_owned(a);
64534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64535         a_conv.is_owned = false;
64536         LDKRecipientOnionFields b_conv;
64537         b_conv.inner = untag_ptr(b);
64538         b_conv.is_owned = ptr_is_owned(b);
64539         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64540         b_conv.is_owned = false;
64541         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
64542         return ret_conv;
64543 }
64544
64545 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
64546         LDKRecipientOnionFields obj_conv;
64547         obj_conv.inner = untag_ptr(obj);
64548         obj_conv.is_owned = ptr_is_owned(obj);
64549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64550         obj_conv.is_owned = false;
64551         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
64552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64554         CVec_u8Z_free(ret_var);
64555         return ret_arr;
64556 }
64557
64558 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
64559         LDKu8slice ser_ref;
64560         ser_ref.datalen = ser->arr_len;
64561         ser_ref.data = ser->elems;
64562         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
64563         *ret_conv = RecipientOnionFields_read(ser_ref);
64564         FREE(ser);
64565         return tag_ptr(ret_conv, true);
64566 }
64567
64568 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
64569         LDKThirtyTwoBytes payment_secret_ref;
64570         CHECK(payment_secret->arr_len == 32);
64571         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
64572         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
64573         uint64_t ret_ref = 0;
64574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64576         return ret_ref;
64577 }
64578
64579 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
64580         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
64581         uint64_t ret_ref = 0;
64582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64584         return ret_ref;
64585 }
64586
64587 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_with_custom_tlvs"))) TS_RecipientOnionFields_with_custom_tlvs(uint64_t this_arg, uint64_tArray custom_tlvs) {
64588         LDKRecipientOnionFields this_arg_conv;
64589         this_arg_conv.inner = untag_ptr(this_arg);
64590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64592         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
64593         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
64594         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
64595         if (custom_tlvs_constr.datalen > 0)
64596                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
64597         else
64598                 custom_tlvs_constr.data = NULL;
64599         uint64_t* custom_tlvs_vals = custom_tlvs->elems;
64600         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
64601                 uint64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
64602                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
64603                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
64604                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
64605                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
64606                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
64607         }
64608         FREE(custom_tlvs);
64609         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
64610         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
64611         return tag_ptr(ret_conv, true);
64612 }
64613
64614 uint64_tArray  __attribute__((export_name("TS_RecipientOnionFields_custom_tlvs"))) TS_RecipientOnionFields_custom_tlvs(uint64_t this_arg) {
64615         LDKRecipientOnionFields this_arg_conv;
64616         this_arg_conv.inner = untag_ptr(this_arg);
64617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64619         this_arg_conv.is_owned = false;
64620         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
64621         uint64_tArray ret_arr = NULL;
64622         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
64623         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
64624         for (size_t x = 0; x < ret_var.datalen; x++) {
64625                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
64626                 *ret_conv_23_conv = ret_var.data[x];
64627                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
64628         }
64629         
64630         FREE(ret_var.data);
64631         return ret_arr;
64632 }
64633
64634 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
64635         if (!ptr_is_owned(this_ptr)) return;
64636         void* this_ptr_ptr = untag_ptr(this_ptr);
64637         CHECK_ACCESS(this_ptr_ptr);
64638         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
64639         FREE(untag_ptr(this_ptr));
64640         CustomMessageReader_free(this_ptr_conv);
64641 }
64642
64643 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
64644         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
64645         *ret_ret = Type_clone(arg);
64646         return tag_ptr(ret_ret, true);
64647 }
64648 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
64649         void* arg_ptr = untag_ptr(arg);
64650         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64651         LDKType* arg_conv = (LDKType*)arg_ptr;
64652         int64_t ret_conv = Type_clone_ptr(arg_conv);
64653         return ret_conv;
64654 }
64655
64656 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
64657         void* orig_ptr = untag_ptr(orig);
64658         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64659         LDKType* orig_conv = (LDKType*)orig_ptr;
64660         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
64661         *ret_ret = Type_clone(orig_conv);
64662         return tag_ptr(ret_ret, true);
64663 }
64664
64665 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
64666         if (!ptr_is_owned(this_ptr)) return;
64667         void* this_ptr_ptr = untag_ptr(this_ptr);
64668         CHECK_ACCESS(this_ptr_ptr);
64669         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
64670         FREE(untag_ptr(this_ptr));
64671         Type_free(this_ptr_conv);
64672 }
64673
64674 void  __attribute__((export_name("TS_OfferId_free"))) TS_OfferId_free(uint64_t this_obj) {
64675         LDKOfferId this_obj_conv;
64676         this_obj_conv.inner = untag_ptr(this_obj);
64677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64679         OfferId_free(this_obj_conv);
64680 }
64681
64682 int8_tArray  __attribute__((export_name("TS_OfferId_get_a"))) TS_OfferId_get_a(uint64_t this_ptr) {
64683         LDKOfferId this_ptr_conv;
64684         this_ptr_conv.inner = untag_ptr(this_ptr);
64685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64687         this_ptr_conv.is_owned = false;
64688         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64689         memcpy(ret_arr->elems, *OfferId_get_a(&this_ptr_conv), 32);
64690         return ret_arr;
64691 }
64692
64693 void  __attribute__((export_name("TS_OfferId_set_a"))) TS_OfferId_set_a(uint64_t this_ptr, int8_tArray val) {
64694         LDKOfferId this_ptr_conv;
64695         this_ptr_conv.inner = untag_ptr(this_ptr);
64696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64698         this_ptr_conv.is_owned = false;
64699         LDKThirtyTwoBytes val_ref;
64700         CHECK(val->arr_len == 32);
64701         memcpy(val_ref.data, val->elems, 32); FREE(val);
64702         OfferId_set_a(&this_ptr_conv, val_ref);
64703 }
64704
64705 uint64_t  __attribute__((export_name("TS_OfferId_new"))) TS_OfferId_new(int8_tArray a_arg) {
64706         LDKThirtyTwoBytes a_arg_ref;
64707         CHECK(a_arg->arr_len == 32);
64708         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
64709         LDKOfferId ret_var = OfferId_new(a_arg_ref);
64710         uint64_t ret_ref = 0;
64711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64713         return ret_ref;
64714 }
64715
64716 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
64717         LDKOfferId ret_var = OfferId_clone(arg);
64718         uint64_t ret_ref = 0;
64719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64721         return ret_ref;
64722 }
64723 int64_t  __attribute__((export_name("TS_OfferId_clone_ptr"))) TS_OfferId_clone_ptr(uint64_t arg) {
64724         LDKOfferId arg_conv;
64725         arg_conv.inner = untag_ptr(arg);
64726         arg_conv.is_owned = ptr_is_owned(arg);
64727         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64728         arg_conv.is_owned = false;
64729         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
64730         return ret_conv;
64731 }
64732
64733 uint64_t  __attribute__((export_name("TS_OfferId_clone"))) TS_OfferId_clone(uint64_t orig) {
64734         LDKOfferId orig_conv;
64735         orig_conv.inner = untag_ptr(orig);
64736         orig_conv.is_owned = ptr_is_owned(orig);
64737         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64738         orig_conv.is_owned = false;
64739         LDKOfferId ret_var = OfferId_clone(&orig_conv);
64740         uint64_t ret_ref = 0;
64741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64743         return ret_ref;
64744 }
64745
64746 jboolean  __attribute__((export_name("TS_OfferId_eq"))) TS_OfferId_eq(uint64_t a, uint64_t b) {
64747         LDKOfferId a_conv;
64748         a_conv.inner = untag_ptr(a);
64749         a_conv.is_owned = ptr_is_owned(a);
64750         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64751         a_conv.is_owned = false;
64752         LDKOfferId b_conv;
64753         b_conv.inner = untag_ptr(b);
64754         b_conv.is_owned = ptr_is_owned(b);
64755         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64756         b_conv.is_owned = false;
64757         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
64758         return ret_conv;
64759 }
64760
64761 int8_tArray  __attribute__((export_name("TS_OfferId_write"))) TS_OfferId_write(uint64_t obj) {
64762         LDKOfferId obj_conv;
64763         obj_conv.inner = untag_ptr(obj);
64764         obj_conv.is_owned = ptr_is_owned(obj);
64765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64766         obj_conv.is_owned = false;
64767         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
64768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64770         CVec_u8Z_free(ret_var);
64771         return ret_arr;
64772 }
64773
64774 uint64_t  __attribute__((export_name("TS_OfferId_read"))) TS_OfferId_read(int8_tArray ser) {
64775         LDKu8slice ser_ref;
64776         ser_ref.datalen = ser->arr_len;
64777         ser_ref.data = ser->elems;
64778         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
64779         *ret_conv = OfferId_read(ser_ref);
64780         FREE(ser);
64781         return tag_ptr(ret_conv, true);
64782 }
64783
64784 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_free"))) TS_OfferWithExplicitMetadataBuilder_free(uint64_t this_obj) {
64785         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
64786         this_obj_conv.inner = untag_ptr(this_obj);
64787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64789         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
64790 }
64791
64792 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
64793         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
64794         uint64_t ret_ref = 0;
64795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64797         return ret_ref;
64798 }
64799 int64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_clone_ptr"))) TS_OfferWithExplicitMetadataBuilder_clone_ptr(uint64_t arg) {
64800         LDKOfferWithExplicitMetadataBuilder arg_conv;
64801         arg_conv.inner = untag_ptr(arg);
64802         arg_conv.is_owned = ptr_is_owned(arg);
64803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64804         arg_conv.is_owned = false;
64805         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
64806         return ret_conv;
64807 }
64808
64809 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_clone"))) TS_OfferWithExplicitMetadataBuilder_clone(uint64_t orig) {
64810         LDKOfferWithExplicitMetadataBuilder orig_conv;
64811         orig_conv.inner = untag_ptr(orig);
64812         orig_conv.is_owned = ptr_is_owned(orig);
64813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64814         orig_conv.is_owned = false;
64815         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
64816         uint64_t ret_ref = 0;
64817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64819         return ret_ref;
64820 }
64821
64822 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_free"))) TS_OfferWithDerivedMetadataBuilder_free(uint64_t this_obj) {
64823         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
64824         this_obj_conv.inner = untag_ptr(this_obj);
64825         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64827         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
64828 }
64829
64830 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
64831         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
64832         uint64_t ret_ref = 0;
64833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64835         return ret_ref;
64836 }
64837 int64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_clone_ptr"))) TS_OfferWithDerivedMetadataBuilder_clone_ptr(uint64_t arg) {
64838         LDKOfferWithDerivedMetadataBuilder arg_conv;
64839         arg_conv.inner = untag_ptr(arg);
64840         arg_conv.is_owned = ptr_is_owned(arg);
64841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64842         arg_conv.is_owned = false;
64843         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
64844         return ret_conv;
64845 }
64846
64847 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_clone"))) TS_OfferWithDerivedMetadataBuilder_clone(uint64_t orig) {
64848         LDKOfferWithDerivedMetadataBuilder orig_conv;
64849         orig_conv.inner = untag_ptr(orig);
64850         orig_conv.is_owned = ptr_is_owned(orig);
64851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64852         orig_conv.is_owned = false;
64853         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
64854         uint64_t ret_ref = 0;
64855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64857         return ret_ref;
64858 }
64859
64860 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_new"))) TS_OfferWithExplicitMetadataBuilder_new(int8_tArray signing_pubkey) {
64861         LDKPublicKey signing_pubkey_ref;
64862         CHECK(signing_pubkey->arr_len == 33);
64863         memcpy(signing_pubkey_ref.compressed_form, signing_pubkey->elems, 33); FREE(signing_pubkey);
64864         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
64865         uint64_t ret_ref = 0;
64866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64868         return ret_ref;
64869 }
64870
64871 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_metadata"))) TS_OfferWithExplicitMetadataBuilder_metadata(uint64_t this_arg, int8_tArray metadata) {
64872         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64873         this_arg_conv.inner = untag_ptr(this_arg);
64874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64876         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64877         LDKCVec_u8Z metadata_ref;
64878         metadata_ref.datalen = metadata->arr_len;
64879         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
64880         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
64881         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
64882         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
64883         return tag_ptr(ret_conv, true);
64884 }
64885
64886 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_chain"))) TS_OfferWithExplicitMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
64887         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64888         this_arg_conv.inner = untag_ptr(this_arg);
64889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64891         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64892         LDKNetwork network_conv = LDKNetwork_from_js(network);
64893         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
64894 }
64895
64896 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_amount_msats"))) TS_OfferWithExplicitMetadataBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
64897         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64898         this_arg_conv.inner = untag_ptr(this_arg);
64899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64901         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64902         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
64903 }
64904
64905 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_absolute_expiry"))) TS_OfferWithExplicitMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
64906         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64907         this_arg_conv.inner = untag_ptr(this_arg);
64908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64910         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64911         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
64912 }
64913
64914 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_description"))) TS_OfferWithExplicitMetadataBuilder_description(uint64_t this_arg, jstring description) {
64915         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64916         this_arg_conv.inner = untag_ptr(this_arg);
64917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64919         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64920         LDKStr description_conv = str_ref_to_owned_c(description);
64921         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
64922 }
64923
64924 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_issuer"))) TS_OfferWithExplicitMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
64925         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64926         this_arg_conv.inner = untag_ptr(this_arg);
64927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64929         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64930         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
64931         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
64932 }
64933
64934 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_path"))) TS_OfferWithExplicitMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
64935         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64936         this_arg_conv.inner = untag_ptr(this_arg);
64937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64939         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64940         LDKBlindedPath path_conv;
64941         path_conv.inner = untag_ptr(path);
64942         path_conv.is_owned = ptr_is_owned(path);
64943         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64944         path_conv = BlindedPath_clone(&path_conv);
64945         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
64946 }
64947
64948 void  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_supported_quantity"))) TS_OfferWithExplicitMetadataBuilder_supported_quantity(uint64_t this_arg, uint64_t quantity) {
64949         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64950         this_arg_conv.inner = untag_ptr(this_arg);
64951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64953         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64954         void* quantity_ptr = untag_ptr(quantity);
64955         CHECK_ACCESS(quantity_ptr);
64956         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
64957         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
64958         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
64959 }
64960
64961 uint64_t  __attribute__((export_name("TS_OfferWithExplicitMetadataBuilder_build"))) TS_OfferWithExplicitMetadataBuilder_build(uint64_t this_arg) {
64962         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64963         this_arg_conv.inner = untag_ptr(this_arg);
64964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64966         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64967         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
64968         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
64969         return tag_ptr(ret_conv, true);
64970 }
64971
64972 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_deriving_signing_pubkey"))) TS_OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(int8_tArray node_id, uint64_t expanded_key, uint64_t entropy_source) {
64973         LDKPublicKey node_id_ref;
64974         CHECK(node_id->arr_len == 33);
64975         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
64976         LDKExpandedKey expanded_key_conv;
64977         expanded_key_conv.inner = untag_ptr(expanded_key);
64978         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
64979         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
64980         expanded_key_conv.is_owned = false;
64981         void* entropy_source_ptr = untag_ptr(entropy_source);
64982         CHECK_ACCESS(entropy_source_ptr);
64983         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64984         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64986                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64987         }
64988         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
64989         uint64_t ret_ref = 0;
64990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64992         return ret_ref;
64993 }
64994
64995 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_chain"))) TS_OfferWithDerivedMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
64996         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64997         this_arg_conv.inner = untag_ptr(this_arg);
64998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65000         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65001         LDKNetwork network_conv = LDKNetwork_from_js(network);
65002         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
65003 }
65004
65005 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_amount_msats"))) TS_OfferWithDerivedMetadataBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
65006         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65007         this_arg_conv.inner = untag_ptr(this_arg);
65008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65010         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65011         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
65012 }
65013
65014 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_absolute_expiry"))) TS_OfferWithDerivedMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
65015         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65016         this_arg_conv.inner = untag_ptr(this_arg);
65017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65019         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65020         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
65021 }
65022
65023 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_description"))) TS_OfferWithDerivedMetadataBuilder_description(uint64_t this_arg, jstring description) {
65024         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65025         this_arg_conv.inner = untag_ptr(this_arg);
65026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65028         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65029         LDKStr description_conv = str_ref_to_owned_c(description);
65030         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
65031 }
65032
65033 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_issuer"))) TS_OfferWithDerivedMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
65034         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65035         this_arg_conv.inner = untag_ptr(this_arg);
65036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65038         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65039         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
65040         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
65041 }
65042
65043 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_path"))) TS_OfferWithDerivedMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
65044         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65045         this_arg_conv.inner = untag_ptr(this_arg);
65046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65048         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65049         LDKBlindedPath path_conv;
65050         path_conv.inner = untag_ptr(path);
65051         path_conv.is_owned = ptr_is_owned(path);
65052         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
65053         path_conv = BlindedPath_clone(&path_conv);
65054         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
65055 }
65056
65057 void  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_supported_quantity"))) TS_OfferWithDerivedMetadataBuilder_supported_quantity(uint64_t this_arg, uint64_t quantity) {
65058         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65059         this_arg_conv.inner = untag_ptr(this_arg);
65060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65062         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65063         void* quantity_ptr = untag_ptr(quantity);
65064         CHECK_ACCESS(quantity_ptr);
65065         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
65066         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
65067         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
65068 }
65069
65070 uint64_t  __attribute__((export_name("TS_OfferWithDerivedMetadataBuilder_build"))) TS_OfferWithDerivedMetadataBuilder_build(uint64_t this_arg) {
65071         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65072         this_arg_conv.inner = untag_ptr(this_arg);
65073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65075         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65076         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
65077         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
65078         return tag_ptr(ret_conv, true);
65079 }
65080
65081 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
65082         LDKOffer this_obj_conv;
65083         this_obj_conv.inner = untag_ptr(this_obj);
65084         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65086         Offer_free(this_obj_conv);
65087 }
65088
65089 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
65090         LDKOffer ret_var = Offer_clone(arg);
65091         uint64_t ret_ref = 0;
65092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65094         return ret_ref;
65095 }
65096 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
65097         LDKOffer arg_conv;
65098         arg_conv.inner = untag_ptr(arg);
65099         arg_conv.is_owned = ptr_is_owned(arg);
65100         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65101         arg_conv.is_owned = false;
65102         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
65103         return ret_conv;
65104 }
65105
65106 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
65107         LDKOffer orig_conv;
65108         orig_conv.inner = untag_ptr(orig);
65109         orig_conv.is_owned = ptr_is_owned(orig);
65110         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65111         orig_conv.is_owned = false;
65112         LDKOffer ret_var = Offer_clone(&orig_conv);
65113         uint64_t ret_ref = 0;
65114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65116         return ret_ref;
65117 }
65118
65119 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
65120         LDKOffer this_arg_conv;
65121         this_arg_conv.inner = untag_ptr(this_arg);
65122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65124         this_arg_conv.is_owned = false;
65125         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
65126         ptrArray ret_arr = NULL;
65127         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
65128         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
65129         for (size_t m = 0; m < ret_var.datalen; m++) {
65130                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
65131                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
65132                 ret_arr_ptr[m] = ret_conv_12_arr;
65133         }
65134         
65135         FREE(ret_var.data);
65136         return ret_arr;
65137 }
65138
65139 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
65140         LDKOffer this_arg_conv;
65141         this_arg_conv.inner = untag_ptr(this_arg);
65142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65144         this_arg_conv.is_owned = false;
65145         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65146         *ret_copy = Offer_metadata(&this_arg_conv);
65147         uint64_t ret_ref = tag_ptr(ret_copy, true);
65148         return ret_ref;
65149 }
65150
65151 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
65152         LDKOffer this_arg_conv;
65153         this_arg_conv.inner = untag_ptr(this_arg);
65154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65156         this_arg_conv.is_owned = false;
65157         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
65158         *ret_copy = Offer_amount(&this_arg_conv);
65159         uint64_t ret_ref = tag_ptr(ret_copy, true);
65160         return ret_ref;
65161 }
65162
65163 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
65164         LDKOffer this_arg_conv;
65165         this_arg_conv.inner = untag_ptr(this_arg);
65166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65168         this_arg_conv.is_owned = false;
65169         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
65170         uint64_t ret_ref = 0;
65171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65173         return ret_ref;
65174 }
65175
65176 uint64_t  __attribute__((export_name("TS_Offer_offer_features"))) TS_Offer_offer_features(uint64_t this_arg) {
65177         LDKOffer this_arg_conv;
65178         this_arg_conv.inner = untag_ptr(this_arg);
65179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65181         this_arg_conv.is_owned = false;
65182         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
65183         uint64_t ret_ref = 0;
65184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65186         return ret_ref;
65187 }
65188
65189 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
65190         LDKOffer this_arg_conv;
65191         this_arg_conv.inner = untag_ptr(this_arg);
65192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65194         this_arg_conv.is_owned = false;
65195         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65196         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
65197         uint64_t ret_ref = tag_ptr(ret_copy, true);
65198         return ret_ref;
65199 }
65200
65201 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
65202         LDKOffer this_arg_conv;
65203         this_arg_conv.inner = untag_ptr(this_arg);
65204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65206         this_arg_conv.is_owned = false;
65207         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
65208         uint64_t ret_ref = 0;
65209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65211         return ret_ref;
65212 }
65213
65214 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
65215         LDKOffer this_arg_conv;
65216         this_arg_conv.inner = untag_ptr(this_arg);
65217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65219         this_arg_conv.is_owned = false;
65220         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
65221         uint64_tArray ret_arr = NULL;
65222         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
65223         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
65224         for (size_t n = 0; n < ret_var.datalen; n++) {
65225                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65226                 uint64_t ret_conv_13_ref = 0;
65227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65228                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65229                 ret_arr_ptr[n] = ret_conv_13_ref;
65230         }
65231         
65232         FREE(ret_var.data);
65233         return ret_arr;
65234 }
65235
65236 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
65237         LDKOffer this_arg_conv;
65238         this_arg_conv.inner = untag_ptr(this_arg);
65239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65241         this_arg_conv.is_owned = false;
65242         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65243         *ret_copy = Offer_supported_quantity(&this_arg_conv);
65244         uint64_t ret_ref = tag_ptr(ret_copy, true);
65245         return ret_ref;
65246 }
65247
65248 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
65249         LDKOffer this_arg_conv;
65250         this_arg_conv.inner = untag_ptr(this_arg);
65251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65253         this_arg_conv.is_owned = false;
65254         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65255         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
65256         return ret_arr;
65257 }
65258
65259 uint64_t  __attribute__((export_name("TS_Offer_id"))) TS_Offer_id(uint64_t this_arg) {
65260         LDKOffer this_arg_conv;
65261         this_arg_conv.inner = untag_ptr(this_arg);
65262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65264         this_arg_conv.is_owned = false;
65265         LDKOfferId ret_var = Offer_id(&this_arg_conv);
65266         uint64_t ret_ref = 0;
65267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65269         return ret_ref;
65270 }
65271
65272 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
65273         LDKOffer this_arg_conv;
65274         this_arg_conv.inner = untag_ptr(this_arg);
65275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65277         this_arg_conv.is_owned = false;
65278         LDKThirtyTwoBytes chain_ref;
65279         CHECK(chain->arr_len == 32);
65280         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
65281         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
65282         return ret_conv;
65283 }
65284
65285 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) {
65286         LDKOffer this_arg_conv;
65287         this_arg_conv.inner = untag_ptr(this_arg);
65288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65290         this_arg_conv.is_owned = false;
65291         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
65292         return ret_conv;
65293 }
65294
65295 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
65296         LDKOffer this_arg_conv;
65297         this_arg_conv.inner = untag_ptr(this_arg);
65298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65300         this_arg_conv.is_owned = false;
65301         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
65302         return ret_conv;
65303 }
65304
65305 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
65306         LDKOffer this_arg_conv;
65307         this_arg_conv.inner = untag_ptr(this_arg);
65308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65310         this_arg_conv.is_owned = false;
65311         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
65312         return ret_conv;
65313 }
65314
65315 uint64_t  __attribute__((export_name("TS_Offer_request_invoice_deriving_payer_id"))) TS_Offer_request_invoice_deriving_payer_id(uint64_t this_arg, uint64_t expanded_key, uint64_t entropy_source, int8_tArray payment_id) {
65316         LDKOffer this_arg_conv;
65317         this_arg_conv.inner = untag_ptr(this_arg);
65318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65320         this_arg_conv.is_owned = false;
65321         LDKExpandedKey expanded_key_conv;
65322         expanded_key_conv.inner = untag_ptr(expanded_key);
65323         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
65324         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
65325         expanded_key_conv.is_owned = false;
65326         void* entropy_source_ptr = untag_ptr(entropy_source);
65327         CHECK_ACCESS(entropy_source_ptr);
65328         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
65329         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
65330                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65331                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
65332         }
65333         LDKThirtyTwoBytes payment_id_ref;
65334         CHECK(payment_id->arr_len == 32);
65335         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
65336         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
65337         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
65338         return tag_ptr(ret_conv, true);
65339 }
65340
65341 uint64_t  __attribute__((export_name("TS_Offer_request_invoice_deriving_metadata"))) TS_Offer_request_invoice_deriving_metadata(uint64_t this_arg, int8_tArray payer_id, uint64_t expanded_key, uint64_t entropy_source, int8_tArray payment_id) {
65342         LDKOffer this_arg_conv;
65343         this_arg_conv.inner = untag_ptr(this_arg);
65344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65346         this_arg_conv.is_owned = false;
65347         LDKPublicKey payer_id_ref;
65348         CHECK(payer_id->arr_len == 33);
65349         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
65350         LDKExpandedKey expanded_key_conv;
65351         expanded_key_conv.inner = untag_ptr(expanded_key);
65352         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
65353         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
65354         expanded_key_conv.is_owned = false;
65355         void* entropy_source_ptr = untag_ptr(entropy_source);
65356         CHECK_ACCESS(entropy_source_ptr);
65357         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
65358         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
65359                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65360                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
65361         }
65362         LDKThirtyTwoBytes payment_id_ref;
65363         CHECK(payment_id->arr_len == 32);
65364         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
65365         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
65366         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
65367         return tag_ptr(ret_conv, true);
65368 }
65369
65370 uint64_t  __attribute__((export_name("TS_Offer_request_invoice"))) TS_Offer_request_invoice(uint64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
65371         LDKOffer this_arg_conv;
65372         this_arg_conv.inner = untag_ptr(this_arg);
65373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65375         this_arg_conv.is_owned = false;
65376         LDKCVec_u8Z metadata_ref;
65377         metadata_ref.datalen = metadata->arr_len;
65378         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
65379         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
65380         LDKPublicKey payer_id_ref;
65381         CHECK(payer_id->arr_len == 33);
65382         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
65383         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
65384         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
65385         return tag_ptr(ret_conv, true);
65386 }
65387
65388 int64_t  __attribute__((export_name("TS_Offer_hash"))) TS_Offer_hash(uint64_t o) {
65389         LDKOffer o_conv;
65390         o_conv.inner = untag_ptr(o);
65391         o_conv.is_owned = ptr_is_owned(o);
65392         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65393         o_conv.is_owned = false;
65394         int64_t ret_conv = Offer_hash(&o_conv);
65395         return ret_conv;
65396 }
65397
65398 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
65399         LDKOffer obj_conv;
65400         obj_conv.inner = untag_ptr(obj);
65401         obj_conv.is_owned = ptr_is_owned(obj);
65402         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65403         obj_conv.is_owned = false;
65404         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
65405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65407         CVec_u8Z_free(ret_var);
65408         return ret_arr;
65409 }
65410
65411 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_ptr) {
65412         if (!ptr_is_owned(this_ptr)) return;
65413         void* this_ptr_ptr = untag_ptr(this_ptr);
65414         CHECK_ACCESS(this_ptr_ptr);
65415         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
65416         FREE(untag_ptr(this_ptr));
65417         Amount_free(this_ptr_conv);
65418 }
65419
65420 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
65421         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65422         *ret_copy = Amount_clone(arg);
65423         uint64_t ret_ref = tag_ptr(ret_copy, true);
65424         return ret_ref;
65425 }
65426 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
65427         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
65428         int64_t ret_conv = Amount_clone_ptr(arg_conv);
65429         return ret_conv;
65430 }
65431
65432 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
65433         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
65434         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65435         *ret_copy = Amount_clone(orig_conv);
65436         uint64_t ret_ref = tag_ptr(ret_copy, true);
65437         return ret_ref;
65438 }
65439
65440 uint64_t  __attribute__((export_name("TS_Amount_bitcoin"))) TS_Amount_bitcoin(int64_t amount_msats) {
65441         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65442         *ret_copy = Amount_bitcoin(amount_msats);
65443         uint64_t ret_ref = tag_ptr(ret_copy, true);
65444         return ret_ref;
65445 }
65446
65447 uint64_t  __attribute__((export_name("TS_Amount_currency"))) TS_Amount_currency(int8_tArray iso4217_code, int64_t amount) {
65448         LDKThreeBytes iso4217_code_ref;
65449         CHECK(iso4217_code->arr_len == 3);
65450         memcpy(iso4217_code_ref.data, iso4217_code->elems, 3); FREE(iso4217_code);
65451         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65452         *ret_copy = Amount_currency(iso4217_code_ref, amount);
65453         uint64_t ret_ref = tag_ptr(ret_copy, true);
65454         return ret_ref;
65455 }
65456
65457 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_ptr) {
65458         if (!ptr_is_owned(this_ptr)) return;
65459         void* this_ptr_ptr = untag_ptr(this_ptr);
65460         CHECK_ACCESS(this_ptr_ptr);
65461         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
65462         FREE(untag_ptr(this_ptr));
65463         Quantity_free(this_ptr_conv);
65464 }
65465
65466 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
65467         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65468         *ret_copy = Quantity_clone(arg);
65469         uint64_t ret_ref = tag_ptr(ret_copy, true);
65470         return ret_ref;
65471 }
65472 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
65473         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
65474         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
65475         return ret_conv;
65476 }
65477
65478 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
65479         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
65480         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65481         *ret_copy = Quantity_clone(orig_conv);
65482         uint64_t ret_ref = tag_ptr(ret_copy, true);
65483         return ret_ref;
65484 }
65485
65486 uint64_t  __attribute__((export_name("TS_Quantity_bounded"))) TS_Quantity_bounded(int64_t a) {
65487         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65488         *ret_copy = Quantity_bounded(a);
65489         uint64_t ret_ref = tag_ptr(ret_copy, true);
65490         return ret_ref;
65491 }
65492
65493 uint64_t  __attribute__((export_name("TS_Quantity_unbounded"))) TS_Quantity_unbounded() {
65494         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65495         *ret_copy = Quantity_unbounded();
65496         uint64_t ret_ref = tag_ptr(ret_copy, true);
65497         return ret_ref;
65498 }
65499
65500 uint64_t  __attribute__((export_name("TS_Quantity_one"))) TS_Quantity_one() {
65501         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65502         *ret_copy = Quantity_one();
65503         uint64_t ret_ref = tag_ptr(ret_copy, true);
65504         return ret_ref;
65505 }
65506
65507 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
65508         LDKStr s_conv = str_ref_to_owned_c(s);
65509         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
65510         *ret_conv = Offer_from_str(s_conv);
65511         return tag_ptr(ret_conv, true);
65512 }
65513
65514 jstring  __attribute__((export_name("TS_Offer_to_str"))) TS_Offer_to_str(uint64_t o) {
65515         LDKOffer o_conv;
65516         o_conv.inner = untag_ptr(o);
65517         o_conv.is_owned = ptr_is_owned(o);
65518         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65519         o_conv.is_owned = false;
65520         LDKStr ret_str = Offer_to_str(&o_conv);
65521         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
65522         Str_free(ret_str);
65523         return ret_conv;
65524 }
65525
65526 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_free"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_free(uint64_t this_obj) {
65527         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
65528         this_obj_conv.inner = untag_ptr(this_obj);
65529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65531         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
65532 }
65533
65534 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_free"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_free(uint64_t this_obj) {
65535         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
65536         this_obj_conv.inner = untag_ptr(this_obj);
65537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65539         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
65540 }
65541
65542 uint64_t  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_build"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_build(uint64_t this_arg) {
65543         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65544         this_arg_conv.inner = untag_ptr(this_arg);
65545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65547         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65548         
65549         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
65550         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
65551         return tag_ptr(ret_conv, true);
65552 }
65553
65554 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(uint64_t this_arg, int32_t relative_expiry_secs) {
65555         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65556         this_arg_conv.inner = untag_ptr(this_arg);
65557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65559         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65560         
65561         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
65562 }
65563
65564 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(uint64_t this_arg, int8_tArray script_hash) {
65565         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65566         this_arg_conv.inner = untag_ptr(this_arg);
65567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65569         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65570         
65571         uint8_t script_hash_arr[32];
65572         CHECK(script_hash->arr_len == 32);
65573         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
65574         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
65575         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
65576 }
65577
65578 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(uint64_t this_arg, int8_tArray pubkey_hash) {
65579         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65580         this_arg_conv.inner = untag_ptr(this_arg);
65581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65583         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65584         
65585         uint8_t pubkey_hash_arr[20];
65586         CHECK(pubkey_hash->arr_len == 20);
65587         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
65588         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
65589         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
65590 }
65591
65592 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(uint64_t this_arg, int8_tArray utput_key) {
65593         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65594         this_arg_conv.inner = untag_ptr(this_arg);
65595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65597         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65598         
65599         LDKTweakedPublicKey utput_key_ref;
65600         CHECK(utput_key->arr_len == 32);
65601         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
65602         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
65603 }
65604
65605 void  __attribute__((export_name("TS_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp"))) TS_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(uint64_t this_arg) {
65606         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65607         this_arg_conv.inner = untag_ptr(this_arg);
65608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65610         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65611         
65612         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
65613 }
65614
65615 uint64_t  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(uint64_t this_arg) {
65616         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
65617         this_arg_conv.inner = untag_ptr(this_arg);
65618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65620         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
65621         
65622         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
65623         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
65624         return tag_ptr(ret_conv, true);
65625 }
65626
65627 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(uint64_t this_arg, int32_t relative_expiry_secs) {
65628         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
65629         this_arg_conv.inner = untag_ptr(this_arg);
65630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65632         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
65633         
65634         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
65635 }
65636
65637 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(uint64_t this_arg, int8_tArray script_hash) {
65638         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
65639         this_arg_conv.inner = untag_ptr(this_arg);
65640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65642         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
65643         
65644         uint8_t script_hash_arr[32];
65645         CHECK(script_hash->arr_len == 32);
65646         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
65647         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
65648         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
65649 }
65650
65651 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(uint64_t this_arg, int8_tArray pubkey_hash) {
65652         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
65653         this_arg_conv.inner = untag_ptr(this_arg);
65654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65656         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
65657         
65658         uint8_t pubkey_hash_arr[20];
65659         CHECK(pubkey_hash->arr_len == 20);
65660         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
65661         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
65662         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
65663 }
65664
65665 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(uint64_t this_arg, int8_tArray utput_key) {
65666         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
65667         this_arg_conv.inner = untag_ptr(this_arg);
65668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65670         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
65671         
65672         LDKTweakedPublicKey utput_key_ref;
65673         CHECK(utput_key->arr_len == 32);
65674         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
65675         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
65676 }
65677
65678 void  __attribute__((export_name("TS_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp"))) TS_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(uint64_t this_arg) {
65679         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
65680         this_arg_conv.inner = untag_ptr(this_arg);
65681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65683         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
65684         
65685         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
65686 }
65687
65688 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
65689         LDKUnsignedBolt12Invoice this_obj_conv;
65690         this_obj_conv.inner = untag_ptr(this_obj);
65691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65693         UnsignedBolt12Invoice_free(this_obj_conv);
65694 }
65695
65696 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
65697         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
65698         uint64_t ret_ref = 0;
65699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65701         return ret_ref;
65702 }
65703 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_clone_ptr"))) TS_UnsignedBolt12Invoice_clone_ptr(uint64_t arg) {
65704         LDKUnsignedBolt12Invoice arg_conv;
65705         arg_conv.inner = untag_ptr(arg);
65706         arg_conv.is_owned = ptr_is_owned(arg);
65707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65708         arg_conv.is_owned = false;
65709         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
65710         return ret_conv;
65711 }
65712
65713 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_clone"))) TS_UnsignedBolt12Invoice_clone(uint64_t orig) {
65714         LDKUnsignedBolt12Invoice orig_conv;
65715         orig_conv.inner = untag_ptr(orig);
65716         orig_conv.is_owned = ptr_is_owned(orig);
65717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65718         orig_conv.is_owned = false;
65719         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
65720         uint64_t ret_ref = 0;
65721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65723         return ret_ref;
65724 }
65725
65726 void  __attribute__((export_name("TS_SignBolt12InvoiceFn_free"))) TS_SignBolt12InvoiceFn_free(uint64_t this_ptr) {
65727         if (!ptr_is_owned(this_ptr)) return;
65728         void* this_ptr_ptr = untag_ptr(this_ptr);
65729         CHECK_ACCESS(this_ptr_ptr);
65730         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
65731         FREE(untag_ptr(this_ptr));
65732         SignBolt12InvoiceFn_free(this_ptr_conv);
65733 }
65734
65735 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_tagged_hash"))) TS_UnsignedBolt12Invoice_tagged_hash(uint64_t this_arg) {
65736         LDKUnsignedBolt12Invoice this_arg_conv;
65737         this_arg_conv.inner = untag_ptr(this_arg);
65738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65740         this_arg_conv.is_owned = false;
65741         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
65742         uint64_t ret_ref = 0;
65743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65745         return ret_ref;
65746 }
65747
65748 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
65749         LDKBolt12Invoice this_obj_conv;
65750         this_obj_conv.inner = untag_ptr(this_obj);
65751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65753         Bolt12Invoice_free(this_obj_conv);
65754 }
65755
65756 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
65757         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
65758         uint64_t ret_ref = 0;
65759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65761         return ret_ref;
65762 }
65763 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
65764         LDKBolt12Invoice arg_conv;
65765         arg_conv.inner = untag_ptr(arg);
65766         arg_conv.is_owned = ptr_is_owned(arg);
65767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65768         arg_conv.is_owned = false;
65769         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
65770         return ret_conv;
65771 }
65772
65773 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
65774         LDKBolt12Invoice orig_conv;
65775         orig_conv.inner = untag_ptr(orig);
65776         orig_conv.is_owned = ptr_is_owned(orig);
65777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65778         orig_conv.is_owned = false;
65779         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
65780         uint64_t ret_ref = 0;
65781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65783         return ret_ref;
65784 }
65785
65786 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_chains"))) TS_UnsignedBolt12Invoice_offer_chains(uint64_t this_arg) {
65787         LDKUnsignedBolt12Invoice this_arg_conv;
65788         this_arg_conv.inner = untag_ptr(this_arg);
65789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65791         this_arg_conv.is_owned = false;
65792         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
65793         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
65794         uint64_t ret_ref = tag_ptr(ret_copy, true);
65795         return ret_ref;
65796 }
65797
65798 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_chain"))) TS_UnsignedBolt12Invoice_chain(uint64_t this_arg) {
65799         LDKUnsignedBolt12Invoice this_arg_conv;
65800         this_arg_conv.inner = untag_ptr(this_arg);
65801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65803         this_arg_conv.is_owned = false;
65804         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65805         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
65806         return ret_arr;
65807 }
65808
65809 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_metadata"))) TS_UnsignedBolt12Invoice_metadata(uint64_t this_arg) {
65810         LDKUnsignedBolt12Invoice this_arg_conv;
65811         this_arg_conv.inner = untag_ptr(this_arg);
65812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65814         this_arg_conv.is_owned = false;
65815         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65816         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
65817         uint64_t ret_ref = tag_ptr(ret_copy, true);
65818         return ret_ref;
65819 }
65820
65821 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount"))) TS_UnsignedBolt12Invoice_amount(uint64_t this_arg) {
65822         LDKUnsignedBolt12Invoice this_arg_conv;
65823         this_arg_conv.inner = untag_ptr(this_arg);
65824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65826         this_arg_conv.is_owned = false;
65827         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
65828         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
65829         uint64_t ret_ref = tag_ptr(ret_copy, true);
65830         return ret_ref;
65831 }
65832
65833 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_offer_features"))) TS_UnsignedBolt12Invoice_offer_features(uint64_t this_arg) {
65834         LDKUnsignedBolt12Invoice this_arg_conv;
65835         this_arg_conv.inner = untag_ptr(this_arg);
65836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65838         this_arg_conv.is_owned = false;
65839         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
65840         uint64_t ret_ref = 0;
65841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65843         return ret_ref;
65844 }
65845
65846 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_description"))) TS_UnsignedBolt12Invoice_description(uint64_t this_arg) {
65847         LDKUnsignedBolt12Invoice this_arg_conv;
65848         this_arg_conv.inner = untag_ptr(this_arg);
65849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65851         this_arg_conv.is_owned = false;
65852         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
65853         uint64_t ret_ref = 0;
65854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65856         return ret_ref;
65857 }
65858
65859 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_absolute_expiry"))) TS_UnsignedBolt12Invoice_absolute_expiry(uint64_t this_arg) {
65860         LDKUnsignedBolt12Invoice this_arg_conv;
65861         this_arg_conv.inner = untag_ptr(this_arg);
65862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65864         this_arg_conv.is_owned = false;
65865         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65866         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
65867         uint64_t ret_ref = tag_ptr(ret_copy, true);
65868         return ret_ref;
65869 }
65870
65871 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_issuer"))) TS_UnsignedBolt12Invoice_issuer(uint64_t this_arg) {
65872         LDKUnsignedBolt12Invoice this_arg_conv;
65873         this_arg_conv.inner = untag_ptr(this_arg);
65874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65876         this_arg_conv.is_owned = false;
65877         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
65878         uint64_t ret_ref = 0;
65879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65881         return ret_ref;
65882 }
65883
65884 uint64_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_message_paths"))) TS_UnsignedBolt12Invoice_message_paths(uint64_t this_arg) {
65885         LDKUnsignedBolt12Invoice this_arg_conv;
65886         this_arg_conv.inner = untag_ptr(this_arg);
65887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65889         this_arg_conv.is_owned = false;
65890         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
65891         uint64_tArray ret_arr = NULL;
65892         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
65893         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
65894         for (size_t n = 0; n < ret_var.datalen; n++) {
65895                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65896                 uint64_t ret_conv_13_ref = 0;
65897                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65898                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65899                 ret_arr_ptr[n] = ret_conv_13_ref;
65900         }
65901         
65902         FREE(ret_var.data);
65903         return ret_arr;
65904 }
65905
65906 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_supported_quantity"))) TS_UnsignedBolt12Invoice_supported_quantity(uint64_t this_arg) {
65907         LDKUnsignedBolt12Invoice this_arg_conv;
65908         this_arg_conv.inner = untag_ptr(this_arg);
65909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65911         this_arg_conv.is_owned = false;
65912         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
65913         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
65914         uint64_t ret_ref = tag_ptr(ret_copy, true);
65915         return ret_ref;
65916 }
65917
65918 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_metadata"))) TS_UnsignedBolt12Invoice_payer_metadata(uint64_t this_arg) {
65919         LDKUnsignedBolt12Invoice this_arg_conv;
65920         this_arg_conv.inner = untag_ptr(this_arg);
65921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65923         this_arg_conv.is_owned = false;
65924         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
65925         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65926         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65927         return ret_arr;
65928 }
65929
65930 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_request_features"))) TS_UnsignedBolt12Invoice_invoice_request_features(uint64_t this_arg) {
65931         LDKUnsignedBolt12Invoice this_arg_conv;
65932         this_arg_conv.inner = untag_ptr(this_arg);
65933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65935         this_arg_conv.is_owned = false;
65936         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
65937         uint64_t ret_ref = 0;
65938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65940         return ret_ref;
65941 }
65942
65943 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_quantity"))) TS_UnsignedBolt12Invoice_quantity(uint64_t this_arg) {
65944         LDKUnsignedBolt12Invoice this_arg_conv;
65945         this_arg_conv.inner = untag_ptr(this_arg);
65946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65948         this_arg_conv.is_owned = false;
65949         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65950         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
65951         uint64_t ret_ref = tag_ptr(ret_copy, true);
65952         return ret_ref;
65953 }
65954
65955 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_id"))) TS_UnsignedBolt12Invoice_payer_id(uint64_t this_arg) {
65956         LDKUnsignedBolt12Invoice this_arg_conv;
65957         this_arg_conv.inner = untag_ptr(this_arg);
65958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65960         this_arg_conv.is_owned = false;
65961         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65962         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
65963         return ret_arr;
65964 }
65965
65966 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_payer_note"))) TS_UnsignedBolt12Invoice_payer_note(uint64_t this_arg) {
65967         LDKUnsignedBolt12Invoice this_arg_conv;
65968         this_arg_conv.inner = untag_ptr(this_arg);
65969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65971         this_arg_conv.is_owned = false;
65972         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
65973         uint64_t ret_ref = 0;
65974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65976         return ret_ref;
65977 }
65978
65979 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_created_at"))) TS_UnsignedBolt12Invoice_created_at(uint64_t this_arg) {
65980         LDKUnsignedBolt12Invoice this_arg_conv;
65981         this_arg_conv.inner = untag_ptr(this_arg);
65982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65984         this_arg_conv.is_owned = false;
65985         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
65986         return ret_conv;
65987 }
65988
65989 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_relative_expiry"))) TS_UnsignedBolt12Invoice_relative_expiry(uint64_t this_arg) {
65990         LDKUnsignedBolt12Invoice this_arg_conv;
65991         this_arg_conv.inner = untag_ptr(this_arg);
65992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65994         this_arg_conv.is_owned = false;
65995         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
65996         return ret_conv;
65997 }
65998
65999 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_payment_hash"))) TS_UnsignedBolt12Invoice_payment_hash(uint64_t this_arg) {
66000         LDKUnsignedBolt12Invoice this_arg_conv;
66001         this_arg_conv.inner = untag_ptr(this_arg);
66002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66004         this_arg_conv.is_owned = false;
66005         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66006         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
66007         return ret_arr;
66008 }
66009
66010 int64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_amount_msats"))) TS_UnsignedBolt12Invoice_amount_msats(uint64_t this_arg) {
66011         LDKUnsignedBolt12Invoice this_arg_conv;
66012         this_arg_conv.inner = untag_ptr(this_arg);
66013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66015         this_arg_conv.is_owned = false;
66016         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
66017         return ret_conv;
66018 }
66019
66020 uint64_t  __attribute__((export_name("TS_UnsignedBolt12Invoice_invoice_features"))) TS_UnsignedBolt12Invoice_invoice_features(uint64_t this_arg) {
66021         LDKUnsignedBolt12Invoice this_arg_conv;
66022         this_arg_conv.inner = untag_ptr(this_arg);
66023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66025         this_arg_conv.is_owned = false;
66026         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
66027         uint64_t ret_ref = 0;
66028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66030         return ret_ref;
66031 }
66032
66033 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
66034         LDKUnsignedBolt12Invoice this_arg_conv;
66035         this_arg_conv.inner = untag_ptr(this_arg);
66036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66038         this_arg_conv.is_owned = false;
66039         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66040         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
66041         return ret_arr;
66042 }
66043
66044 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_chains"))) TS_Bolt12Invoice_offer_chains(uint64_t this_arg) {
66045         LDKBolt12Invoice this_arg_conv;
66046         this_arg_conv.inner = untag_ptr(this_arg);
66047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66049         this_arg_conv.is_owned = false;
66050         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
66051         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
66052         uint64_t ret_ref = tag_ptr(ret_copy, true);
66053         return ret_ref;
66054 }
66055
66056 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_chain"))) TS_Bolt12Invoice_chain(uint64_t this_arg) {
66057         LDKBolt12Invoice this_arg_conv;
66058         this_arg_conv.inner = untag_ptr(this_arg);
66059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66061         this_arg_conv.is_owned = false;
66062         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66063         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
66064         return ret_arr;
66065 }
66066
66067 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_metadata"))) TS_Bolt12Invoice_metadata(uint64_t this_arg) {
66068         LDKBolt12Invoice this_arg_conv;
66069         this_arg_conv.inner = untag_ptr(this_arg);
66070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66072         this_arg_conv.is_owned = false;
66073         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66074         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
66075         uint64_t ret_ref = tag_ptr(ret_copy, true);
66076         return ret_ref;
66077 }
66078
66079 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_amount"))) TS_Bolt12Invoice_amount(uint64_t this_arg) {
66080         LDKBolt12Invoice this_arg_conv;
66081         this_arg_conv.inner = untag_ptr(this_arg);
66082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66084         this_arg_conv.is_owned = false;
66085         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66086         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
66087         uint64_t ret_ref = tag_ptr(ret_copy, true);
66088         return ret_ref;
66089 }
66090
66091 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_offer_features"))) TS_Bolt12Invoice_offer_features(uint64_t this_arg) {
66092         LDKBolt12Invoice this_arg_conv;
66093         this_arg_conv.inner = untag_ptr(this_arg);
66094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66096         this_arg_conv.is_owned = false;
66097         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
66098         uint64_t ret_ref = 0;
66099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66101         return ret_ref;
66102 }
66103
66104 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
66105         LDKBolt12Invoice this_arg_conv;
66106         this_arg_conv.inner = untag_ptr(this_arg);
66107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66109         this_arg_conv.is_owned = false;
66110         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
66111         uint64_t ret_ref = 0;
66112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66114         return ret_ref;
66115 }
66116
66117 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_absolute_expiry"))) TS_Bolt12Invoice_absolute_expiry(uint64_t this_arg) {
66118         LDKBolt12Invoice this_arg_conv;
66119         this_arg_conv.inner = untag_ptr(this_arg);
66120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66122         this_arg_conv.is_owned = false;
66123         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66124         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
66125         uint64_t ret_ref = tag_ptr(ret_copy, true);
66126         return ret_ref;
66127 }
66128
66129 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_issuer"))) TS_Bolt12Invoice_issuer(uint64_t this_arg) {
66130         LDKBolt12Invoice this_arg_conv;
66131         this_arg_conv.inner = untag_ptr(this_arg);
66132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66134         this_arg_conv.is_owned = false;
66135         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
66136         uint64_t ret_ref = 0;
66137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66139         return ret_ref;
66140 }
66141
66142 uint64_tArray  __attribute__((export_name("TS_Bolt12Invoice_message_paths"))) TS_Bolt12Invoice_message_paths(uint64_t this_arg) {
66143         LDKBolt12Invoice this_arg_conv;
66144         this_arg_conv.inner = untag_ptr(this_arg);
66145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66147         this_arg_conv.is_owned = false;
66148         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
66149         uint64_tArray ret_arr = NULL;
66150         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
66151         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
66152         for (size_t n = 0; n < ret_var.datalen; n++) {
66153                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66154                 uint64_t ret_conv_13_ref = 0;
66155                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66156                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66157                 ret_arr_ptr[n] = ret_conv_13_ref;
66158         }
66159         
66160         FREE(ret_var.data);
66161         return ret_arr;
66162 }
66163
66164 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_supported_quantity"))) TS_Bolt12Invoice_supported_quantity(uint64_t this_arg) {
66165         LDKBolt12Invoice this_arg_conv;
66166         this_arg_conv.inner = untag_ptr(this_arg);
66167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66169         this_arg_conv.is_owned = false;
66170         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
66171         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
66172         uint64_t ret_ref = tag_ptr(ret_copy, true);
66173         return ret_ref;
66174 }
66175
66176 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_metadata"))) TS_Bolt12Invoice_payer_metadata(uint64_t this_arg) {
66177         LDKBolt12Invoice this_arg_conv;
66178         this_arg_conv.inner = untag_ptr(this_arg);
66179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66181         this_arg_conv.is_owned = false;
66182         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
66183         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66184         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66185         return ret_arr;
66186 }
66187
66188 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_request_features"))) TS_Bolt12Invoice_invoice_request_features(uint64_t this_arg) {
66189         LDKBolt12Invoice this_arg_conv;
66190         this_arg_conv.inner = untag_ptr(this_arg);
66191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66193         this_arg_conv.is_owned = false;
66194         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
66195         uint64_t ret_ref = 0;
66196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66198         return ret_ref;
66199 }
66200
66201 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_quantity"))) TS_Bolt12Invoice_quantity(uint64_t this_arg) {
66202         LDKBolt12Invoice this_arg_conv;
66203         this_arg_conv.inner = untag_ptr(this_arg);
66204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66206         this_arg_conv.is_owned = false;
66207         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66208         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
66209         uint64_t ret_ref = tag_ptr(ret_copy, true);
66210         return ret_ref;
66211 }
66212
66213 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payer_id"))) TS_Bolt12Invoice_payer_id(uint64_t this_arg) {
66214         LDKBolt12Invoice this_arg_conv;
66215         this_arg_conv.inner = untag_ptr(this_arg);
66216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66218         this_arg_conv.is_owned = false;
66219         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66220         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
66221         return ret_arr;
66222 }
66223
66224 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_payer_note"))) TS_Bolt12Invoice_payer_note(uint64_t this_arg) {
66225         LDKBolt12Invoice this_arg_conv;
66226         this_arg_conv.inner = untag_ptr(this_arg);
66227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66229         this_arg_conv.is_owned = false;
66230         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
66231         uint64_t ret_ref = 0;
66232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66234         return ret_ref;
66235 }
66236
66237 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
66238         LDKBolt12Invoice this_arg_conv;
66239         this_arg_conv.inner = untag_ptr(this_arg);
66240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66242         this_arg_conv.is_owned = false;
66243         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
66244         return ret_conv;
66245 }
66246
66247 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
66248         LDKBolt12Invoice this_arg_conv;
66249         this_arg_conv.inner = untag_ptr(this_arg);
66250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66252         this_arg_conv.is_owned = false;
66253         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
66254         return ret_conv;
66255 }
66256
66257 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
66258         LDKBolt12Invoice this_arg_conv;
66259         this_arg_conv.inner = untag_ptr(this_arg);
66260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66262         this_arg_conv.is_owned = false;
66263         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66264         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
66265         return ret_arr;
66266 }
66267
66268 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
66269         LDKBolt12Invoice this_arg_conv;
66270         this_arg_conv.inner = untag_ptr(this_arg);
66271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66273         this_arg_conv.is_owned = false;
66274         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
66275         return ret_conv;
66276 }
66277
66278 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_invoice_features"))) TS_Bolt12Invoice_invoice_features(uint64_t this_arg) {
66279         LDKBolt12Invoice this_arg_conv;
66280         this_arg_conv.inner = untag_ptr(this_arg);
66281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66283         this_arg_conv.is_owned = false;
66284         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
66285         uint64_t ret_ref = 0;
66286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66288         return ret_ref;
66289 }
66290
66291 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
66292         LDKBolt12Invoice this_arg_conv;
66293         this_arg_conv.inner = untag_ptr(this_arg);
66294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66296         this_arg_conv.is_owned = false;
66297         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66298         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
66299         return ret_arr;
66300 }
66301
66302 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signature"))) TS_Bolt12Invoice_signature(uint64_t this_arg) {
66303         LDKBolt12Invoice this_arg_conv;
66304         this_arg_conv.inner = untag_ptr(this_arg);
66305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66307         this_arg_conv.is_owned = false;
66308         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66309         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
66310         return ret_arr;
66311 }
66312
66313 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
66314         LDKBolt12Invoice this_arg_conv;
66315         this_arg_conv.inner = untag_ptr(this_arg);
66316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66318         this_arg_conv.is_owned = false;
66319         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66320         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
66321         return ret_arr;
66322 }
66323
66324 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
66325         LDKBolt12Invoice this_arg_conv;
66326         this_arg_conv.inner = untag_ptr(this_arg);
66327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66329         this_arg_conv.is_owned = false;
66330         LDKExpandedKey key_conv;
66331         key_conv.inner = untag_ptr(key);
66332         key_conv.is_owned = ptr_is_owned(key);
66333         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66334         key_conv.is_owned = false;
66335         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
66336         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
66337         return tag_ptr(ret_conv, true);
66338 }
66339
66340 int64_t  __attribute__((export_name("TS_Bolt12Invoice_hash"))) TS_Bolt12Invoice_hash(uint64_t o) {
66341         LDKBolt12Invoice o_conv;
66342         o_conv.inner = untag_ptr(o);
66343         o_conv.is_owned = ptr_is_owned(o);
66344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66345         o_conv.is_owned = false;
66346         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
66347         return ret_conv;
66348 }
66349
66350 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_write"))) TS_UnsignedBolt12Invoice_write(uint64_t obj) {
66351         LDKUnsignedBolt12Invoice obj_conv;
66352         obj_conv.inner = untag_ptr(obj);
66353         obj_conv.is_owned = ptr_is_owned(obj);
66354         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66355         obj_conv.is_owned = false;
66356         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
66357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66359         CVec_u8Z_free(ret_var);
66360         return ret_arr;
66361 }
66362
66363 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
66364         LDKBolt12Invoice obj_conv;
66365         obj_conv.inner = untag_ptr(obj);
66366         obj_conv.is_owned = ptr_is_owned(obj);
66367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66368         obj_conv.is_owned = false;
66369         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
66370         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66371         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66372         CVec_u8Z_free(ret_var);
66373         return ret_arr;
66374 }
66375
66376 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
66377         LDKBlindedPayInfo this_obj_conv;
66378         this_obj_conv.inner = untag_ptr(this_obj);
66379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66381         BlindedPayInfo_free(this_obj_conv);
66382 }
66383
66384 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
66385         LDKBlindedPayInfo this_ptr_conv;
66386         this_ptr_conv.inner = untag_ptr(this_ptr);
66387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66389         this_ptr_conv.is_owned = false;
66390         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
66391         return ret_conv;
66392 }
66393
66394 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
66395         LDKBlindedPayInfo this_ptr_conv;
66396         this_ptr_conv.inner = untag_ptr(this_ptr);
66397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66399         this_ptr_conv.is_owned = false;
66400         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
66401 }
66402
66403 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
66404         LDKBlindedPayInfo this_ptr_conv;
66405         this_ptr_conv.inner = untag_ptr(this_ptr);
66406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66408         this_ptr_conv.is_owned = false;
66409         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
66410         return ret_conv;
66411 }
66412
66413 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
66414         LDKBlindedPayInfo this_ptr_conv;
66415         this_ptr_conv.inner = untag_ptr(this_ptr);
66416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66418         this_ptr_conv.is_owned = false;
66419         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
66420 }
66421
66422 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
66423         LDKBlindedPayInfo this_ptr_conv;
66424         this_ptr_conv.inner = untag_ptr(this_ptr);
66425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66427         this_ptr_conv.is_owned = false;
66428         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
66429         return ret_conv;
66430 }
66431
66432 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
66433         LDKBlindedPayInfo this_ptr_conv;
66434         this_ptr_conv.inner = untag_ptr(this_ptr);
66435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66437         this_ptr_conv.is_owned = false;
66438         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
66439 }
66440
66441 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
66442         LDKBlindedPayInfo this_ptr_conv;
66443         this_ptr_conv.inner = untag_ptr(this_ptr);
66444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66446         this_ptr_conv.is_owned = false;
66447         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
66448         return ret_conv;
66449 }
66450
66451 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
66452         LDKBlindedPayInfo this_ptr_conv;
66453         this_ptr_conv.inner = untag_ptr(this_ptr);
66454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66456         this_ptr_conv.is_owned = false;
66457         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
66458 }
66459
66460 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
66461         LDKBlindedPayInfo this_ptr_conv;
66462         this_ptr_conv.inner = untag_ptr(this_ptr);
66463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66465         this_ptr_conv.is_owned = false;
66466         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
66467         return ret_conv;
66468 }
66469
66470 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
66471         LDKBlindedPayInfo this_ptr_conv;
66472         this_ptr_conv.inner = untag_ptr(this_ptr);
66473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66475         this_ptr_conv.is_owned = false;
66476         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
66477 }
66478
66479 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
66480         LDKBlindedPayInfo this_ptr_conv;
66481         this_ptr_conv.inner = untag_ptr(this_ptr);
66482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66484         this_ptr_conv.is_owned = false;
66485         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
66486         uint64_t ret_ref = 0;
66487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66489         return ret_ref;
66490 }
66491
66492 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
66493         LDKBlindedPayInfo this_ptr_conv;
66494         this_ptr_conv.inner = untag_ptr(this_ptr);
66495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66497         this_ptr_conv.is_owned = false;
66498         LDKBlindedHopFeatures val_conv;
66499         val_conv.inner = untag_ptr(val);
66500         val_conv.is_owned = ptr_is_owned(val);
66501         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66502         val_conv = BlindedHopFeatures_clone(&val_conv);
66503         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
66504 }
66505
66506 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) {
66507         LDKBlindedHopFeatures features_arg_conv;
66508         features_arg_conv.inner = untag_ptr(features_arg);
66509         features_arg_conv.is_owned = ptr_is_owned(features_arg);
66510         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
66511         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
66512         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);
66513         uint64_t ret_ref = 0;
66514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66516         return ret_ref;
66517 }
66518
66519 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
66520         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
66521         uint64_t ret_ref = 0;
66522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66524         return ret_ref;
66525 }
66526 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
66527         LDKBlindedPayInfo arg_conv;
66528         arg_conv.inner = untag_ptr(arg);
66529         arg_conv.is_owned = ptr_is_owned(arg);
66530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66531         arg_conv.is_owned = false;
66532         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
66533         return ret_conv;
66534 }
66535
66536 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
66537         LDKBlindedPayInfo orig_conv;
66538         orig_conv.inner = untag_ptr(orig);
66539         orig_conv.is_owned = ptr_is_owned(orig);
66540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66541         orig_conv.is_owned = false;
66542         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
66543         uint64_t ret_ref = 0;
66544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66546         return ret_ref;
66547 }
66548
66549 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
66550         LDKBlindedPayInfo o_conv;
66551         o_conv.inner = untag_ptr(o);
66552         o_conv.is_owned = ptr_is_owned(o);
66553         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66554         o_conv.is_owned = false;
66555         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
66556         return ret_conv;
66557 }
66558
66559 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
66560         LDKBlindedPayInfo a_conv;
66561         a_conv.inner = untag_ptr(a);
66562         a_conv.is_owned = ptr_is_owned(a);
66563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66564         a_conv.is_owned = false;
66565         LDKBlindedPayInfo b_conv;
66566         b_conv.inner = untag_ptr(b);
66567         b_conv.is_owned = ptr_is_owned(b);
66568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66569         b_conv.is_owned = false;
66570         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
66571         return ret_conv;
66572 }
66573
66574 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
66575         LDKBlindedPayInfo obj_conv;
66576         obj_conv.inner = untag_ptr(obj);
66577         obj_conv.is_owned = ptr_is_owned(obj);
66578         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66579         obj_conv.is_owned = false;
66580         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
66581         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66582         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66583         CVec_u8Z_free(ret_var);
66584         return ret_arr;
66585 }
66586
66587 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
66588         LDKu8slice ser_ref;
66589         ser_ref.datalen = ser->arr_len;
66590         ser_ref.data = ser->elems;
66591         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
66592         *ret_conv = BlindedPayInfo_read(ser_ref);
66593         FREE(ser);
66594         return tag_ptr(ret_conv, true);
66595 }
66596
66597 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
66598         LDKInvoiceError this_obj_conv;
66599         this_obj_conv.inner = untag_ptr(this_obj);
66600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66602         InvoiceError_free(this_obj_conv);
66603 }
66604
66605 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
66606         LDKInvoiceError this_ptr_conv;
66607         this_ptr_conv.inner = untag_ptr(this_ptr);
66608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66610         this_ptr_conv.is_owned = false;
66611         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
66612         uint64_t ret_ref = 0;
66613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66615         return ret_ref;
66616 }
66617
66618 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
66619         LDKInvoiceError this_ptr_conv;
66620         this_ptr_conv.inner = untag_ptr(this_ptr);
66621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66623         this_ptr_conv.is_owned = false;
66624         LDKErroneousField val_conv;
66625         val_conv.inner = untag_ptr(val);
66626         val_conv.is_owned = ptr_is_owned(val);
66627         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66628         val_conv = ErroneousField_clone(&val_conv);
66629         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
66630 }
66631
66632 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
66633         LDKInvoiceError this_ptr_conv;
66634         this_ptr_conv.inner = untag_ptr(this_ptr);
66635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66637         this_ptr_conv.is_owned = false;
66638         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
66639         uint64_t ret_ref = 0;
66640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66642         return ret_ref;
66643 }
66644
66645 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
66646         LDKInvoiceError this_ptr_conv;
66647         this_ptr_conv.inner = untag_ptr(this_ptr);
66648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66650         this_ptr_conv.is_owned = false;
66651         LDKUntrustedString val_conv;
66652         val_conv.inner = untag_ptr(val);
66653         val_conv.is_owned = ptr_is_owned(val);
66654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66655         val_conv = UntrustedString_clone(&val_conv);
66656         InvoiceError_set_message(&this_ptr_conv, val_conv);
66657 }
66658
66659 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
66660         LDKErroneousField erroneous_field_arg_conv;
66661         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
66662         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
66663         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
66664         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
66665         LDKUntrustedString message_arg_conv;
66666         message_arg_conv.inner = untag_ptr(message_arg);
66667         message_arg_conv.is_owned = ptr_is_owned(message_arg);
66668         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
66669         message_arg_conv = UntrustedString_clone(&message_arg_conv);
66670         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
66671         uint64_t ret_ref = 0;
66672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66674         return ret_ref;
66675 }
66676
66677 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
66678         LDKInvoiceError ret_var = InvoiceError_clone(arg);
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 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
66685         LDKInvoiceError arg_conv;
66686         arg_conv.inner = untag_ptr(arg);
66687         arg_conv.is_owned = ptr_is_owned(arg);
66688         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66689         arg_conv.is_owned = false;
66690         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
66691         return ret_conv;
66692 }
66693
66694 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
66695         LDKInvoiceError orig_conv;
66696         orig_conv.inner = untag_ptr(orig);
66697         orig_conv.is_owned = ptr_is_owned(orig);
66698         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66699         orig_conv.is_owned = false;
66700         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
66701         uint64_t ret_ref = 0;
66702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66704         return ret_ref;
66705 }
66706
66707 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
66708         LDKErroneousField this_obj_conv;
66709         this_obj_conv.inner = untag_ptr(this_obj);
66710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66712         ErroneousField_free(this_obj_conv);
66713 }
66714
66715 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
66716         LDKErroneousField this_ptr_conv;
66717         this_ptr_conv.inner = untag_ptr(this_ptr);
66718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66720         this_ptr_conv.is_owned = false;
66721         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
66722         return ret_conv;
66723 }
66724
66725 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
66726         LDKErroneousField this_ptr_conv;
66727         this_ptr_conv.inner = untag_ptr(this_ptr);
66728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66730         this_ptr_conv.is_owned = false;
66731         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
66732 }
66733
66734 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
66735         LDKErroneousField this_ptr_conv;
66736         this_ptr_conv.inner = untag_ptr(this_ptr);
66737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66739         this_ptr_conv.is_owned = false;
66740         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66741         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
66742         uint64_t ret_ref = tag_ptr(ret_copy, true);
66743         return ret_ref;
66744 }
66745
66746 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
66747         LDKErroneousField this_ptr_conv;
66748         this_ptr_conv.inner = untag_ptr(this_ptr);
66749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66751         this_ptr_conv.is_owned = false;
66752         void* val_ptr = untag_ptr(val);
66753         CHECK_ACCESS(val_ptr);
66754         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
66755         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
66756         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
66757 }
66758
66759 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
66760         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
66761         CHECK_ACCESS(suggested_value_arg_ptr);
66762         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
66763         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
66764         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
66765         uint64_t ret_ref = 0;
66766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66768         return ret_ref;
66769 }
66770
66771 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
66772         LDKErroneousField ret_var = ErroneousField_clone(arg);
66773         uint64_t ret_ref = 0;
66774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66776         return ret_ref;
66777 }
66778 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
66779         LDKErroneousField arg_conv;
66780         arg_conv.inner = untag_ptr(arg);
66781         arg_conv.is_owned = ptr_is_owned(arg);
66782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66783         arg_conv.is_owned = false;
66784         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
66785         return ret_conv;
66786 }
66787
66788 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
66789         LDKErroneousField orig_conv;
66790         orig_conv.inner = untag_ptr(orig);
66791         orig_conv.is_owned = ptr_is_owned(orig);
66792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66793         orig_conv.is_owned = false;
66794         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
66795         uint64_t ret_ref = 0;
66796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66798         return ret_ref;
66799 }
66800
66801 uint64_t  __attribute__((export_name("TS_InvoiceError_from_string"))) TS_InvoiceError_from_string(jstring s) {
66802         LDKStr s_conv = str_ref_to_owned_c(s);
66803         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
66804         uint64_t ret_ref = 0;
66805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66807         return ret_ref;
66808 }
66809
66810 jstring  __attribute__((export_name("TS_InvoiceError_to_str"))) TS_InvoiceError_to_str(uint64_t o) {
66811         LDKInvoiceError o_conv;
66812         o_conv.inner = untag_ptr(o);
66813         o_conv.is_owned = ptr_is_owned(o);
66814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66815         o_conv.is_owned = false;
66816         LDKStr ret_str = InvoiceError_to_str(&o_conv);
66817         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
66818         Str_free(ret_str);
66819         return ret_conv;
66820 }
66821
66822 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
66823         LDKInvoiceError obj_conv;
66824         obj_conv.inner = untag_ptr(obj);
66825         obj_conv.is_owned = ptr_is_owned(obj);
66826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66827         obj_conv.is_owned = false;
66828         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
66829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66831         CVec_u8Z_free(ret_var);
66832         return ret_arr;
66833 }
66834
66835 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
66836         LDKu8slice ser_ref;
66837         ser_ref.datalen = ser->arr_len;
66838         ser_ref.data = ser->elems;
66839         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
66840         *ret_conv = InvoiceError_read(ser_ref);
66841         FREE(ser);
66842         return tag_ptr(ret_conv, true);
66843 }
66844
66845 void  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_free"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_free(uint64_t this_obj) {
66846         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
66847         this_obj_conv.inner = untag_ptr(this_obj);
66848         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66850         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
66851 }
66852
66853 void  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_free"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_free(uint64_t this_obj) {
66854         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
66855         this_obj_conv.inner = untag_ptr(this_obj);
66856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66858         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
66859 }
66860
66861 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_build"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_build(uint64_t this_arg) {
66862         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
66863         this_arg_conv.inner = untag_ptr(this_arg);
66864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66866         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
66867         
66868         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
66869         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
66870         return tag_ptr(ret_conv, true);
66871 }
66872
66873 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_chain"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_chain(uint64_t this_arg, uint32_t network) {
66874         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
66875         this_arg_conv.inner = untag_ptr(this_arg);
66876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66878         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
66879         
66880         LDKNetwork network_conv = LDKNetwork_from_js(network);
66881         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66882         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
66883         return tag_ptr(ret_conv, true);
66884 }
66885
66886 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
66887         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
66888         this_arg_conv.inner = untag_ptr(this_arg);
66889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66891         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
66892         
66893         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66894         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
66895         return tag_ptr(ret_conv, true);
66896 }
66897
66898 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_quantity"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_quantity(uint64_t this_arg, int64_t quantity) {
66899         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
66900         this_arg_conv.inner = untag_ptr(this_arg);
66901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66903         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
66904         
66905         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66906         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
66907         return tag_ptr(ret_conv, true);
66908 }
66909
66910 void  __attribute__((export_name("TS_InvoiceRequestWithExplicitPayerIdBuilder_payer_note"))) TS_InvoiceRequestWithExplicitPayerIdBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
66911         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
66912         this_arg_conv.inner = untag_ptr(this_arg);
66913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66915         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
66916         
66917         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
66918         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
66919 }
66920
66921 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(uint64_t this_arg) {
66922         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66923         this_arg_conv.inner = untag_ptr(this_arg);
66924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66926         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66927         
66928         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
66929         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
66930         return tag_ptr(ret_conv, true);
66931 }
66932
66933 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_chain"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_chain(uint64_t this_arg, uint32_t network) {
66934         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66935         this_arg_conv.inner = untag_ptr(this_arg);
66936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66938         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66939         
66940         LDKNetwork network_conv = LDKNetwork_from_js(network);
66941         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66942         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
66943         return tag_ptr(ret_conv, true);
66944 }
66945
66946 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(uint64_t this_arg, int64_t amount_msats) {
66947         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66948         this_arg_conv.inner = untag_ptr(this_arg);
66949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66951         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66952         
66953         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66954         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
66955         return tag_ptr(ret_conv, true);
66956 }
66957
66958 uint64_t  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_quantity"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_quantity(uint64_t this_arg, int64_t quantity) {
66959         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66960         this_arg_conv.inner = untag_ptr(this_arg);
66961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66963         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66964         
66965         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66966         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
66967         return tag_ptr(ret_conv, true);
66968 }
66969
66970 void  __attribute__((export_name("TS_InvoiceRequestWithDerivedPayerIdBuilder_payer_note"))) TS_InvoiceRequestWithDerivedPayerIdBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
66971         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66972         this_arg_conv.inner = untag_ptr(this_arg);
66973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66975         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66976         
66977         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
66978         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
66979 }
66980
66981 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
66982         LDKUnsignedInvoiceRequest this_obj_conv;
66983         this_obj_conv.inner = untag_ptr(this_obj);
66984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66986         UnsignedInvoiceRequest_free(this_obj_conv);
66987 }
66988
66989 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
66990         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
66991         uint64_t ret_ref = 0;
66992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66994         return ret_ref;
66995 }
66996 int64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_clone_ptr"))) TS_UnsignedInvoiceRequest_clone_ptr(uint64_t arg) {
66997         LDKUnsignedInvoiceRequest arg_conv;
66998         arg_conv.inner = untag_ptr(arg);
66999         arg_conv.is_owned = ptr_is_owned(arg);
67000         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67001         arg_conv.is_owned = false;
67002         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
67003         return ret_conv;
67004 }
67005
67006 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_clone"))) TS_UnsignedInvoiceRequest_clone(uint64_t orig) {
67007         LDKUnsignedInvoiceRequest orig_conv;
67008         orig_conv.inner = untag_ptr(orig);
67009         orig_conv.is_owned = ptr_is_owned(orig);
67010         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67011         orig_conv.is_owned = false;
67012         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
67013         uint64_t ret_ref = 0;
67014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67016         return ret_ref;
67017 }
67018
67019 void  __attribute__((export_name("TS_SignInvoiceRequestFn_free"))) TS_SignInvoiceRequestFn_free(uint64_t this_ptr) {
67020         if (!ptr_is_owned(this_ptr)) return;
67021         void* this_ptr_ptr = untag_ptr(this_ptr);
67022         CHECK_ACCESS(this_ptr_ptr);
67023         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
67024         FREE(untag_ptr(this_ptr));
67025         SignInvoiceRequestFn_free(this_ptr_conv);
67026 }
67027
67028 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_tagged_hash"))) TS_UnsignedInvoiceRequest_tagged_hash(uint64_t this_arg) {
67029         LDKUnsignedInvoiceRequest this_arg_conv;
67030         this_arg_conv.inner = untag_ptr(this_arg);
67031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67033         this_arg_conv.is_owned = false;
67034         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
67035         uint64_t ret_ref = 0;
67036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67038         return ret_ref;
67039 }
67040
67041 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
67042         LDKInvoiceRequest this_obj_conv;
67043         this_obj_conv.inner = untag_ptr(this_obj);
67044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67046         InvoiceRequest_free(this_obj_conv);
67047 }
67048
67049 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
67050         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
67051         uint64_t ret_ref = 0;
67052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67054         return ret_ref;
67055 }
67056 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
67057         LDKInvoiceRequest arg_conv;
67058         arg_conv.inner = untag_ptr(arg);
67059         arg_conv.is_owned = ptr_is_owned(arg);
67060         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67061         arg_conv.is_owned = false;
67062         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
67063         return ret_conv;
67064 }
67065
67066 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
67067         LDKInvoiceRequest orig_conv;
67068         orig_conv.inner = untag_ptr(orig);
67069         orig_conv.is_owned = ptr_is_owned(orig);
67070         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67071         orig_conv.is_owned = false;
67072         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
67073         uint64_t ret_ref = 0;
67074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67076         return ret_ref;
67077 }
67078
67079 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_free"))) TS_VerifiedInvoiceRequest_free(uint64_t this_obj) {
67080         LDKVerifiedInvoiceRequest this_obj_conv;
67081         this_obj_conv.inner = untag_ptr(this_obj);
67082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67084         VerifiedInvoiceRequest_free(this_obj_conv);
67085 }
67086
67087 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_offer_id"))) TS_VerifiedInvoiceRequest_get_offer_id(uint64_t this_ptr) {
67088         LDKVerifiedInvoiceRequest this_ptr_conv;
67089         this_ptr_conv.inner = untag_ptr(this_ptr);
67090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67092         this_ptr_conv.is_owned = false;
67093         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
67094         uint64_t ret_ref = 0;
67095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67097         return ret_ref;
67098 }
67099
67100 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_offer_id"))) TS_VerifiedInvoiceRequest_set_offer_id(uint64_t this_ptr, uint64_t val) {
67101         LDKVerifiedInvoiceRequest this_ptr_conv;
67102         this_ptr_conv.inner = untag_ptr(this_ptr);
67103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67105         this_ptr_conv.is_owned = false;
67106         LDKOfferId val_conv;
67107         val_conv.inner = untag_ptr(val);
67108         val_conv.is_owned = ptr_is_owned(val);
67109         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67110         val_conv = OfferId_clone(&val_conv);
67111         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
67112 }
67113
67114 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_get_keys"))) TS_VerifiedInvoiceRequest_get_keys(uint64_t this_ptr) {
67115         LDKVerifiedInvoiceRequest this_ptr_conv;
67116         this_ptr_conv.inner = untag_ptr(this_ptr);
67117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67119         this_ptr_conv.is_owned = false;
67120         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
67121         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
67122         uint64_t ret_ref = tag_ptr(ret_copy, true);
67123         return ret_ref;
67124 }
67125
67126 void  __attribute__((export_name("TS_VerifiedInvoiceRequest_set_keys"))) TS_VerifiedInvoiceRequest_set_keys(uint64_t this_ptr, uint64_t val) {
67127         LDKVerifiedInvoiceRequest this_ptr_conv;
67128         this_ptr_conv.inner = untag_ptr(this_ptr);
67129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67131         this_ptr_conv.is_owned = false;
67132         void* val_ptr = untag_ptr(val);
67133         CHECK_ACCESS(val_ptr);
67134         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
67135         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
67136         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
67137 }
67138
67139 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
67140         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
67141         uint64_t ret_ref = 0;
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67144         return ret_ref;
67145 }
67146 int64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone_ptr"))) TS_VerifiedInvoiceRequest_clone_ptr(uint64_t arg) {
67147         LDKVerifiedInvoiceRequest arg_conv;
67148         arg_conv.inner = untag_ptr(arg);
67149         arg_conv.is_owned = ptr_is_owned(arg);
67150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67151         arg_conv.is_owned = false;
67152         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
67153         return ret_conv;
67154 }
67155
67156 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_clone"))) TS_VerifiedInvoiceRequest_clone(uint64_t orig) {
67157         LDKVerifiedInvoiceRequest orig_conv;
67158         orig_conv.inner = untag_ptr(orig);
67159         orig_conv.is_owned = ptr_is_owned(orig);
67160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67161         orig_conv.is_owned = false;
67162         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
67163         uint64_t ret_ref = 0;
67164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67166         return ret_ref;
67167 }
67168
67169 ptrArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chains"))) TS_UnsignedInvoiceRequest_chains(uint64_t this_arg) {
67170         LDKUnsignedInvoiceRequest this_arg_conv;
67171         this_arg_conv.inner = untag_ptr(this_arg);
67172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67174         this_arg_conv.is_owned = false;
67175         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
67176         ptrArray ret_arr = NULL;
67177         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
67178         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
67179         for (size_t m = 0; m < ret_var.datalen; m++) {
67180                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
67181                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
67182                 ret_arr_ptr[m] = ret_conv_12_arr;
67183         }
67184         
67185         FREE(ret_var.data);
67186         return ret_arr;
67187 }
67188
67189 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_metadata"))) TS_UnsignedInvoiceRequest_metadata(uint64_t this_arg) {
67190         LDKUnsignedInvoiceRequest this_arg_conv;
67191         this_arg_conv.inner = untag_ptr(this_arg);
67192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67194         this_arg_conv.is_owned = false;
67195         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67196         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
67197         uint64_t ret_ref = tag_ptr(ret_copy, true);
67198         return ret_ref;
67199 }
67200
67201 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount"))) TS_UnsignedInvoiceRequest_amount(uint64_t this_arg) {
67202         LDKUnsignedInvoiceRequest this_arg_conv;
67203         this_arg_conv.inner = untag_ptr(this_arg);
67204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67206         this_arg_conv.is_owned = false;
67207         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
67208         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
67209         uint64_t ret_ref = tag_ptr(ret_copy, true);
67210         return ret_ref;
67211 }
67212
67213 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_description"))) TS_UnsignedInvoiceRequest_description(uint64_t this_arg) {
67214         LDKUnsignedInvoiceRequest this_arg_conv;
67215         this_arg_conv.inner = untag_ptr(this_arg);
67216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67218         this_arg_conv.is_owned = false;
67219         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
67220         uint64_t ret_ref = 0;
67221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67223         return ret_ref;
67224 }
67225
67226 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_offer_features"))) TS_UnsignedInvoiceRequest_offer_features(uint64_t this_arg) {
67227         LDKUnsignedInvoiceRequest this_arg_conv;
67228         this_arg_conv.inner = untag_ptr(this_arg);
67229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67231         this_arg_conv.is_owned = false;
67232         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_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 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_absolute_expiry"))) TS_UnsignedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
67240         LDKUnsignedInvoiceRequest 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67246         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
67247         uint64_t ret_ref = tag_ptr(ret_copy, true);
67248         return ret_ref;
67249 }
67250
67251 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_issuer"))) TS_UnsignedInvoiceRequest_issuer(uint64_t this_arg) {
67252         LDKUnsignedInvoiceRequest this_arg_conv;
67253         this_arg_conv.inner = untag_ptr(this_arg);
67254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67256         this_arg_conv.is_owned = false;
67257         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
67258         uint64_t ret_ref = 0;
67259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67261         return ret_ref;
67262 }
67263
67264 uint64_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_paths"))) TS_UnsignedInvoiceRequest_paths(uint64_t this_arg) {
67265         LDKUnsignedInvoiceRequest this_arg_conv;
67266         this_arg_conv.inner = untag_ptr(this_arg);
67267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67269         this_arg_conv.is_owned = false;
67270         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
67271         uint64_tArray ret_arr = NULL;
67272         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67273         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67274         for (size_t n = 0; n < ret_var.datalen; n++) {
67275                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67276                 uint64_t ret_conv_13_ref = 0;
67277                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67278                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67279                 ret_arr_ptr[n] = ret_conv_13_ref;
67280         }
67281         
67282         FREE(ret_var.data);
67283         return ret_arr;
67284 }
67285
67286 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_supported_quantity"))) TS_UnsignedInvoiceRequest_supported_quantity(uint64_t this_arg) {
67287         LDKUnsignedInvoiceRequest this_arg_conv;
67288         this_arg_conv.inner = untag_ptr(this_arg);
67289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67291         this_arg_conv.is_owned = false;
67292         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
67293         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
67294         uint64_t ret_ref = tag_ptr(ret_copy, true);
67295         return ret_ref;
67296 }
67297
67298 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_signing_pubkey"))) TS_UnsignedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
67299         LDKUnsignedInvoiceRequest this_arg_conv;
67300         this_arg_conv.inner = untag_ptr(this_arg);
67301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67303         this_arg_conv.is_owned = false;
67304         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67305         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
67306         return ret_arr;
67307 }
67308
67309 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_metadata"))) TS_UnsignedInvoiceRequest_payer_metadata(uint64_t this_arg) {
67310         LDKUnsignedInvoiceRequest this_arg_conv;
67311         this_arg_conv.inner = untag_ptr(this_arg);
67312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67314         this_arg_conv.is_owned = false;
67315         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
67316         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67317         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67318         return ret_arr;
67319 }
67320
67321 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_chain"))) TS_UnsignedInvoiceRequest_chain(uint64_t this_arg) {
67322         LDKUnsignedInvoiceRequest this_arg_conv;
67323         this_arg_conv.inner = untag_ptr(this_arg);
67324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67326         this_arg_conv.is_owned = false;
67327         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67328         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
67329         return ret_arr;
67330 }
67331
67332 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_amount_msats"))) TS_UnsignedInvoiceRequest_amount_msats(uint64_t this_arg) {
67333         LDKUnsignedInvoiceRequest this_arg_conv;
67334         this_arg_conv.inner = untag_ptr(this_arg);
67335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67337         this_arg_conv.is_owned = false;
67338         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67339         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
67340         uint64_t ret_ref = tag_ptr(ret_copy, true);
67341         return ret_ref;
67342 }
67343
67344 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_invoice_request_features"))) TS_UnsignedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
67345         LDKUnsignedInvoiceRequest this_arg_conv;
67346         this_arg_conv.inner = untag_ptr(this_arg);
67347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67349         this_arg_conv.is_owned = false;
67350         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
67351         uint64_t ret_ref = 0;
67352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67354         return ret_ref;
67355 }
67356
67357 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_quantity"))) TS_UnsignedInvoiceRequest_quantity(uint64_t this_arg) {
67358         LDKUnsignedInvoiceRequest this_arg_conv;
67359         this_arg_conv.inner = untag_ptr(this_arg);
67360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67362         this_arg_conv.is_owned = false;
67363         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67364         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
67365         uint64_t ret_ref = tag_ptr(ret_copy, true);
67366         return ret_ref;
67367 }
67368
67369 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_id"))) TS_UnsignedInvoiceRequest_payer_id(uint64_t this_arg) {
67370         LDKUnsignedInvoiceRequest this_arg_conv;
67371         this_arg_conv.inner = untag_ptr(this_arg);
67372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67374         this_arg_conv.is_owned = false;
67375         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67376         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
67377         return ret_arr;
67378 }
67379
67380 uint64_t  __attribute__((export_name("TS_UnsignedInvoiceRequest_payer_note"))) TS_UnsignedInvoiceRequest_payer_note(uint64_t this_arg) {
67381         LDKUnsignedInvoiceRequest this_arg_conv;
67382         this_arg_conv.inner = untag_ptr(this_arg);
67383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67385         this_arg_conv.is_owned = false;
67386         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
67387         uint64_t ret_ref = 0;
67388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67390         return ret_ref;
67391 }
67392
67393 ptrArray  __attribute__((export_name("TS_InvoiceRequest_chains"))) TS_InvoiceRequest_chains(uint64_t this_arg) {
67394         LDKInvoiceRequest this_arg_conv;
67395         this_arg_conv.inner = untag_ptr(this_arg);
67396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67398         this_arg_conv.is_owned = false;
67399         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
67400         ptrArray ret_arr = NULL;
67401         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
67402         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
67403         for (size_t m = 0; m < ret_var.datalen; m++) {
67404                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
67405                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
67406                 ret_arr_ptr[m] = ret_conv_12_arr;
67407         }
67408         
67409         FREE(ret_var.data);
67410         return ret_arr;
67411 }
67412
67413 uint64_t  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
67414         LDKInvoiceRequest this_arg_conv;
67415         this_arg_conv.inner = untag_ptr(this_arg);
67416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67418         this_arg_conv.is_owned = false;
67419         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67420         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
67421         uint64_t ret_ref = tag_ptr(ret_copy, true);
67422         return ret_ref;
67423 }
67424
67425 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount"))) TS_InvoiceRequest_amount(uint64_t this_arg) {
67426         LDKInvoiceRequest this_arg_conv;
67427         this_arg_conv.inner = untag_ptr(this_arg);
67428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67430         this_arg_conv.is_owned = false;
67431         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
67432         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
67433         uint64_t ret_ref = tag_ptr(ret_copy, true);
67434         return ret_ref;
67435 }
67436
67437 uint64_t  __attribute__((export_name("TS_InvoiceRequest_description"))) TS_InvoiceRequest_description(uint64_t this_arg) {
67438         LDKInvoiceRequest this_arg_conv;
67439         this_arg_conv.inner = untag_ptr(this_arg);
67440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67442         this_arg_conv.is_owned = false;
67443         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
67444         uint64_t ret_ref = 0;
67445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67447         return ret_ref;
67448 }
67449
67450 uint64_t  __attribute__((export_name("TS_InvoiceRequest_offer_features"))) TS_InvoiceRequest_offer_features(uint64_t this_arg) {
67451         LDKInvoiceRequest this_arg_conv;
67452         this_arg_conv.inner = untag_ptr(this_arg);
67453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67455         this_arg_conv.is_owned = false;
67456         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
67457         uint64_t ret_ref = 0;
67458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67460         return ret_ref;
67461 }
67462
67463 uint64_t  __attribute__((export_name("TS_InvoiceRequest_absolute_expiry"))) TS_InvoiceRequest_absolute_expiry(uint64_t this_arg) {
67464         LDKInvoiceRequest this_arg_conv;
67465         this_arg_conv.inner = untag_ptr(this_arg);
67466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67468         this_arg_conv.is_owned = false;
67469         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67470         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
67471         uint64_t ret_ref = tag_ptr(ret_copy, true);
67472         return ret_ref;
67473 }
67474
67475 uint64_t  __attribute__((export_name("TS_InvoiceRequest_issuer"))) TS_InvoiceRequest_issuer(uint64_t this_arg) {
67476         LDKInvoiceRequest this_arg_conv;
67477         this_arg_conv.inner = untag_ptr(this_arg);
67478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67480         this_arg_conv.is_owned = false;
67481         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
67482         uint64_t ret_ref = 0;
67483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67485         return ret_ref;
67486 }
67487
67488 uint64_tArray  __attribute__((export_name("TS_InvoiceRequest_paths"))) TS_InvoiceRequest_paths(uint64_t this_arg) {
67489         LDKInvoiceRequest this_arg_conv;
67490         this_arg_conv.inner = untag_ptr(this_arg);
67491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67493         this_arg_conv.is_owned = false;
67494         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
67495         uint64_tArray ret_arr = NULL;
67496         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67497         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67498         for (size_t n = 0; n < ret_var.datalen; n++) {
67499                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67500                 uint64_t ret_conv_13_ref = 0;
67501                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67502                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67503                 ret_arr_ptr[n] = ret_conv_13_ref;
67504         }
67505         
67506         FREE(ret_var.data);
67507         return ret_arr;
67508 }
67509
67510 uint64_t  __attribute__((export_name("TS_InvoiceRequest_supported_quantity"))) TS_InvoiceRequest_supported_quantity(uint64_t this_arg) {
67511         LDKInvoiceRequest this_arg_conv;
67512         this_arg_conv.inner = untag_ptr(this_arg);
67513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67515         this_arg_conv.is_owned = false;
67516         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
67517         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
67518         uint64_t ret_ref = tag_ptr(ret_copy, true);
67519         return ret_ref;
67520 }
67521
67522 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signing_pubkey"))) TS_InvoiceRequest_signing_pubkey(uint64_t this_arg) {
67523         LDKInvoiceRequest this_arg_conv;
67524         this_arg_conv.inner = untag_ptr(this_arg);
67525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67527         this_arg_conv.is_owned = false;
67528         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67529         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
67530         return ret_arr;
67531 }
67532
67533 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_metadata"))) TS_InvoiceRequest_payer_metadata(uint64_t this_arg) {
67534         LDKInvoiceRequest this_arg_conv;
67535         this_arg_conv.inner = untag_ptr(this_arg);
67536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67538         this_arg_conv.is_owned = false;
67539         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
67540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67542         return ret_arr;
67543 }
67544
67545 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
67546         LDKInvoiceRequest this_arg_conv;
67547         this_arg_conv.inner = untag_ptr(this_arg);
67548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67550         this_arg_conv.is_owned = false;
67551         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67552         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
67553         return ret_arr;
67554 }
67555
67556 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
67557         LDKInvoiceRequest this_arg_conv;
67558         this_arg_conv.inner = untag_ptr(this_arg);
67559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67561         this_arg_conv.is_owned = false;
67562         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67563         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
67564         uint64_t ret_ref = tag_ptr(ret_copy, true);
67565         return ret_ref;
67566 }
67567
67568 uint64_t  __attribute__((export_name("TS_InvoiceRequest_invoice_request_features"))) TS_InvoiceRequest_invoice_request_features(uint64_t this_arg) {
67569         LDKInvoiceRequest this_arg_conv;
67570         this_arg_conv.inner = untag_ptr(this_arg);
67571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67573         this_arg_conv.is_owned = false;
67574         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
67575         uint64_t ret_ref = 0;
67576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67578         return ret_ref;
67579 }
67580
67581 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
67582         LDKInvoiceRequest this_arg_conv;
67583         this_arg_conv.inner = untag_ptr(this_arg);
67584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67586         this_arg_conv.is_owned = false;
67587         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67588         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
67589         uint64_t ret_ref = tag_ptr(ret_copy, true);
67590         return ret_ref;
67591 }
67592
67593 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
67594         LDKInvoiceRequest this_arg_conv;
67595         this_arg_conv.inner = untag_ptr(this_arg);
67596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67598         this_arg_conv.is_owned = false;
67599         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67600         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
67601         return ret_arr;
67602 }
67603
67604 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
67605         LDKInvoiceRequest this_arg_conv;
67606         this_arg_conv.inner = untag_ptr(this_arg);
67607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67609         this_arg_conv.is_owned = false;
67610         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
67611         uint64_t ret_ref = 0;
67612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67614         return ret_ref;
67615 }
67616
67617 uint64_t  __attribute__((export_name("TS_InvoiceRequest_respond_with_no_std"))) TS_InvoiceRequest_respond_with_no_std(uint64_t this_arg, uint64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
67618         LDKInvoiceRequest this_arg_conv;
67619         this_arg_conv.inner = untag_ptr(this_arg);
67620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67622         this_arg_conv.is_owned = false;
67623         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
67624         payment_paths_constr.datalen = payment_paths->arr_len;
67625         if (payment_paths_constr.datalen > 0)
67626                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
67627         else
67628                 payment_paths_constr.data = NULL;
67629         uint64_t* payment_paths_vals = payment_paths->elems;
67630         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
67631                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
67632                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
67633                 CHECK_ACCESS(payment_paths_conv_37_ptr);
67634                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
67635                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
67636                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
67637         }
67638         FREE(payment_paths);
67639         LDKThirtyTwoBytes payment_hash_ref;
67640         CHECK(payment_hash->arr_len == 32);
67641         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67642         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
67643         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
67644         return tag_ptr(ret_conv, true);
67645 }
67646
67647 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
67648         LDKInvoiceRequest this_arg_conv;
67649         this_arg_conv.inner = untag_ptr(this_arg);
67650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67652         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
67653         LDKExpandedKey key_conv;
67654         key_conv.inner = untag_ptr(key);
67655         key_conv.is_owned = ptr_is_owned(key);
67656         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
67657         key_conv.is_owned = false;
67658         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
67659         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
67660         return tag_ptr(ret_conv, true);
67661 }
67662
67663 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_signature"))) TS_InvoiceRequest_signature(uint64_t this_arg) {
67664         LDKInvoiceRequest this_arg_conv;
67665         this_arg_conv.inner = untag_ptr(this_arg);
67666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67668         this_arg_conv.is_owned = false;
67669         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
67670         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
67671         return ret_arr;
67672 }
67673
67674 ptrArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chains"))) TS_VerifiedInvoiceRequest_chains(uint64_t this_arg) {
67675         LDKVerifiedInvoiceRequest this_arg_conv;
67676         this_arg_conv.inner = untag_ptr(this_arg);
67677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67679         this_arg_conv.is_owned = false;
67680         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
67681         ptrArray ret_arr = NULL;
67682         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
67683         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
67684         for (size_t m = 0; m < ret_var.datalen; m++) {
67685                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
67686                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
67687                 ret_arr_ptr[m] = ret_conv_12_arr;
67688         }
67689         
67690         FREE(ret_var.data);
67691         return ret_arr;
67692 }
67693
67694 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_metadata"))) TS_VerifiedInvoiceRequest_metadata(uint64_t this_arg) {
67695         LDKVerifiedInvoiceRequest this_arg_conv;
67696         this_arg_conv.inner = untag_ptr(this_arg);
67697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67699         this_arg_conv.is_owned = false;
67700         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67701         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
67702         uint64_t ret_ref = tag_ptr(ret_copy, true);
67703         return ret_ref;
67704 }
67705
67706 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount"))) TS_VerifiedInvoiceRequest_amount(uint64_t this_arg) {
67707         LDKVerifiedInvoiceRequest this_arg_conv;
67708         this_arg_conv.inner = untag_ptr(this_arg);
67709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67711         this_arg_conv.is_owned = false;
67712         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
67713         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
67714         uint64_t ret_ref = tag_ptr(ret_copy, true);
67715         return ret_ref;
67716 }
67717
67718 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_description"))) TS_VerifiedInvoiceRequest_description(uint64_t this_arg) {
67719         LDKVerifiedInvoiceRequest this_arg_conv;
67720         this_arg_conv.inner = untag_ptr(this_arg);
67721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67723         this_arg_conv.is_owned = false;
67724         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
67725         uint64_t ret_ref = 0;
67726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67728         return ret_ref;
67729 }
67730
67731 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_offer_features"))) TS_VerifiedInvoiceRequest_offer_features(uint64_t this_arg) {
67732         LDKVerifiedInvoiceRequest this_arg_conv;
67733         this_arg_conv.inner = untag_ptr(this_arg);
67734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67736         this_arg_conv.is_owned = false;
67737         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
67738         uint64_t ret_ref = 0;
67739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67741         return ret_ref;
67742 }
67743
67744 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_absolute_expiry"))) TS_VerifiedInvoiceRequest_absolute_expiry(uint64_t this_arg) {
67745         LDKVerifiedInvoiceRequest this_arg_conv;
67746         this_arg_conv.inner = untag_ptr(this_arg);
67747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67749         this_arg_conv.is_owned = false;
67750         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67751         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
67752         uint64_t ret_ref = tag_ptr(ret_copy, true);
67753         return ret_ref;
67754 }
67755
67756 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_issuer"))) TS_VerifiedInvoiceRequest_issuer(uint64_t this_arg) {
67757         LDKVerifiedInvoiceRequest this_arg_conv;
67758         this_arg_conv.inner = untag_ptr(this_arg);
67759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67761         this_arg_conv.is_owned = false;
67762         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
67763         uint64_t ret_ref = 0;
67764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67766         return ret_ref;
67767 }
67768
67769 uint64_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_paths"))) TS_VerifiedInvoiceRequest_paths(uint64_t this_arg) {
67770         LDKVerifiedInvoiceRequest this_arg_conv;
67771         this_arg_conv.inner = untag_ptr(this_arg);
67772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67774         this_arg_conv.is_owned = false;
67775         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
67776         uint64_tArray ret_arr = NULL;
67777         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
67778         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
67779         for (size_t n = 0; n < ret_var.datalen; n++) {
67780                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67781                 uint64_t ret_conv_13_ref = 0;
67782                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67783                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67784                 ret_arr_ptr[n] = ret_conv_13_ref;
67785         }
67786         
67787         FREE(ret_var.data);
67788         return ret_arr;
67789 }
67790
67791 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_supported_quantity"))) TS_VerifiedInvoiceRequest_supported_quantity(uint64_t this_arg) {
67792         LDKVerifiedInvoiceRequest this_arg_conv;
67793         this_arg_conv.inner = untag_ptr(this_arg);
67794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67796         this_arg_conv.is_owned = false;
67797         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
67798         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
67799         uint64_t ret_ref = tag_ptr(ret_copy, true);
67800         return ret_ref;
67801 }
67802
67803 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_signing_pubkey"))) TS_VerifiedInvoiceRequest_signing_pubkey(uint64_t this_arg) {
67804         LDKVerifiedInvoiceRequest this_arg_conv;
67805         this_arg_conv.inner = untag_ptr(this_arg);
67806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67808         this_arg_conv.is_owned = false;
67809         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67810         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
67811         return ret_arr;
67812 }
67813
67814 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_metadata"))) TS_VerifiedInvoiceRequest_payer_metadata(uint64_t this_arg) {
67815         LDKVerifiedInvoiceRequest this_arg_conv;
67816         this_arg_conv.inner = untag_ptr(this_arg);
67817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67819         this_arg_conv.is_owned = false;
67820         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
67821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67823         return ret_arr;
67824 }
67825
67826 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_chain"))) TS_VerifiedInvoiceRequest_chain(uint64_t this_arg) {
67827         LDKVerifiedInvoiceRequest this_arg_conv;
67828         this_arg_conv.inner = untag_ptr(this_arg);
67829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67831         this_arg_conv.is_owned = false;
67832         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67833         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
67834         return ret_arr;
67835 }
67836
67837 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_amount_msats"))) TS_VerifiedInvoiceRequest_amount_msats(uint64_t this_arg) {
67838         LDKVerifiedInvoiceRequest this_arg_conv;
67839         this_arg_conv.inner = untag_ptr(this_arg);
67840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67842         this_arg_conv.is_owned = false;
67843         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67844         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
67845         uint64_t ret_ref = tag_ptr(ret_copy, true);
67846         return ret_ref;
67847 }
67848
67849 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_invoice_request_features"))) TS_VerifiedInvoiceRequest_invoice_request_features(uint64_t this_arg) {
67850         LDKVerifiedInvoiceRequest this_arg_conv;
67851         this_arg_conv.inner = untag_ptr(this_arg);
67852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67854         this_arg_conv.is_owned = false;
67855         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
67856         uint64_t ret_ref = 0;
67857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67859         return ret_ref;
67860 }
67861
67862 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_quantity"))) TS_VerifiedInvoiceRequest_quantity(uint64_t this_arg) {
67863         LDKVerifiedInvoiceRequest this_arg_conv;
67864         this_arg_conv.inner = untag_ptr(this_arg);
67865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67867         this_arg_conv.is_owned = false;
67868         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67869         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
67870         uint64_t ret_ref = tag_ptr(ret_copy, true);
67871         return ret_ref;
67872 }
67873
67874 int8_tArray  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_id"))) TS_VerifiedInvoiceRequest_payer_id(uint64_t this_arg) {
67875         LDKVerifiedInvoiceRequest this_arg_conv;
67876         this_arg_conv.inner = untag_ptr(this_arg);
67877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67879         this_arg_conv.is_owned = false;
67880         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67881         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
67882         return ret_arr;
67883 }
67884
67885 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_payer_note"))) TS_VerifiedInvoiceRequest_payer_note(uint64_t this_arg) {
67886         LDKVerifiedInvoiceRequest this_arg_conv;
67887         this_arg_conv.inner = untag_ptr(this_arg);
67888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67890         this_arg_conv.is_owned = false;
67891         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
67892         uint64_t ret_ref = 0;
67893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67895         return ret_ref;
67896 }
67897
67898 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_respond_with_no_std"))) TS_VerifiedInvoiceRequest_respond_with_no_std(uint64_t this_arg, uint64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
67899         LDKVerifiedInvoiceRequest this_arg_conv;
67900         this_arg_conv.inner = untag_ptr(this_arg);
67901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67903         this_arg_conv.is_owned = false;
67904         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
67905         payment_paths_constr.datalen = payment_paths->arr_len;
67906         if (payment_paths_constr.datalen > 0)
67907                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
67908         else
67909                 payment_paths_constr.data = NULL;
67910         uint64_t* payment_paths_vals = payment_paths->elems;
67911         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
67912                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
67913                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
67914                 CHECK_ACCESS(payment_paths_conv_37_ptr);
67915                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
67916                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
67917                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
67918         }
67919         FREE(payment_paths);
67920         LDKThirtyTwoBytes payment_hash_ref;
67921         CHECK(payment_hash->arr_len == 32);
67922         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67923         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
67924         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
67925         return tag_ptr(ret_conv, true);
67926 }
67927
67928 uint64_t  __attribute__((export_name("TS_VerifiedInvoiceRequest_respond_using_derived_keys_no_std"))) TS_VerifiedInvoiceRequest_respond_using_derived_keys_no_std(uint64_t this_arg, uint64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
67929         LDKVerifiedInvoiceRequest this_arg_conv;
67930         this_arg_conv.inner = untag_ptr(this_arg);
67931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67933         this_arg_conv.is_owned = false;
67934         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
67935         payment_paths_constr.datalen = payment_paths->arr_len;
67936         if (payment_paths_constr.datalen > 0)
67937                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
67938         else
67939                 payment_paths_constr.data = NULL;
67940         uint64_t* payment_paths_vals = payment_paths->elems;
67941         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
67942                 uint64_t payment_paths_conv_37 = payment_paths_vals[l];
67943                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
67944                 CHECK_ACCESS(payment_paths_conv_37_ptr);
67945                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
67946                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
67947                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
67948         }
67949         FREE(payment_paths);
67950         LDKThirtyTwoBytes payment_hash_ref;
67951         CHECK(payment_hash->arr_len == 32);
67952         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67953         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
67954         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
67955         return tag_ptr(ret_conv, true);
67956 }
67957
67958 int8_tArray  __attribute__((export_name("TS_UnsignedInvoiceRequest_write"))) TS_UnsignedInvoiceRequest_write(uint64_t obj) {
67959         LDKUnsignedInvoiceRequest obj_conv;
67960         obj_conv.inner = untag_ptr(obj);
67961         obj_conv.is_owned = ptr_is_owned(obj);
67962         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67963         obj_conv.is_owned = false;
67964         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
67965         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67966         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67967         CVec_u8Z_free(ret_var);
67968         return ret_arr;
67969 }
67970
67971 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
67972         LDKInvoiceRequest obj_conv;
67973         obj_conv.inner = untag_ptr(obj);
67974         obj_conv.is_owned = ptr_is_owned(obj);
67975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67976         obj_conv.is_owned = false;
67977         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
67978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67980         CVec_u8Z_free(ret_var);
67981         return ret_arr;
67982 }
67983
67984 void  __attribute__((export_name("TS_InvoiceRequestFields_free"))) TS_InvoiceRequestFields_free(uint64_t this_obj) {
67985         LDKInvoiceRequestFields this_obj_conv;
67986         this_obj_conv.inner = untag_ptr(this_obj);
67987         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67989         InvoiceRequestFields_free(this_obj_conv);
67990 }
67991
67992 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFields_get_payer_id"))) TS_InvoiceRequestFields_get_payer_id(uint64_t this_ptr) {
67993         LDKInvoiceRequestFields this_ptr_conv;
67994         this_ptr_conv.inner = untag_ptr(this_ptr);
67995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67997         this_ptr_conv.is_owned = false;
67998         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67999         memcpy(ret_arr->elems, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form, 33);
68000         return ret_arr;
68001 }
68002
68003 void  __attribute__((export_name("TS_InvoiceRequestFields_set_payer_id"))) TS_InvoiceRequestFields_set_payer_id(uint64_t this_ptr, int8_tArray val) {
68004         LDKInvoiceRequestFields this_ptr_conv;
68005         this_ptr_conv.inner = untag_ptr(this_ptr);
68006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68008         this_ptr_conv.is_owned = false;
68009         LDKPublicKey val_ref;
68010         CHECK(val->arr_len == 33);
68011         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68012         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
68013 }
68014
68015 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_get_quantity"))) TS_InvoiceRequestFields_get_quantity(uint64_t this_ptr) {
68016         LDKInvoiceRequestFields this_ptr_conv;
68017         this_ptr_conv.inner = untag_ptr(this_ptr);
68018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68020         this_ptr_conv.is_owned = false;
68021         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68022         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
68023         uint64_t ret_ref = tag_ptr(ret_copy, true);
68024         return ret_ref;
68025 }
68026
68027 void  __attribute__((export_name("TS_InvoiceRequestFields_set_quantity"))) TS_InvoiceRequestFields_set_quantity(uint64_t this_ptr, uint64_t val) {
68028         LDKInvoiceRequestFields this_ptr_conv;
68029         this_ptr_conv.inner = untag_ptr(this_ptr);
68030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68032         this_ptr_conv.is_owned = false;
68033         void* val_ptr = untag_ptr(val);
68034         CHECK_ACCESS(val_ptr);
68035         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68036         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68037         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
68038 }
68039
68040 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_get_payer_note_truncated"))) TS_InvoiceRequestFields_get_payer_note_truncated(uint64_t this_ptr) {
68041         LDKInvoiceRequestFields this_ptr_conv;
68042         this_ptr_conv.inner = untag_ptr(this_ptr);
68043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68045         this_ptr_conv.is_owned = false;
68046         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
68047         uint64_t ret_ref = 0;
68048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68050         return ret_ref;
68051 }
68052
68053 void  __attribute__((export_name("TS_InvoiceRequestFields_set_payer_note_truncated"))) TS_InvoiceRequestFields_set_payer_note_truncated(uint64_t this_ptr, uint64_t val) {
68054         LDKInvoiceRequestFields this_ptr_conv;
68055         this_ptr_conv.inner = untag_ptr(this_ptr);
68056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68058         this_ptr_conv.is_owned = false;
68059         LDKUntrustedString val_conv;
68060         val_conv.inner = untag_ptr(val);
68061         val_conv.is_owned = ptr_is_owned(val);
68062         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68063         val_conv = UntrustedString_clone(&val_conv);
68064         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
68065 }
68066
68067 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_new"))) TS_InvoiceRequestFields_new(int8_tArray payer_id_arg, uint64_t quantity_arg, uint64_t payer_note_truncated_arg) {
68068         LDKPublicKey payer_id_arg_ref;
68069         CHECK(payer_id_arg->arr_len == 33);
68070         memcpy(payer_id_arg_ref.compressed_form, payer_id_arg->elems, 33); FREE(payer_id_arg);
68071         void* quantity_arg_ptr = untag_ptr(quantity_arg);
68072         CHECK_ACCESS(quantity_arg_ptr);
68073         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
68074         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
68075         LDKUntrustedString payer_note_truncated_arg_conv;
68076         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
68077         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
68078         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
68079         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
68080         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
68081         uint64_t ret_ref = 0;
68082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68084         return ret_ref;
68085 }
68086
68087 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
68088         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
68089         uint64_t ret_ref = 0;
68090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68092         return ret_ref;
68093 }
68094 int64_t  __attribute__((export_name("TS_InvoiceRequestFields_clone_ptr"))) TS_InvoiceRequestFields_clone_ptr(uint64_t arg) {
68095         LDKInvoiceRequestFields arg_conv;
68096         arg_conv.inner = untag_ptr(arg);
68097         arg_conv.is_owned = ptr_is_owned(arg);
68098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68099         arg_conv.is_owned = false;
68100         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
68101         return ret_conv;
68102 }
68103
68104 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_clone"))) TS_InvoiceRequestFields_clone(uint64_t orig) {
68105         LDKInvoiceRequestFields orig_conv;
68106         orig_conv.inner = untag_ptr(orig);
68107         orig_conv.is_owned = ptr_is_owned(orig);
68108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68109         orig_conv.is_owned = false;
68110         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
68111         uint64_t ret_ref = 0;
68112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68114         return ret_ref;
68115 }
68116
68117 jboolean  __attribute__((export_name("TS_InvoiceRequestFields_eq"))) TS_InvoiceRequestFields_eq(uint64_t a, uint64_t b) {
68118         LDKInvoiceRequestFields a_conv;
68119         a_conv.inner = untag_ptr(a);
68120         a_conv.is_owned = ptr_is_owned(a);
68121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68122         a_conv.is_owned = false;
68123         LDKInvoiceRequestFields b_conv;
68124         b_conv.inner = untag_ptr(b);
68125         b_conv.is_owned = ptr_is_owned(b);
68126         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68127         b_conv.is_owned = false;
68128         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
68129         return ret_conv;
68130 }
68131
68132 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFields_write"))) TS_InvoiceRequestFields_write(uint64_t obj) {
68133         LDKInvoiceRequestFields obj_conv;
68134         obj_conv.inner = untag_ptr(obj);
68135         obj_conv.is_owned = ptr_is_owned(obj);
68136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68137         obj_conv.is_owned = false;
68138         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
68139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68141         CVec_u8Z_free(ret_var);
68142         return ret_arr;
68143 }
68144
68145 uint64_t  __attribute__((export_name("TS_InvoiceRequestFields_read"))) TS_InvoiceRequestFields_read(int8_tArray ser) {
68146         LDKu8slice ser_ref;
68147         ser_ref.datalen = ser->arr_len;
68148         ser_ref.data = ser->elems;
68149         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
68150         *ret_conv = InvoiceRequestFields_read(ser_ref);
68151         FREE(ser);
68152         return tag_ptr(ret_conv, true);
68153 }
68154
68155 void  __attribute__((export_name("TS_TaggedHash_free"))) TS_TaggedHash_free(uint64_t this_obj) {
68156         LDKTaggedHash this_obj_conv;
68157         this_obj_conv.inner = untag_ptr(this_obj);
68158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68160         TaggedHash_free(this_obj_conv);
68161 }
68162
68163 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
68164         LDKTaggedHash ret_var = TaggedHash_clone(arg);
68165         uint64_t ret_ref = 0;
68166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68168         return ret_ref;
68169 }
68170 int64_t  __attribute__((export_name("TS_TaggedHash_clone_ptr"))) TS_TaggedHash_clone_ptr(uint64_t arg) {
68171         LDKTaggedHash arg_conv;
68172         arg_conv.inner = untag_ptr(arg);
68173         arg_conv.is_owned = ptr_is_owned(arg);
68174         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68175         arg_conv.is_owned = false;
68176         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
68177         return ret_conv;
68178 }
68179
68180 uint64_t  __attribute__((export_name("TS_TaggedHash_clone"))) TS_TaggedHash_clone(uint64_t orig) {
68181         LDKTaggedHash orig_conv;
68182         orig_conv.inner = untag_ptr(orig);
68183         orig_conv.is_owned = ptr_is_owned(orig);
68184         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68185         orig_conv.is_owned = false;
68186         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
68187         uint64_t ret_ref = 0;
68188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68190         return ret_ref;
68191 }
68192
68193 int8_tArray  __attribute__((export_name("TS_TaggedHash_as_digest"))) TS_TaggedHash_as_digest(uint64_t this_arg) {
68194         LDKTaggedHash this_arg_conv;
68195         this_arg_conv.inner = untag_ptr(this_arg);
68196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68198         this_arg_conv.is_owned = false;
68199         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68200         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
68201         return ret_arr;
68202 }
68203
68204 jstring  __attribute__((export_name("TS_TaggedHash_tag"))) TS_TaggedHash_tag(uint64_t this_arg) {
68205         LDKTaggedHash this_arg_conv;
68206         this_arg_conv.inner = untag_ptr(this_arg);
68207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68209         this_arg_conv.is_owned = false;
68210         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
68211         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
68212         Str_free(ret_str);
68213         return ret_conv;
68214 }
68215
68216 int8_tArray  __attribute__((export_name("TS_TaggedHash_merkle_root"))) TS_TaggedHash_merkle_root(uint64_t this_arg) {
68217         LDKTaggedHash this_arg_conv;
68218         this_arg_conv.inner = untag_ptr(this_arg);
68219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68221         this_arg_conv.is_owned = false;
68222         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68223         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
68224         return ret_arr;
68225 }
68226
68227 void  __attribute__((export_name("TS_SignError_free"))) TS_SignError_free(uint64_t this_ptr) {
68228         if (!ptr_is_owned(this_ptr)) return;
68229         void* this_ptr_ptr = untag_ptr(this_ptr);
68230         CHECK_ACCESS(this_ptr_ptr);
68231         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
68232         FREE(untag_ptr(this_ptr));
68233         SignError_free(this_ptr_conv);
68234 }
68235
68236 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
68237         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68238         *ret_copy = SignError_clone(arg);
68239         uint64_t ret_ref = tag_ptr(ret_copy, true);
68240         return ret_ref;
68241 }
68242 int64_t  __attribute__((export_name("TS_SignError_clone_ptr"))) TS_SignError_clone_ptr(uint64_t arg) {
68243         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
68244         int64_t ret_conv = SignError_clone_ptr(arg_conv);
68245         return ret_conv;
68246 }
68247
68248 uint64_t  __attribute__((export_name("TS_SignError_clone"))) TS_SignError_clone(uint64_t orig) {
68249         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
68250         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68251         *ret_copy = SignError_clone(orig_conv);
68252         uint64_t ret_ref = tag_ptr(ret_copy, true);
68253         return ret_ref;
68254 }
68255
68256 uint64_t  __attribute__((export_name("TS_SignError_signing"))) TS_SignError_signing() {
68257         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68258         *ret_copy = SignError_signing();
68259         uint64_t ret_ref = tag_ptr(ret_copy, true);
68260         return ret_ref;
68261 }
68262
68263 uint64_t  __attribute__((export_name("TS_SignError_verification"))) TS_SignError_verification(uint32_t a) {
68264         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
68265         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68266         *ret_copy = SignError_verification(a_conv);
68267         uint64_t ret_ref = tag_ptr(ret_copy, true);
68268         return ret_ref;
68269 }
68270
68271 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
68272         LDKBolt12ParseError this_obj_conv;
68273         this_obj_conv.inner = untag_ptr(this_obj);
68274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68276         Bolt12ParseError_free(this_obj_conv);
68277 }
68278
68279 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
68280         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
68281         uint64_t ret_ref = 0;
68282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68284         return ret_ref;
68285 }
68286 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
68287         LDKBolt12ParseError arg_conv;
68288         arg_conv.inner = untag_ptr(arg);
68289         arg_conv.is_owned = ptr_is_owned(arg);
68290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68291         arg_conv.is_owned = false;
68292         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
68293         return ret_conv;
68294 }
68295
68296 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
68297         LDKBolt12ParseError orig_conv;
68298         orig_conv.inner = untag_ptr(orig);
68299         orig_conv.is_owned = ptr_is_owned(orig);
68300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68301         orig_conv.is_owned = false;
68302         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
68303         uint64_t ret_ref = 0;
68304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68306         return ret_ref;
68307 }
68308
68309 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
68310         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
68311         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
68312         return ret_conv;
68313 }
68314
68315 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
68316         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
68317         return ret_conv;
68318 }
68319
68320 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
68321         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
68322         return ret_conv;
68323 }
68324
68325 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
68326         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
68327         return ret_conv;
68328 }
68329
68330 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
68331         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
68332         return ret_conv;
68333 }
68334
68335 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
68336         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
68337         return ret_conv;
68338 }
68339
68340 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
68341         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
68342         return ret_conv;
68343 }
68344
68345 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
68346         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
68347         return ret_conv;
68348 }
68349
68350 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
68351         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
68352         return ret_conv;
68353 }
68354
68355 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
68356         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
68357         return ret_conv;
68358 }
68359
68360 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
68361         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
68362         return ret_conv;
68363 }
68364
68365 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
68366         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
68367         return ret_conv;
68368 }
68369
68370 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
68371         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
68372         return ret_conv;
68373 }
68374
68375 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
68376         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
68377         return ret_conv;
68378 }
68379
68380 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
68381         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
68382         return ret_conv;
68383 }
68384
68385 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
68386         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
68387         return ret_conv;
68388 }
68389
68390 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
68391         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
68392         return ret_conv;
68393 }
68394
68395 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
68396         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
68397         return ret_conv;
68398 }
68399
68400 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
68401         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
68402         return ret_conv;
68403 }
68404
68405 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
68406         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
68407         return ret_conv;
68408 }
68409
68410 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
68411         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
68412         return ret_conv;
68413 }
68414
68415 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
68416         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
68417         return ret_conv;
68418 }
68419
68420 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_duplicate_payment_id"))) TS_Bolt12SemanticError_duplicate_payment_id() {
68421         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_duplicate_payment_id());
68422         return ret_conv;
68423 }
68424
68425 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
68426         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
68427         return ret_conv;
68428 }
68429
68430 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_paths"))) TS_Bolt12SemanticError_unexpected_paths() {
68431         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_paths());
68432         return ret_conv;
68433 }
68434
68435 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
68436         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
68437         return ret_conv;
68438 }
68439
68440 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
68441         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
68442         return ret_conv;
68443 }
68444
68445 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
68446         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
68447         return ret_conv;
68448 }
68449
68450 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
68451         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
68452         return ret_conv;
68453 }
68454
68455 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_free"))) TS_RefundMaybeWithDerivedMetadataBuilder_free(uint64_t this_obj) {
68456         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
68457         this_obj_conv.inner = untag_ptr(this_obj);
68458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68460         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
68461 }
68462
68463 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
68464         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
68465         uint64_t ret_ref = 0;
68466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68468         return ret_ref;
68469 }
68470 int64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_clone_ptr"))) TS_RefundMaybeWithDerivedMetadataBuilder_clone_ptr(uint64_t arg) {
68471         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
68472         arg_conv.inner = untag_ptr(arg);
68473         arg_conv.is_owned = ptr_is_owned(arg);
68474         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68475         arg_conv.is_owned = false;
68476         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
68477         return ret_conv;
68478 }
68479
68480 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_clone"))) TS_RefundMaybeWithDerivedMetadataBuilder_clone(uint64_t orig) {
68481         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
68482         orig_conv.inner = untag_ptr(orig);
68483         orig_conv.is_owned = ptr_is_owned(orig);
68484         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68485         orig_conv.is_owned = false;
68486         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
68487         uint64_t ret_ref = 0;
68488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68490         return ret_ref;
68491 }
68492
68493 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_new"))) TS_RefundMaybeWithDerivedMetadataBuilder_new(int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
68494         LDKCVec_u8Z metadata_ref;
68495         metadata_ref.datalen = metadata->arr_len;
68496         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
68497         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
68498         LDKPublicKey payer_id_ref;
68499         CHECK(payer_id->arr_len == 33);
68500         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
68501         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
68502         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
68503         return tag_ptr(ret_conv, true);
68504 }
68505
68506 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id"))) TS_RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(int8_tArray node_id, uint64_t expanded_key, uint64_t entropy_source, int64_t amount_msats, int8_tArray payment_id) {
68507         LDKPublicKey node_id_ref;
68508         CHECK(node_id->arr_len == 33);
68509         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
68510         LDKExpandedKey expanded_key_conv;
68511         expanded_key_conv.inner = untag_ptr(expanded_key);
68512         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
68513         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
68514         expanded_key_conv.is_owned = false;
68515         void* entropy_source_ptr = untag_ptr(entropy_source);
68516         CHECK_ACCESS(entropy_source_ptr);
68517         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
68518         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
68519                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68520                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
68521         }
68522         LDKThirtyTwoBytes payment_id_ref;
68523         CHECK(payment_id->arr_len == 32);
68524         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
68525         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
68526         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
68527         return tag_ptr(ret_conv, true);
68528 }
68529
68530 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_description"))) TS_RefundMaybeWithDerivedMetadataBuilder_description(uint64_t this_arg, jstring description) {
68531         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68532         this_arg_conv.inner = untag_ptr(this_arg);
68533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68535         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68536         LDKStr description_conv = str_ref_to_owned_c(description);
68537         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
68538 }
68539
68540 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry"))) TS_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(uint64_t this_arg, int64_t absolute_expiry) {
68541         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68542         this_arg_conv.inner = untag_ptr(this_arg);
68543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68545         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68546         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
68547 }
68548
68549 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_issuer"))) TS_RefundMaybeWithDerivedMetadataBuilder_issuer(uint64_t this_arg, jstring issuer) {
68550         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68551         this_arg_conv.inner = untag_ptr(this_arg);
68552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68554         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68555         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
68556         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
68557 }
68558
68559 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_path"))) TS_RefundMaybeWithDerivedMetadataBuilder_path(uint64_t this_arg, uint64_t path) {
68560         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68561         this_arg_conv.inner = untag_ptr(this_arg);
68562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68564         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68565         LDKBlindedPath path_conv;
68566         path_conv.inner = untag_ptr(path);
68567         path_conv.is_owned = ptr_is_owned(path);
68568         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
68569         path_conv = BlindedPath_clone(&path_conv);
68570         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
68571 }
68572
68573 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_chain"))) TS_RefundMaybeWithDerivedMetadataBuilder_chain(uint64_t this_arg, uint32_t network) {
68574         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68575         this_arg_conv.inner = untag_ptr(this_arg);
68576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68578         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68579         LDKNetwork network_conv = LDKNetwork_from_js(network);
68580         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
68581 }
68582
68583 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_quantity"))) TS_RefundMaybeWithDerivedMetadataBuilder_quantity(uint64_t this_arg, int64_t quantity) {
68584         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68585         this_arg_conv.inner = untag_ptr(this_arg);
68586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68588         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68589         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
68590 }
68591
68592 void  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_payer_note"))) TS_RefundMaybeWithDerivedMetadataBuilder_payer_note(uint64_t this_arg, jstring payer_note) {
68593         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68594         this_arg_conv.inner = untag_ptr(this_arg);
68595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68597         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68598         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
68599         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
68600 }
68601
68602 uint64_t  __attribute__((export_name("TS_RefundMaybeWithDerivedMetadataBuilder_build"))) TS_RefundMaybeWithDerivedMetadataBuilder_build(uint64_t this_arg) {
68603         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
68604         this_arg_conv.inner = untag_ptr(this_arg);
68605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68607         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
68608         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
68609         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
68610         return tag_ptr(ret_conv, true);
68611 }
68612
68613 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
68614         LDKRefund this_obj_conv;
68615         this_obj_conv.inner = untag_ptr(this_obj);
68616         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68618         Refund_free(this_obj_conv);
68619 }
68620
68621 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
68622         LDKRefund ret_var = Refund_clone(arg);
68623         uint64_t ret_ref = 0;
68624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68626         return ret_ref;
68627 }
68628 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
68629         LDKRefund arg_conv;
68630         arg_conv.inner = untag_ptr(arg);
68631         arg_conv.is_owned = ptr_is_owned(arg);
68632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68633         arg_conv.is_owned = false;
68634         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
68635         return ret_conv;
68636 }
68637
68638 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
68639         LDKRefund orig_conv;
68640         orig_conv.inner = untag_ptr(orig);
68641         orig_conv.is_owned = ptr_is_owned(orig);
68642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68643         orig_conv.is_owned = false;
68644         LDKRefund ret_var = Refund_clone(&orig_conv);
68645         uint64_t ret_ref = 0;
68646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68648         return ret_ref;
68649 }
68650
68651 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
68652         LDKRefund this_arg_conv;
68653         this_arg_conv.inner = untag_ptr(this_arg);
68654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68656         this_arg_conv.is_owned = false;
68657         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
68658         uint64_t ret_ref = 0;
68659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68661         return ret_ref;
68662 }
68663
68664 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
68665         LDKRefund this_arg_conv;
68666         this_arg_conv.inner = untag_ptr(this_arg);
68667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68669         this_arg_conv.is_owned = false;
68670         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68671         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
68672         uint64_t ret_ref = tag_ptr(ret_copy, true);
68673         return ret_ref;
68674 }
68675
68676 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) {
68677         LDKRefund this_arg_conv;
68678         this_arg_conv.inner = untag_ptr(this_arg);
68679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68681         this_arg_conv.is_owned = false;
68682         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
68683         return ret_conv;
68684 }
68685
68686 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
68687         LDKRefund this_arg_conv;
68688         this_arg_conv.inner = untag_ptr(this_arg);
68689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68691         this_arg_conv.is_owned = false;
68692         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
68693         uint64_t ret_ref = 0;
68694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68696         return ret_ref;
68697 }
68698
68699 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
68700         LDKRefund this_arg_conv;
68701         this_arg_conv.inner = untag_ptr(this_arg);
68702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68704         this_arg_conv.is_owned = false;
68705         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
68706         uint64_tArray ret_arr = NULL;
68707         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
68708         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
68709         for (size_t n = 0; n < ret_var.datalen; n++) {
68710                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
68711                 uint64_t ret_conv_13_ref = 0;
68712                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
68713                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
68714                 ret_arr_ptr[n] = ret_conv_13_ref;
68715         }
68716         
68717         FREE(ret_var.data);
68718         return ret_arr;
68719 }
68720
68721 int8_tArray  __attribute__((export_name("TS_Refund_payer_metadata"))) TS_Refund_payer_metadata(uint64_t this_arg) {
68722         LDKRefund this_arg_conv;
68723         this_arg_conv.inner = untag_ptr(this_arg);
68724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68726         this_arg_conv.is_owned = false;
68727         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
68728         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68729         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68730         return ret_arr;
68731 }
68732
68733 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
68734         LDKRefund this_arg_conv;
68735         this_arg_conv.inner = untag_ptr(this_arg);
68736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68738         this_arg_conv.is_owned = false;
68739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68740         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
68741         return ret_arr;
68742 }
68743
68744 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
68745         LDKRefund this_arg_conv;
68746         this_arg_conv.inner = untag_ptr(this_arg);
68747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68749         this_arg_conv.is_owned = false;
68750         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
68751         return ret_conv;
68752 }
68753
68754 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
68755         LDKRefund this_arg_conv;
68756         this_arg_conv.inner = untag_ptr(this_arg);
68757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68759         this_arg_conv.is_owned = false;
68760         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
68761         uint64_t ret_ref = 0;
68762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68764         return ret_ref;
68765 }
68766
68767 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
68768         LDKRefund this_arg_conv;
68769         this_arg_conv.inner = untag_ptr(this_arg);
68770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68772         this_arg_conv.is_owned = false;
68773         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68774         *ret_copy = Refund_quantity(&this_arg_conv);
68775         uint64_t ret_ref = tag_ptr(ret_copy, true);
68776         return ret_ref;
68777 }
68778
68779 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
68780         LDKRefund this_arg_conv;
68781         this_arg_conv.inner = untag_ptr(this_arg);
68782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68784         this_arg_conv.is_owned = false;
68785         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68786         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
68787         return ret_arr;
68788 }
68789
68790 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
68791         LDKRefund this_arg_conv;
68792         this_arg_conv.inner = untag_ptr(this_arg);
68793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68795         this_arg_conv.is_owned = false;
68796         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
68797         uint64_t ret_ref = 0;
68798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68800         return ret_ref;
68801 }
68802
68803 int64_t  __attribute__((export_name("TS_Refund_hash"))) TS_Refund_hash(uint64_t o) {
68804         LDKRefund o_conv;
68805         o_conv.inner = untag_ptr(o);
68806         o_conv.is_owned = ptr_is_owned(o);
68807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68808         o_conv.is_owned = false;
68809         int64_t ret_conv = Refund_hash(&o_conv);
68810         return ret_conv;
68811 }
68812
68813 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
68814         LDKRefund obj_conv;
68815         obj_conv.inner = untag_ptr(obj);
68816         obj_conv.is_owned = ptr_is_owned(obj);
68817         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68818         obj_conv.is_owned = false;
68819         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
68820         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68821         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68822         CVec_u8Z_free(ret_var);
68823         return ret_arr;
68824 }
68825
68826 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
68827         LDKStr s_conv = str_ref_to_owned_c(s);
68828         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
68829         *ret_conv = Refund_from_str(s_conv);
68830         return tag_ptr(ret_conv, true);
68831 }
68832
68833 jstring  __attribute__((export_name("TS_Refund_to_str"))) TS_Refund_to_str(uint64_t o) {
68834         LDKRefund o_conv;
68835         o_conv.inner = untag_ptr(o);
68836         o_conv.is_owned = ptr_is_owned(o);
68837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68838         o_conv.is_owned = false;
68839         LDKStr ret_str = Refund_to_str(&o_conv);
68840         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
68841         Str_free(ret_str);
68842         return ret_conv;
68843 }
68844
68845 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
68846         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
68847         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
68848         return ret_conv;
68849 }
68850
68851 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
68852         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
68853         return ret_conv;
68854 }
68855
68856 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
68857         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
68858         return ret_conv;
68859 }
68860
68861 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
68862         if (!ptr_is_owned(this_ptr)) return;
68863         void* this_ptr_ptr = untag_ptr(this_ptr);
68864         CHECK_ACCESS(this_ptr_ptr);
68865         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
68866         FREE(untag_ptr(this_ptr));
68867         UtxoResult_free(this_ptr_conv);
68868 }
68869
68870 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
68871         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68872         *ret_copy = UtxoResult_clone(arg);
68873         uint64_t ret_ref = tag_ptr(ret_copy, true);
68874         return ret_ref;
68875 }
68876 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
68877         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
68878         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
68879         return ret_conv;
68880 }
68881
68882 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
68883         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
68884         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68885         *ret_copy = UtxoResult_clone(orig_conv);
68886         uint64_t ret_ref = tag_ptr(ret_copy, true);
68887         return ret_ref;
68888 }
68889
68890 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
68891         void* a_ptr = untag_ptr(a);
68892         CHECK_ACCESS(a_ptr);
68893         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
68894         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
68895         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68896         *ret_copy = UtxoResult_sync(a_conv);
68897         uint64_t ret_ref = tag_ptr(ret_copy, true);
68898         return ret_ref;
68899 }
68900
68901 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
68902         LDKUtxoFuture a_conv;
68903         a_conv.inner = untag_ptr(a);
68904         a_conv.is_owned = ptr_is_owned(a);
68905         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68906         a_conv = UtxoFuture_clone(&a_conv);
68907         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68908         *ret_copy = UtxoResult_async(a_conv);
68909         uint64_t ret_ref = tag_ptr(ret_copy, true);
68910         return ret_ref;
68911 }
68912
68913 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
68914         if (!ptr_is_owned(this_ptr)) return;
68915         void* this_ptr_ptr = untag_ptr(this_ptr);
68916         CHECK_ACCESS(this_ptr_ptr);
68917         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
68918         FREE(untag_ptr(this_ptr));
68919         UtxoLookup_free(this_ptr_conv);
68920 }
68921
68922 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
68923         LDKUtxoFuture this_obj_conv;
68924         this_obj_conv.inner = untag_ptr(this_obj);
68925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68927         UtxoFuture_free(this_obj_conv);
68928 }
68929
68930 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
68931         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
68932         uint64_t ret_ref = 0;
68933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68935         return ret_ref;
68936 }
68937 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
68938         LDKUtxoFuture arg_conv;
68939         arg_conv.inner = untag_ptr(arg);
68940         arg_conv.is_owned = ptr_is_owned(arg);
68941         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68942         arg_conv.is_owned = false;
68943         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
68944         return ret_conv;
68945 }
68946
68947 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
68948         LDKUtxoFuture orig_conv;
68949         orig_conv.inner = untag_ptr(orig);
68950         orig_conv.is_owned = ptr_is_owned(orig);
68951         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68952         orig_conv.is_owned = false;
68953         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
68954         uint64_t ret_ref = 0;
68955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68957         return ret_ref;
68958 }
68959
68960 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
68961         LDKUtxoFuture ret_var = UtxoFuture_new();
68962         uint64_t ret_ref = 0;
68963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68965         return ret_ref;
68966 }
68967
68968 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
68969         LDKUtxoFuture this_arg_conv;
68970         this_arg_conv.inner = untag_ptr(this_arg);
68971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68973         this_arg_conv.is_owned = false;
68974         LDKNetworkGraph graph_conv;
68975         graph_conv.inner = untag_ptr(graph);
68976         graph_conv.is_owned = ptr_is_owned(graph);
68977         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
68978         graph_conv.is_owned = false;
68979         void* result_ptr = untag_ptr(result);
68980         CHECK_ACCESS(result_ptr);
68981         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
68982         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
68983 }
68984
68985 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
68986         LDKUtxoFuture this_arg_conv;
68987         this_arg_conv.inner = untag_ptr(this_arg);
68988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68990         this_arg_conv.is_owned = false;
68991         LDKNetworkGraph graph_conv;
68992         graph_conv.inner = untag_ptr(graph);
68993         graph_conv.is_owned = ptr_is_owned(graph);
68994         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
68995         graph_conv.is_owned = false;
68996         LDKP2PGossipSync gossip_conv;
68997         gossip_conv.inner = untag_ptr(gossip);
68998         gossip_conv.is_owned = ptr_is_owned(gossip);
68999         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
69000         gossip_conv.is_owned = false;
69001         void* result_ptr = untag_ptr(result);
69002         CHECK_ACCESS(result_ptr);
69003         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
69004         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
69005 }
69006
69007 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
69008         LDKNodeId this_obj_conv;
69009         this_obj_conv.inner = untag_ptr(this_obj);
69010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69012         NodeId_free(this_obj_conv);
69013 }
69014
69015 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
69016         LDKNodeId ret_var = NodeId_clone(arg);
69017         uint64_t ret_ref = 0;
69018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69020         return ret_ref;
69021 }
69022 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
69023         LDKNodeId arg_conv;
69024         arg_conv.inner = untag_ptr(arg);
69025         arg_conv.is_owned = ptr_is_owned(arg);
69026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69027         arg_conv.is_owned = false;
69028         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
69029         return ret_conv;
69030 }
69031
69032 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
69033         LDKNodeId orig_conv;
69034         orig_conv.inner = untag_ptr(orig);
69035         orig_conv.is_owned = ptr_is_owned(orig);
69036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69037         orig_conv.is_owned = false;
69038         LDKNodeId ret_var = NodeId_clone(&orig_conv);
69039         uint64_t ret_ref = 0;
69040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69042         return ret_ref;
69043 }
69044
69045 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
69046         LDKPublicKey pubkey_ref;
69047         CHECK(pubkey->arr_len == 33);
69048         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
69049         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
69050         uint64_t ret_ref = 0;
69051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69053         return ret_ref;
69054 }
69055
69056 uint64_t  __attribute__((export_name("TS_NodeId_from_slice"))) TS_NodeId_from_slice(int8_tArray bytes) {
69057         LDKu8slice bytes_ref;
69058         bytes_ref.datalen = bytes->arr_len;
69059         bytes_ref.data = bytes->elems;
69060         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
69061         *ret_conv = NodeId_from_slice(bytes_ref);
69062         FREE(bytes);
69063         return tag_ptr(ret_conv, true);
69064 }
69065
69066 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
69067         LDKNodeId this_arg_conv;
69068         this_arg_conv.inner = untag_ptr(this_arg);
69069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69071         this_arg_conv.is_owned = false;
69072         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
69073         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69074         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69075         return ret_arr;
69076 }
69077
69078 int8_tArray  __attribute__((export_name("TS_NodeId_as_array"))) TS_NodeId_as_array(uint64_t this_arg) {
69079         LDKNodeId this_arg_conv;
69080         this_arg_conv.inner = untag_ptr(this_arg);
69081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69083         this_arg_conv.is_owned = false;
69084         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69085         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
69086         return ret_arr;
69087 }
69088
69089 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
69090         LDKNodeId this_arg_conv;
69091         this_arg_conv.inner = untag_ptr(this_arg);
69092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69094         this_arg_conv.is_owned = false;
69095         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
69096         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
69097         return tag_ptr(ret_conv, true);
69098 }
69099
69100 jstring  __attribute__((export_name("TS_NodeId_to_str"))) TS_NodeId_to_str(uint64_t o) {
69101         LDKNodeId o_conv;
69102         o_conv.inner = untag_ptr(o);
69103         o_conv.is_owned = ptr_is_owned(o);
69104         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69105         o_conv.is_owned = false;
69106         LDKStr ret_str = NodeId_to_str(&o_conv);
69107         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69108         Str_free(ret_str);
69109         return ret_conv;
69110 }
69111
69112 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
69113         LDKNodeId o_conv;
69114         o_conv.inner = untag_ptr(o);
69115         o_conv.is_owned = ptr_is_owned(o);
69116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69117         o_conv.is_owned = false;
69118         int64_t ret_conv = NodeId_hash(&o_conv);
69119         return ret_conv;
69120 }
69121
69122 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
69123         LDKNodeId obj_conv;
69124         obj_conv.inner = untag_ptr(obj);
69125         obj_conv.is_owned = ptr_is_owned(obj);
69126         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69127         obj_conv.is_owned = false;
69128         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
69129         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69130         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69131         CVec_u8Z_free(ret_var);
69132         return ret_arr;
69133 }
69134
69135 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
69136         LDKu8slice ser_ref;
69137         ser_ref.datalen = ser->arr_len;
69138         ser_ref.data = ser->elems;
69139         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
69140         *ret_conv = NodeId_read(ser_ref);
69141         FREE(ser);
69142         return tag_ptr(ret_conv, true);
69143 }
69144
69145 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
69146         LDKNetworkGraph this_obj_conv;
69147         this_obj_conv.inner = untag_ptr(this_obj);
69148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69150         NetworkGraph_free(this_obj_conv);
69151 }
69152
69153 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
69154         LDKReadOnlyNetworkGraph this_obj_conv;
69155         this_obj_conv.inner = untag_ptr(this_obj);
69156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69158         ReadOnlyNetworkGraph_free(this_obj_conv);
69159 }
69160
69161 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
69162         if (!ptr_is_owned(this_ptr)) return;
69163         void* this_ptr_ptr = untag_ptr(this_ptr);
69164         CHECK_ACCESS(this_ptr_ptr);
69165         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
69166         FREE(untag_ptr(this_ptr));
69167         NetworkUpdate_free(this_ptr_conv);
69168 }
69169
69170 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
69171         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69172         *ret_copy = NetworkUpdate_clone(arg);
69173         uint64_t ret_ref = tag_ptr(ret_copy, true);
69174         return ret_ref;
69175 }
69176 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
69177         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
69178         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
69179         return ret_conv;
69180 }
69181
69182 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
69183         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
69184         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69185         *ret_copy = NetworkUpdate_clone(orig_conv);
69186         uint64_t ret_ref = tag_ptr(ret_copy, true);
69187         return ret_ref;
69188 }
69189
69190 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
69191         LDKChannelUpdate msg_conv;
69192         msg_conv.inner = untag_ptr(msg);
69193         msg_conv.is_owned = ptr_is_owned(msg);
69194         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69195         msg_conv = ChannelUpdate_clone(&msg_conv);
69196         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69197         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
69198         uint64_t ret_ref = tag_ptr(ret_copy, true);
69199         return ret_ref;
69200 }
69201
69202 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
69203         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69204         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
69205         uint64_t ret_ref = tag_ptr(ret_copy, true);
69206         return ret_ref;
69207 }
69208
69209 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
69210         LDKPublicKey node_id_ref;
69211         CHECK(node_id->arr_len == 33);
69212         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
69213         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69214         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
69215         uint64_t ret_ref = tag_ptr(ret_copy, true);
69216         return ret_ref;
69217 }
69218
69219 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
69220         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
69221         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
69222         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
69223         return ret_conv;
69224 }
69225
69226 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
69227         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
69228         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
69229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69231         CVec_u8Z_free(ret_var);
69232         return ret_arr;
69233 }
69234
69235 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
69236         LDKu8slice ser_ref;
69237         ser_ref.datalen = ser->arr_len;
69238         ser_ref.data = ser->elems;
69239         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
69240         *ret_conv = NetworkUpdate_read(ser_ref);
69241         FREE(ser);
69242         return tag_ptr(ret_conv, true);
69243 }
69244
69245 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
69246         LDKP2PGossipSync this_obj_conv;
69247         this_obj_conv.inner = untag_ptr(this_obj);
69248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69250         P2PGossipSync_free(this_obj_conv);
69251 }
69252
69253 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
69254         LDKNetworkGraph network_graph_conv;
69255         network_graph_conv.inner = untag_ptr(network_graph);
69256         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69257         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69258         network_graph_conv.is_owned = false;
69259         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69260         CHECK_ACCESS(utxo_lookup_ptr);
69261         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69262         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69263         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69264                 // Manually implement clone for Java trait instances
69265                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69266                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69267                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69268                 }
69269         }
69270         void* logger_ptr = untag_ptr(logger);
69271         CHECK_ACCESS(logger_ptr);
69272         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69273         if (logger_conv.free == LDKLogger_JCalls_free) {
69274                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69275                 LDKLogger_JCalls_cloned(&logger_conv);
69276         }
69277         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
69278         uint64_t ret_ref = 0;
69279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69281         return ret_ref;
69282 }
69283
69284 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
69285         LDKP2PGossipSync 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         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69291         CHECK_ACCESS(utxo_lookup_ptr);
69292         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69293         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69294         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69295                 // Manually implement clone for Java trait instances
69296                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69297                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69298                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69299                 }
69300         }
69301         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
69302 }
69303
69304 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
69305         LDKNetworkGraph this_arg_conv;
69306         this_arg_conv.inner = untag_ptr(this_arg);
69307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69309         this_arg_conv.is_owned = false;
69310         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
69311         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
69312 }
69313
69314 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_chain_hash"))) TS_NetworkGraph_get_chain_hash(uint64_t this_arg) {
69315         LDKNetworkGraph this_arg_conv;
69316         this_arg_conv.inner = untag_ptr(this_arg);
69317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69319         this_arg_conv.is_owned = false;
69320         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69321         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
69322         return ret_arr;
69323 }
69324
69325 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
69326         LDKNodeAnnouncement msg_conv;
69327         msg_conv.inner = untag_ptr(msg);
69328         msg_conv.is_owned = ptr_is_owned(msg);
69329         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69330         msg_conv.is_owned = false;
69331         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69332         *ret_conv = verify_node_announcement(&msg_conv);
69333         return tag_ptr(ret_conv, true);
69334 }
69335
69336 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
69337         LDKChannelAnnouncement msg_conv;
69338         msg_conv.inner = untag_ptr(msg);
69339         msg_conv.is_owned = ptr_is_owned(msg);
69340         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69341         msg_conv.is_owned = false;
69342         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69343         *ret_conv = verify_channel_announcement(&msg_conv);
69344         return tag_ptr(ret_conv, true);
69345 }
69346
69347 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
69348         LDKP2PGossipSync this_arg_conv;
69349         this_arg_conv.inner = untag_ptr(this_arg);
69350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69352         this_arg_conv.is_owned = false;
69353         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
69354         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
69355         return tag_ptr(ret_ret, true);
69356 }
69357
69358 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
69359         LDKP2PGossipSync this_arg_conv;
69360         this_arg_conv.inner = untag_ptr(this_arg);
69361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69363         this_arg_conv.is_owned = false;
69364         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
69365         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
69366         return tag_ptr(ret_ret, true);
69367 }
69368
69369 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
69370         LDKChannelUpdateInfo this_obj_conv;
69371         this_obj_conv.inner = untag_ptr(this_obj);
69372         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69374         ChannelUpdateInfo_free(this_obj_conv);
69375 }
69376
69377 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
69378         LDKChannelUpdateInfo this_ptr_conv;
69379         this_ptr_conv.inner = untag_ptr(this_ptr);
69380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69382         this_ptr_conv.is_owned = false;
69383         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
69384         return ret_conv;
69385 }
69386
69387 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
69388         LDKChannelUpdateInfo this_ptr_conv;
69389         this_ptr_conv.inner = untag_ptr(this_ptr);
69390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69392         this_ptr_conv.is_owned = false;
69393         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
69394 }
69395
69396 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
69397         LDKChannelUpdateInfo this_ptr_conv;
69398         this_ptr_conv.inner = untag_ptr(this_ptr);
69399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69401         this_ptr_conv.is_owned = false;
69402         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
69403         return ret_conv;
69404 }
69405
69406 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
69407         LDKChannelUpdateInfo this_ptr_conv;
69408         this_ptr_conv.inner = untag_ptr(this_ptr);
69409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69411         this_ptr_conv.is_owned = false;
69412         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
69413 }
69414
69415 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
69416         LDKChannelUpdateInfo this_ptr_conv;
69417         this_ptr_conv.inner = untag_ptr(this_ptr);
69418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69420         this_ptr_conv.is_owned = false;
69421         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
69422         return ret_conv;
69423 }
69424
69425 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
69426         LDKChannelUpdateInfo this_ptr_conv;
69427         this_ptr_conv.inner = untag_ptr(this_ptr);
69428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69430         this_ptr_conv.is_owned = false;
69431         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
69432 }
69433
69434 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
69435         LDKChannelUpdateInfo this_ptr_conv;
69436         this_ptr_conv.inner = untag_ptr(this_ptr);
69437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69439         this_ptr_conv.is_owned = false;
69440         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
69441         return ret_conv;
69442 }
69443
69444 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
69445         LDKChannelUpdateInfo this_ptr_conv;
69446         this_ptr_conv.inner = untag_ptr(this_ptr);
69447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69449         this_ptr_conv.is_owned = false;
69450         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
69451 }
69452
69453 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
69454         LDKChannelUpdateInfo this_ptr_conv;
69455         this_ptr_conv.inner = untag_ptr(this_ptr);
69456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69458         this_ptr_conv.is_owned = false;
69459         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
69460         return ret_conv;
69461 }
69462
69463 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
69464         LDKChannelUpdateInfo this_ptr_conv;
69465         this_ptr_conv.inner = untag_ptr(this_ptr);
69466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69468         this_ptr_conv.is_owned = false;
69469         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
69470 }
69471
69472 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
69473         LDKChannelUpdateInfo this_ptr_conv;
69474         this_ptr_conv.inner = untag_ptr(this_ptr);
69475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69477         this_ptr_conv.is_owned = false;
69478         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
69479         uint64_t ret_ref = 0;
69480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69482         return ret_ref;
69483 }
69484
69485 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
69486         LDKChannelUpdateInfo this_ptr_conv;
69487         this_ptr_conv.inner = untag_ptr(this_ptr);
69488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69490         this_ptr_conv.is_owned = false;
69491         LDKRoutingFees val_conv;
69492         val_conv.inner = untag_ptr(val);
69493         val_conv.is_owned = ptr_is_owned(val);
69494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69495         val_conv = RoutingFees_clone(&val_conv);
69496         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
69497 }
69498
69499 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
69500         LDKChannelUpdateInfo this_ptr_conv;
69501         this_ptr_conv.inner = untag_ptr(this_ptr);
69502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69504         this_ptr_conv.is_owned = false;
69505         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
69506         uint64_t ret_ref = 0;
69507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69509         return ret_ref;
69510 }
69511
69512 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
69513         LDKChannelUpdateInfo this_ptr_conv;
69514         this_ptr_conv.inner = untag_ptr(this_ptr);
69515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69517         this_ptr_conv.is_owned = false;
69518         LDKChannelUpdate val_conv;
69519         val_conv.inner = untag_ptr(val);
69520         val_conv.is_owned = ptr_is_owned(val);
69521         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69522         val_conv = ChannelUpdate_clone(&val_conv);
69523         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
69524 }
69525
69526 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) {
69527         LDKRoutingFees fees_arg_conv;
69528         fees_arg_conv.inner = untag_ptr(fees_arg);
69529         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
69530         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
69531         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
69532         LDKChannelUpdate last_update_message_arg_conv;
69533         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
69534         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
69535         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
69536         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
69537         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);
69538         uint64_t ret_ref = 0;
69539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69541         return ret_ref;
69542 }
69543
69544 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
69545         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
69546         uint64_t ret_ref = 0;
69547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69549         return ret_ref;
69550 }
69551 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
69552         LDKChannelUpdateInfo arg_conv;
69553         arg_conv.inner = untag_ptr(arg);
69554         arg_conv.is_owned = ptr_is_owned(arg);
69555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69556         arg_conv.is_owned = false;
69557         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
69558         return ret_conv;
69559 }
69560
69561 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
69562         LDKChannelUpdateInfo orig_conv;
69563         orig_conv.inner = untag_ptr(orig);
69564         orig_conv.is_owned = ptr_is_owned(orig);
69565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69566         orig_conv.is_owned = false;
69567         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
69568         uint64_t ret_ref = 0;
69569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69571         return ret_ref;
69572 }
69573
69574 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
69575         LDKChannelUpdateInfo a_conv;
69576         a_conv.inner = untag_ptr(a);
69577         a_conv.is_owned = ptr_is_owned(a);
69578         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69579         a_conv.is_owned = false;
69580         LDKChannelUpdateInfo b_conv;
69581         b_conv.inner = untag_ptr(b);
69582         b_conv.is_owned = ptr_is_owned(b);
69583         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69584         b_conv.is_owned = false;
69585         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
69586         return ret_conv;
69587 }
69588
69589 jstring  __attribute__((export_name("TS_ChannelUpdateInfo_to_str"))) TS_ChannelUpdateInfo_to_str(uint64_t o) {
69590         LDKChannelUpdateInfo o_conv;
69591         o_conv.inner = untag_ptr(o);
69592         o_conv.is_owned = ptr_is_owned(o);
69593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69594         o_conv.is_owned = false;
69595         LDKStr ret_str = ChannelUpdateInfo_to_str(&o_conv);
69596         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69597         Str_free(ret_str);
69598         return ret_conv;
69599 }
69600
69601 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
69602         LDKChannelUpdateInfo obj_conv;
69603         obj_conv.inner = untag_ptr(obj);
69604         obj_conv.is_owned = ptr_is_owned(obj);
69605         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69606         obj_conv.is_owned = false;
69607         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
69608         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69609         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69610         CVec_u8Z_free(ret_var);
69611         return ret_arr;
69612 }
69613
69614 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
69615         LDKu8slice ser_ref;
69616         ser_ref.datalen = ser->arr_len;
69617         ser_ref.data = ser->elems;
69618         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
69619         *ret_conv = ChannelUpdateInfo_read(ser_ref);
69620         FREE(ser);
69621         return tag_ptr(ret_conv, true);
69622 }
69623
69624 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
69625         LDKChannelInfo this_obj_conv;
69626         this_obj_conv.inner = untag_ptr(this_obj);
69627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69629         ChannelInfo_free(this_obj_conv);
69630 }
69631
69632 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
69633         LDKChannelInfo this_ptr_conv;
69634         this_ptr_conv.inner = untag_ptr(this_ptr);
69635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69637         this_ptr_conv.is_owned = false;
69638         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
69639         uint64_t ret_ref = 0;
69640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69642         return ret_ref;
69643 }
69644
69645 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
69646         LDKChannelInfo this_ptr_conv;
69647         this_ptr_conv.inner = untag_ptr(this_ptr);
69648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69650         this_ptr_conv.is_owned = false;
69651         LDKChannelFeatures val_conv;
69652         val_conv.inner = untag_ptr(val);
69653         val_conv.is_owned = ptr_is_owned(val);
69654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69655         val_conv = ChannelFeatures_clone(&val_conv);
69656         ChannelInfo_set_features(&this_ptr_conv, val_conv);
69657 }
69658
69659 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
69660         LDKChannelInfo this_ptr_conv;
69661         this_ptr_conv.inner = untag_ptr(this_ptr);
69662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69664         this_ptr_conv.is_owned = false;
69665         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
69666         uint64_t ret_ref = 0;
69667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69669         return ret_ref;
69670 }
69671
69672 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
69673         LDKChannelInfo this_ptr_conv;
69674         this_ptr_conv.inner = untag_ptr(this_ptr);
69675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69677         this_ptr_conv.is_owned = false;
69678         LDKNodeId val_conv;
69679         val_conv.inner = untag_ptr(val);
69680         val_conv.is_owned = ptr_is_owned(val);
69681         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69682         val_conv = NodeId_clone(&val_conv);
69683         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
69684 }
69685
69686 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
69687         LDKChannelInfo this_ptr_conv;
69688         this_ptr_conv.inner = untag_ptr(this_ptr);
69689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69691         this_ptr_conv.is_owned = false;
69692         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
69693         uint64_t ret_ref = 0;
69694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69696         return ret_ref;
69697 }
69698
69699 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
69700         LDKChannelInfo this_ptr_conv;
69701         this_ptr_conv.inner = untag_ptr(this_ptr);
69702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69704         this_ptr_conv.is_owned = false;
69705         LDKChannelUpdateInfo val_conv;
69706         val_conv.inner = untag_ptr(val);
69707         val_conv.is_owned = ptr_is_owned(val);
69708         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69709         val_conv = ChannelUpdateInfo_clone(&val_conv);
69710         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
69711 }
69712
69713 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
69714         LDKChannelInfo this_ptr_conv;
69715         this_ptr_conv.inner = untag_ptr(this_ptr);
69716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69718         this_ptr_conv.is_owned = false;
69719         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
69720         uint64_t ret_ref = 0;
69721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69723         return ret_ref;
69724 }
69725
69726 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
69727         LDKChannelInfo this_ptr_conv;
69728         this_ptr_conv.inner = untag_ptr(this_ptr);
69729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69731         this_ptr_conv.is_owned = false;
69732         LDKNodeId val_conv;
69733         val_conv.inner = untag_ptr(val);
69734         val_conv.is_owned = ptr_is_owned(val);
69735         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69736         val_conv = NodeId_clone(&val_conv);
69737         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
69738 }
69739
69740 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
69741         LDKChannelInfo this_ptr_conv;
69742         this_ptr_conv.inner = untag_ptr(this_ptr);
69743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69745         this_ptr_conv.is_owned = false;
69746         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
69747         uint64_t ret_ref = 0;
69748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69750         return ret_ref;
69751 }
69752
69753 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
69754         LDKChannelInfo this_ptr_conv;
69755         this_ptr_conv.inner = untag_ptr(this_ptr);
69756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69758         this_ptr_conv.is_owned = false;
69759         LDKChannelUpdateInfo val_conv;
69760         val_conv.inner = untag_ptr(val);
69761         val_conv.is_owned = ptr_is_owned(val);
69762         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69763         val_conv = ChannelUpdateInfo_clone(&val_conv);
69764         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
69765 }
69766
69767 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
69768         LDKChannelInfo this_ptr_conv;
69769         this_ptr_conv.inner = untag_ptr(this_ptr);
69770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69772         this_ptr_conv.is_owned = false;
69773         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69774         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
69775         uint64_t ret_ref = tag_ptr(ret_copy, true);
69776         return ret_ref;
69777 }
69778
69779 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
69780         LDKChannelInfo this_ptr_conv;
69781         this_ptr_conv.inner = untag_ptr(this_ptr);
69782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69784         this_ptr_conv.is_owned = false;
69785         void* val_ptr = untag_ptr(val);
69786         CHECK_ACCESS(val_ptr);
69787         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
69788         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
69789         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
69790 }
69791
69792 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
69793         LDKChannelInfo this_ptr_conv;
69794         this_ptr_conv.inner = untag_ptr(this_ptr);
69795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69797         this_ptr_conv.is_owned = false;
69798         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
69799         uint64_t ret_ref = 0;
69800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69802         return ret_ref;
69803 }
69804
69805 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
69806         LDKChannelInfo this_ptr_conv;
69807         this_ptr_conv.inner = untag_ptr(this_ptr);
69808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69810         this_ptr_conv.is_owned = false;
69811         LDKChannelAnnouncement val_conv;
69812         val_conv.inner = untag_ptr(val);
69813         val_conv.is_owned = ptr_is_owned(val);
69814         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69815         val_conv = ChannelAnnouncement_clone(&val_conv);
69816         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
69817 }
69818
69819 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
69820         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
69821         uint64_t ret_ref = 0;
69822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69824         return ret_ref;
69825 }
69826 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
69827         LDKChannelInfo arg_conv;
69828         arg_conv.inner = untag_ptr(arg);
69829         arg_conv.is_owned = ptr_is_owned(arg);
69830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69831         arg_conv.is_owned = false;
69832         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
69833         return ret_conv;
69834 }
69835
69836 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
69837         LDKChannelInfo orig_conv;
69838         orig_conv.inner = untag_ptr(orig);
69839         orig_conv.is_owned = ptr_is_owned(orig);
69840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69841         orig_conv.is_owned = false;
69842         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
69843         uint64_t ret_ref = 0;
69844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69846         return ret_ref;
69847 }
69848
69849 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
69850         LDKChannelInfo a_conv;
69851         a_conv.inner = untag_ptr(a);
69852         a_conv.is_owned = ptr_is_owned(a);
69853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69854         a_conv.is_owned = false;
69855         LDKChannelInfo b_conv;
69856         b_conv.inner = untag_ptr(b);
69857         b_conv.is_owned = ptr_is_owned(b);
69858         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69859         b_conv.is_owned = false;
69860         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
69861         return ret_conv;
69862 }
69863
69864 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
69865         LDKChannelInfo this_arg_conv;
69866         this_arg_conv.inner = untag_ptr(this_arg);
69867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69869         this_arg_conv.is_owned = false;
69870         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
69871         uint64_t ret_ref = 0;
69872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69874         return ret_ref;
69875 }
69876
69877 jstring  __attribute__((export_name("TS_ChannelInfo_to_str"))) TS_ChannelInfo_to_str(uint64_t o) {
69878         LDKChannelInfo o_conv;
69879         o_conv.inner = untag_ptr(o);
69880         o_conv.is_owned = ptr_is_owned(o);
69881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69882         o_conv.is_owned = false;
69883         LDKStr ret_str = ChannelInfo_to_str(&o_conv);
69884         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
69885         Str_free(ret_str);
69886         return ret_conv;
69887 }
69888
69889 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
69890         LDKChannelInfo obj_conv;
69891         obj_conv.inner = untag_ptr(obj);
69892         obj_conv.is_owned = ptr_is_owned(obj);
69893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69894         obj_conv.is_owned = false;
69895         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
69896         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69897         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69898         CVec_u8Z_free(ret_var);
69899         return ret_arr;
69900 }
69901
69902 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
69903         LDKu8slice ser_ref;
69904         ser_ref.datalen = ser->arr_len;
69905         ser_ref.data = ser->elems;
69906         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
69907         *ret_conv = ChannelInfo_read(ser_ref);
69908         FREE(ser);
69909         return tag_ptr(ret_conv, true);
69910 }
69911
69912 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
69913         LDKDirectedChannelInfo this_obj_conv;
69914         this_obj_conv.inner = untag_ptr(this_obj);
69915         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69917         DirectedChannelInfo_free(this_obj_conv);
69918 }
69919
69920 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
69921         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
69922         uint64_t ret_ref = 0;
69923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69925         return ret_ref;
69926 }
69927 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
69928         LDKDirectedChannelInfo arg_conv;
69929         arg_conv.inner = untag_ptr(arg);
69930         arg_conv.is_owned = ptr_is_owned(arg);
69931         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69932         arg_conv.is_owned = false;
69933         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
69934         return ret_conv;
69935 }
69936
69937 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
69938         LDKDirectedChannelInfo orig_conv;
69939         orig_conv.inner = untag_ptr(orig);
69940         orig_conv.is_owned = ptr_is_owned(orig);
69941         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69942         orig_conv.is_owned = false;
69943         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
69944         uint64_t ret_ref = 0;
69945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69947         return ret_ref;
69948 }
69949
69950 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
69951         LDKDirectedChannelInfo this_arg_conv;
69952         this_arg_conv.inner = untag_ptr(this_arg);
69953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69955         this_arg_conv.is_owned = false;
69956         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
69957         uint64_t ret_ref = 0;
69958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69960         return ret_ref;
69961 }
69962
69963 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
69964         LDKDirectedChannelInfo this_arg_conv;
69965         this_arg_conv.inner = untag_ptr(this_arg);
69966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69968         this_arg_conv.is_owned = false;
69969         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69970         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
69971         uint64_t ret_ref = tag_ptr(ret_copy, true);
69972         return ret_ref;
69973 }
69974
69975 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_source"))) TS_DirectedChannelInfo_source(uint64_t this_arg) {
69976         LDKDirectedChannelInfo this_arg_conv;
69977         this_arg_conv.inner = untag_ptr(this_arg);
69978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69980         this_arg_conv.is_owned = false;
69981         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
69982         uint64_t ret_ref = 0;
69983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69985         return ret_ref;
69986 }
69987
69988 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_target"))) TS_DirectedChannelInfo_target(uint64_t this_arg) {
69989         LDKDirectedChannelInfo this_arg_conv;
69990         this_arg_conv.inner = untag_ptr(this_arg);
69991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69993         this_arg_conv.is_owned = false;
69994         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
69995         uint64_t ret_ref = 0;
69996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69998         return ret_ref;
69999 }
70000
70001 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
70002         if (!ptr_is_owned(this_ptr)) return;
70003         void* this_ptr_ptr = untag_ptr(this_ptr);
70004         CHECK_ACCESS(this_ptr_ptr);
70005         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
70006         FREE(untag_ptr(this_ptr));
70007         EffectiveCapacity_free(this_ptr_conv);
70008 }
70009
70010 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
70011         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70012         *ret_copy = EffectiveCapacity_clone(arg);
70013         uint64_t ret_ref = tag_ptr(ret_copy, true);
70014         return ret_ref;
70015 }
70016 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
70017         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
70018         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
70019         return ret_conv;
70020 }
70021
70022 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
70023         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
70024         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70025         *ret_copy = EffectiveCapacity_clone(orig_conv);
70026         uint64_t ret_ref = tag_ptr(ret_copy, true);
70027         return ret_ref;
70028 }
70029
70030 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
70031         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70032         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
70033         uint64_t ret_ref = tag_ptr(ret_copy, true);
70034         return ret_ref;
70035 }
70036
70037 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
70038         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70039         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
70040         uint64_t ret_ref = tag_ptr(ret_copy, true);
70041         return ret_ref;
70042 }
70043
70044 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
70045         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70046         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
70047         uint64_t ret_ref = tag_ptr(ret_copy, true);
70048         return ret_ref;
70049 }
70050
70051 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
70052         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70053         *ret_copy = EffectiveCapacity_infinite();
70054         uint64_t ret_ref = tag_ptr(ret_copy, true);
70055         return ret_ref;
70056 }
70057
70058 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
70059         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70060         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
70061         uint64_t ret_ref = tag_ptr(ret_copy, true);
70062         return ret_ref;
70063 }
70064
70065 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
70066         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70067         *ret_copy = EffectiveCapacity_unknown();
70068         uint64_t ret_ref = tag_ptr(ret_copy, true);
70069         return ret_ref;
70070 }
70071
70072 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
70073         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
70074         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
70075         return ret_conv;
70076 }
70077
70078 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
70079         LDKRoutingFees this_obj_conv;
70080         this_obj_conv.inner = untag_ptr(this_obj);
70081         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70083         RoutingFees_free(this_obj_conv);
70084 }
70085
70086 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
70087         LDKRoutingFees this_ptr_conv;
70088         this_ptr_conv.inner = untag_ptr(this_ptr);
70089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70091         this_ptr_conv.is_owned = false;
70092         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
70093         return ret_conv;
70094 }
70095
70096 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
70097         LDKRoutingFees this_ptr_conv;
70098         this_ptr_conv.inner = untag_ptr(this_ptr);
70099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70101         this_ptr_conv.is_owned = false;
70102         RoutingFees_set_base_msat(&this_ptr_conv, val);
70103 }
70104
70105 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
70106         LDKRoutingFees this_ptr_conv;
70107         this_ptr_conv.inner = untag_ptr(this_ptr);
70108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70110         this_ptr_conv.is_owned = false;
70111         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
70112         return ret_conv;
70113 }
70114
70115 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
70116         LDKRoutingFees this_ptr_conv;
70117         this_ptr_conv.inner = untag_ptr(this_ptr);
70118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70120         this_ptr_conv.is_owned = false;
70121         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
70122 }
70123
70124 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
70125         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
70126         uint64_t ret_ref = 0;
70127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70129         return ret_ref;
70130 }
70131
70132 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
70133         LDKRoutingFees a_conv;
70134         a_conv.inner = untag_ptr(a);
70135         a_conv.is_owned = ptr_is_owned(a);
70136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70137         a_conv.is_owned = false;
70138         LDKRoutingFees b_conv;
70139         b_conv.inner = untag_ptr(b);
70140         b_conv.is_owned = ptr_is_owned(b);
70141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70142         b_conv.is_owned = false;
70143         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
70144         return ret_conv;
70145 }
70146
70147 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
70148         LDKRoutingFees ret_var = RoutingFees_clone(arg);
70149         uint64_t ret_ref = 0;
70150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70152         return ret_ref;
70153 }
70154 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
70155         LDKRoutingFees arg_conv;
70156         arg_conv.inner = untag_ptr(arg);
70157         arg_conv.is_owned = ptr_is_owned(arg);
70158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70159         arg_conv.is_owned = false;
70160         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
70161         return ret_conv;
70162 }
70163
70164 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
70165         LDKRoutingFees orig_conv;
70166         orig_conv.inner = untag_ptr(orig);
70167         orig_conv.is_owned = ptr_is_owned(orig);
70168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70169         orig_conv.is_owned = false;
70170         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
70171         uint64_t ret_ref = 0;
70172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70174         return ret_ref;
70175 }
70176
70177 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
70178         LDKRoutingFees o_conv;
70179         o_conv.inner = untag_ptr(o);
70180         o_conv.is_owned = ptr_is_owned(o);
70181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70182         o_conv.is_owned = false;
70183         int64_t ret_conv = RoutingFees_hash(&o_conv);
70184         return ret_conv;
70185 }
70186
70187 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
70188         LDKRoutingFees obj_conv;
70189         obj_conv.inner = untag_ptr(obj);
70190         obj_conv.is_owned = ptr_is_owned(obj);
70191         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70192         obj_conv.is_owned = false;
70193         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
70194         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70195         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70196         CVec_u8Z_free(ret_var);
70197         return ret_arr;
70198 }
70199
70200 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
70201         LDKu8slice ser_ref;
70202         ser_ref.datalen = ser->arr_len;
70203         ser_ref.data = ser->elems;
70204         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
70205         *ret_conv = RoutingFees_read(ser_ref);
70206         FREE(ser);
70207         return tag_ptr(ret_conv, true);
70208 }
70209
70210 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
70211         LDKNodeAnnouncementInfo this_obj_conv;
70212         this_obj_conv.inner = untag_ptr(this_obj);
70213         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70215         NodeAnnouncementInfo_free(this_obj_conv);
70216 }
70217
70218 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
70219         LDKNodeAnnouncementInfo this_ptr_conv;
70220         this_ptr_conv.inner = untag_ptr(this_ptr);
70221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70223         this_ptr_conv.is_owned = false;
70224         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
70225         uint64_t ret_ref = 0;
70226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70228         return ret_ref;
70229 }
70230
70231 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
70232         LDKNodeAnnouncementInfo this_ptr_conv;
70233         this_ptr_conv.inner = untag_ptr(this_ptr);
70234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70236         this_ptr_conv.is_owned = false;
70237         LDKNodeFeatures val_conv;
70238         val_conv.inner = untag_ptr(val);
70239         val_conv.is_owned = ptr_is_owned(val);
70240         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70241         val_conv = NodeFeatures_clone(&val_conv);
70242         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
70243 }
70244
70245 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
70246         LDKNodeAnnouncementInfo this_ptr_conv;
70247         this_ptr_conv.inner = untag_ptr(this_ptr);
70248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70250         this_ptr_conv.is_owned = false;
70251         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
70252         return ret_conv;
70253 }
70254
70255 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
70256         LDKNodeAnnouncementInfo this_ptr_conv;
70257         this_ptr_conv.inner = untag_ptr(this_ptr);
70258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70260         this_ptr_conv.is_owned = false;
70261         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
70262 }
70263
70264 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
70265         LDKNodeAnnouncementInfo this_ptr_conv;
70266         this_ptr_conv.inner = untag_ptr(this_ptr);
70267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70269         this_ptr_conv.is_owned = false;
70270         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
70271         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
70272         return ret_arr;
70273 }
70274
70275 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
70276         LDKNodeAnnouncementInfo this_ptr_conv;
70277         this_ptr_conv.inner = untag_ptr(this_ptr);
70278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70280         this_ptr_conv.is_owned = false;
70281         LDKThreeBytes val_ref;
70282         CHECK(val->arr_len == 3);
70283         memcpy(val_ref.data, val->elems, 3); FREE(val);
70284         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
70285 }
70286
70287 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
70288         LDKNodeAnnouncementInfo this_ptr_conv;
70289         this_ptr_conv.inner = untag_ptr(this_ptr);
70290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70292         this_ptr_conv.is_owned = false;
70293         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
70294         uint64_t ret_ref = 0;
70295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70297         return ret_ref;
70298 }
70299
70300 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
70301         LDKNodeAnnouncementInfo this_ptr_conv;
70302         this_ptr_conv.inner = untag_ptr(this_ptr);
70303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70305         this_ptr_conv.is_owned = false;
70306         LDKNodeAlias val_conv;
70307         val_conv.inner = untag_ptr(val);
70308         val_conv.is_owned = ptr_is_owned(val);
70309         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70310         val_conv = NodeAlias_clone(&val_conv);
70311         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
70312 }
70313
70314 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
70315         LDKNodeAnnouncementInfo this_ptr_conv;
70316         this_ptr_conv.inner = untag_ptr(this_ptr);
70317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70319         this_ptr_conv.is_owned = false;
70320         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
70321         uint64_t ret_ref = 0;
70322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70324         return ret_ref;
70325 }
70326
70327 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
70328         LDKNodeAnnouncementInfo this_ptr_conv;
70329         this_ptr_conv.inner = untag_ptr(this_ptr);
70330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70332         this_ptr_conv.is_owned = false;
70333         LDKNodeAnnouncement val_conv;
70334         val_conv.inner = untag_ptr(val);
70335         val_conv.is_owned = ptr_is_owned(val);
70336         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70337         val_conv = NodeAnnouncement_clone(&val_conv);
70338         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
70339 }
70340
70341 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) {
70342         LDKNodeFeatures features_arg_conv;
70343         features_arg_conv.inner = untag_ptr(features_arg);
70344         features_arg_conv.is_owned = ptr_is_owned(features_arg);
70345         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
70346         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
70347         LDKThreeBytes rgb_arg_ref;
70348         CHECK(rgb_arg->arr_len == 3);
70349         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
70350         LDKNodeAlias alias_arg_conv;
70351         alias_arg_conv.inner = untag_ptr(alias_arg);
70352         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
70353         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
70354         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
70355         LDKNodeAnnouncement announcement_message_arg_conv;
70356         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
70357         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
70358         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
70359         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
70360         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
70361         uint64_t ret_ref = 0;
70362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70364         return ret_ref;
70365 }
70366
70367 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
70368         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
70369         uint64_t ret_ref = 0;
70370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70372         return ret_ref;
70373 }
70374 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
70375         LDKNodeAnnouncementInfo arg_conv;
70376         arg_conv.inner = untag_ptr(arg);
70377         arg_conv.is_owned = ptr_is_owned(arg);
70378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70379         arg_conv.is_owned = false;
70380         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
70381         return ret_conv;
70382 }
70383
70384 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
70385         LDKNodeAnnouncementInfo orig_conv;
70386         orig_conv.inner = untag_ptr(orig);
70387         orig_conv.is_owned = ptr_is_owned(orig);
70388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70389         orig_conv.is_owned = false;
70390         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
70391         uint64_t ret_ref = 0;
70392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70394         return ret_ref;
70395 }
70396
70397 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
70398         LDKNodeAnnouncementInfo a_conv;
70399         a_conv.inner = untag_ptr(a);
70400         a_conv.is_owned = ptr_is_owned(a);
70401         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70402         a_conv.is_owned = false;
70403         LDKNodeAnnouncementInfo b_conv;
70404         b_conv.inner = untag_ptr(b);
70405         b_conv.is_owned = ptr_is_owned(b);
70406         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70407         b_conv.is_owned = false;
70408         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
70409         return ret_conv;
70410 }
70411
70412 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
70413         LDKNodeAnnouncementInfo this_arg_conv;
70414         this_arg_conv.inner = untag_ptr(this_arg);
70415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70417         this_arg_conv.is_owned = false;
70418         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
70419         uint64_tArray ret_arr = NULL;
70420         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
70421         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
70422         for (size_t p = 0; p < ret_var.datalen; p++) {
70423                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
70424                 *ret_conv_15_copy = ret_var.data[p];
70425                 uint64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
70426                 ret_arr_ptr[p] = ret_conv_15_ref;
70427         }
70428         
70429         FREE(ret_var.data);
70430         return ret_arr;
70431 }
70432
70433 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
70434         LDKNodeAnnouncementInfo obj_conv;
70435         obj_conv.inner = untag_ptr(obj);
70436         obj_conv.is_owned = ptr_is_owned(obj);
70437         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70438         obj_conv.is_owned = false;
70439         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
70440         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70441         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70442         CVec_u8Z_free(ret_var);
70443         return ret_arr;
70444 }
70445
70446 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
70447         LDKu8slice ser_ref;
70448         ser_ref.datalen = ser->arr_len;
70449         ser_ref.data = ser->elems;
70450         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
70451         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
70452         FREE(ser);
70453         return tag_ptr(ret_conv, true);
70454 }
70455
70456 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
70457         LDKNodeAlias this_obj_conv;
70458         this_obj_conv.inner = untag_ptr(this_obj);
70459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70461         NodeAlias_free(this_obj_conv);
70462 }
70463
70464 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
70465         LDKNodeAlias this_ptr_conv;
70466         this_ptr_conv.inner = untag_ptr(this_ptr);
70467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70469         this_ptr_conv.is_owned = false;
70470         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
70471         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
70472         return ret_arr;
70473 }
70474
70475 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
70476         LDKNodeAlias this_ptr_conv;
70477         this_ptr_conv.inner = untag_ptr(this_ptr);
70478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70480         this_ptr_conv.is_owned = false;
70481         LDKThirtyTwoBytes val_ref;
70482         CHECK(val->arr_len == 32);
70483         memcpy(val_ref.data, val->elems, 32); FREE(val);
70484         NodeAlias_set_a(&this_ptr_conv, val_ref);
70485 }
70486
70487 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
70488         LDKThirtyTwoBytes a_arg_ref;
70489         CHECK(a_arg->arr_len == 32);
70490         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
70491         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
70492         uint64_t ret_ref = 0;
70493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70495         return ret_ref;
70496 }
70497
70498 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
70499         LDKNodeAlias ret_var = NodeAlias_clone(arg);
70500         uint64_t ret_ref = 0;
70501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70503         return ret_ref;
70504 }
70505 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
70506         LDKNodeAlias arg_conv;
70507         arg_conv.inner = untag_ptr(arg);
70508         arg_conv.is_owned = ptr_is_owned(arg);
70509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70510         arg_conv.is_owned = false;
70511         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
70512         return ret_conv;
70513 }
70514
70515 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
70516         LDKNodeAlias orig_conv;
70517         orig_conv.inner = untag_ptr(orig);
70518         orig_conv.is_owned = ptr_is_owned(orig);
70519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70520         orig_conv.is_owned = false;
70521         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
70522         uint64_t ret_ref = 0;
70523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70525         return ret_ref;
70526 }
70527
70528 int64_t  __attribute__((export_name("TS_NodeAlias_hash"))) TS_NodeAlias_hash(uint64_t o) {
70529         LDKNodeAlias o_conv;
70530         o_conv.inner = untag_ptr(o);
70531         o_conv.is_owned = ptr_is_owned(o);
70532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70533         o_conv.is_owned = false;
70534         int64_t ret_conv = NodeAlias_hash(&o_conv);
70535         return ret_conv;
70536 }
70537
70538 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
70539         LDKNodeAlias a_conv;
70540         a_conv.inner = untag_ptr(a);
70541         a_conv.is_owned = ptr_is_owned(a);
70542         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70543         a_conv.is_owned = false;
70544         LDKNodeAlias b_conv;
70545         b_conv.inner = untag_ptr(b);
70546         b_conv.is_owned = ptr_is_owned(b);
70547         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70548         b_conv.is_owned = false;
70549         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
70550         return ret_conv;
70551 }
70552
70553 jstring  __attribute__((export_name("TS_NodeAlias_to_str"))) TS_NodeAlias_to_str(uint64_t o) {
70554         LDKNodeAlias o_conv;
70555         o_conv.inner = untag_ptr(o);
70556         o_conv.is_owned = ptr_is_owned(o);
70557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70558         o_conv.is_owned = false;
70559         LDKStr ret_str = NodeAlias_to_str(&o_conv);
70560         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70561         Str_free(ret_str);
70562         return ret_conv;
70563 }
70564
70565 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
70566         LDKNodeAlias obj_conv;
70567         obj_conv.inner = untag_ptr(obj);
70568         obj_conv.is_owned = ptr_is_owned(obj);
70569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70570         obj_conv.is_owned = false;
70571         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
70572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70574         CVec_u8Z_free(ret_var);
70575         return ret_arr;
70576 }
70577
70578 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
70579         LDKu8slice ser_ref;
70580         ser_ref.datalen = ser->arr_len;
70581         ser_ref.data = ser->elems;
70582         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
70583         *ret_conv = NodeAlias_read(ser_ref);
70584         FREE(ser);
70585         return tag_ptr(ret_conv, true);
70586 }
70587
70588 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
70589         LDKNodeInfo this_obj_conv;
70590         this_obj_conv.inner = untag_ptr(this_obj);
70591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70593         NodeInfo_free(this_obj_conv);
70594 }
70595
70596 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
70597         LDKNodeInfo this_ptr_conv;
70598         this_ptr_conv.inner = untag_ptr(this_ptr);
70599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70601         this_ptr_conv.is_owned = false;
70602         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
70603         int64_tArray ret_arr = NULL;
70604         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70605         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70606         for (size_t i = 0; i < ret_var.datalen; i++) {
70607                 int64_t ret_conv_8_conv = ret_var.data[i];
70608                 ret_arr_ptr[i] = ret_conv_8_conv;
70609         }
70610         
70611         FREE(ret_var.data);
70612         return ret_arr;
70613 }
70614
70615 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
70616         LDKNodeInfo this_ptr_conv;
70617         this_ptr_conv.inner = untag_ptr(this_ptr);
70618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70620         this_ptr_conv.is_owned = false;
70621         LDKCVec_u64Z val_constr;
70622         val_constr.datalen = val->arr_len;
70623         if (val_constr.datalen > 0)
70624                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
70625         else
70626                 val_constr.data = NULL;
70627         int64_t* val_vals = val->elems;
70628         for (size_t i = 0; i < val_constr.datalen; i++) {
70629                 int64_t val_conv_8 = val_vals[i];
70630                 val_constr.data[i] = val_conv_8;
70631         }
70632         FREE(val);
70633         NodeInfo_set_channels(&this_ptr_conv, val_constr);
70634 }
70635
70636 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
70637         LDKNodeInfo this_ptr_conv;
70638         this_ptr_conv.inner = untag_ptr(this_ptr);
70639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70641         this_ptr_conv.is_owned = false;
70642         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
70643         uint64_t ret_ref = 0;
70644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70646         return ret_ref;
70647 }
70648
70649 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
70650         LDKNodeInfo this_ptr_conv;
70651         this_ptr_conv.inner = untag_ptr(this_ptr);
70652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70654         this_ptr_conv.is_owned = false;
70655         LDKNodeAnnouncementInfo val_conv;
70656         val_conv.inner = untag_ptr(val);
70657         val_conv.is_owned = ptr_is_owned(val);
70658         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70659         val_conv = NodeAnnouncementInfo_clone(&val_conv);
70660         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
70661 }
70662
70663 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
70664         LDKCVec_u64Z channels_arg_constr;
70665         channels_arg_constr.datalen = channels_arg->arr_len;
70666         if (channels_arg_constr.datalen > 0)
70667                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
70668         else
70669                 channels_arg_constr.data = NULL;
70670         int64_t* channels_arg_vals = channels_arg->elems;
70671         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
70672                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
70673                 channels_arg_constr.data[i] = channels_arg_conv_8;
70674         }
70675         FREE(channels_arg);
70676         LDKNodeAnnouncementInfo announcement_info_arg_conv;
70677         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
70678         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
70679         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
70680         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
70681         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
70682         uint64_t ret_ref = 0;
70683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70685         return ret_ref;
70686 }
70687
70688 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
70689         LDKNodeInfo ret_var = NodeInfo_clone(arg);
70690         uint64_t ret_ref = 0;
70691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70693         return ret_ref;
70694 }
70695 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
70696         LDKNodeInfo arg_conv;
70697         arg_conv.inner = untag_ptr(arg);
70698         arg_conv.is_owned = ptr_is_owned(arg);
70699         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70700         arg_conv.is_owned = false;
70701         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
70702         return ret_conv;
70703 }
70704
70705 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
70706         LDKNodeInfo orig_conv;
70707         orig_conv.inner = untag_ptr(orig);
70708         orig_conv.is_owned = ptr_is_owned(orig);
70709         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70710         orig_conv.is_owned = false;
70711         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
70712         uint64_t ret_ref = 0;
70713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70715         return ret_ref;
70716 }
70717
70718 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
70719         LDKNodeInfo a_conv;
70720         a_conv.inner = untag_ptr(a);
70721         a_conv.is_owned = ptr_is_owned(a);
70722         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70723         a_conv.is_owned = false;
70724         LDKNodeInfo b_conv;
70725         b_conv.inner = untag_ptr(b);
70726         b_conv.is_owned = ptr_is_owned(b);
70727         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70728         b_conv.is_owned = false;
70729         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
70730         return ret_conv;
70731 }
70732
70733 jboolean  __attribute__((export_name("TS_NodeInfo_is_tor_only"))) TS_NodeInfo_is_tor_only(uint64_t this_arg) {
70734         LDKNodeInfo this_arg_conv;
70735         this_arg_conv.inner = untag_ptr(this_arg);
70736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70738         this_arg_conv.is_owned = false;
70739         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
70740         return ret_conv;
70741 }
70742
70743 jstring  __attribute__((export_name("TS_NodeInfo_to_str"))) TS_NodeInfo_to_str(uint64_t o) {
70744         LDKNodeInfo o_conv;
70745         o_conv.inner = untag_ptr(o);
70746         o_conv.is_owned = ptr_is_owned(o);
70747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70748         o_conv.is_owned = false;
70749         LDKStr ret_str = NodeInfo_to_str(&o_conv);
70750         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70751         Str_free(ret_str);
70752         return ret_conv;
70753 }
70754
70755 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
70756         LDKNodeInfo obj_conv;
70757         obj_conv.inner = untag_ptr(obj);
70758         obj_conv.is_owned = ptr_is_owned(obj);
70759         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70760         obj_conv.is_owned = false;
70761         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
70762         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70763         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70764         CVec_u8Z_free(ret_var);
70765         return ret_arr;
70766 }
70767
70768 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
70769         LDKu8slice ser_ref;
70770         ser_ref.datalen = ser->arr_len;
70771         ser_ref.data = ser->elems;
70772         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
70773         *ret_conv = NodeInfo_read(ser_ref);
70774         FREE(ser);
70775         return tag_ptr(ret_conv, true);
70776 }
70777
70778 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
70779         LDKNetworkGraph obj_conv;
70780         obj_conv.inner = untag_ptr(obj);
70781         obj_conv.is_owned = ptr_is_owned(obj);
70782         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70783         obj_conv.is_owned = false;
70784         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
70785         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70786         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70787         CVec_u8Z_free(ret_var);
70788         return ret_arr;
70789 }
70790
70791 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
70792         LDKu8slice ser_ref;
70793         ser_ref.datalen = ser->arr_len;
70794         ser_ref.data = ser->elems;
70795         void* arg_ptr = untag_ptr(arg);
70796         CHECK_ACCESS(arg_ptr);
70797         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
70798         if (arg_conv.free == LDKLogger_JCalls_free) {
70799                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70800                 LDKLogger_JCalls_cloned(&arg_conv);
70801         }
70802         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
70803         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
70804         FREE(ser);
70805         return tag_ptr(ret_conv, true);
70806 }
70807
70808 jstring  __attribute__((export_name("TS_NetworkGraph_to_str"))) TS_NetworkGraph_to_str(uint64_t o) {
70809         LDKNetworkGraph o_conv;
70810         o_conv.inner = untag_ptr(o);
70811         o_conv.is_owned = ptr_is_owned(o);
70812         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70813         o_conv.is_owned = false;
70814         LDKStr ret_str = NetworkGraph_to_str(&o_conv);
70815         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
70816         Str_free(ret_str);
70817         return ret_conv;
70818 }
70819
70820 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
70821         LDKNetwork network_conv = LDKNetwork_from_js(network);
70822         void* logger_ptr = untag_ptr(logger);
70823         CHECK_ACCESS(logger_ptr);
70824         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70825         if (logger_conv.free == LDKLogger_JCalls_free) {
70826                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70827                 LDKLogger_JCalls_cloned(&logger_conv);
70828         }
70829         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
70830         uint64_t ret_ref = 0;
70831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70833         return ret_ref;
70834 }
70835
70836 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
70837         LDKNetworkGraph this_arg_conv;
70838         this_arg_conv.inner = untag_ptr(this_arg);
70839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70841         this_arg_conv.is_owned = false;
70842         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
70843         uint64_t ret_ref = 0;
70844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70846         return ret_ref;
70847 }
70848
70849 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) {
70850         LDKNetworkGraph this_arg_conv;
70851         this_arg_conv.inner = untag_ptr(this_arg);
70852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70854         this_arg_conv.is_owned = false;
70855         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
70856         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
70857         uint64_t ret_ref = tag_ptr(ret_copy, true);
70858         return ret_ref;
70859 }
70860
70861 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) {
70862         LDKNetworkGraph this_arg_conv;
70863         this_arg_conv.inner = untag_ptr(this_arg);
70864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70866         this_arg_conv.is_owned = false;
70867         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
70868 }
70869
70870 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
70871         LDKNetworkGraph this_arg_conv;
70872         this_arg_conv.inner = untag_ptr(this_arg);
70873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70875         this_arg_conv.is_owned = false;
70876         LDKNodeAnnouncement msg_conv;
70877         msg_conv.inner = untag_ptr(msg);
70878         msg_conv.is_owned = ptr_is_owned(msg);
70879         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70880         msg_conv.is_owned = false;
70881         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70882         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
70883         return tag_ptr(ret_conv, true);
70884 }
70885
70886 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) {
70887         LDKNetworkGraph this_arg_conv;
70888         this_arg_conv.inner = untag_ptr(this_arg);
70889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70891         this_arg_conv.is_owned = false;
70892         LDKUnsignedNodeAnnouncement msg_conv;
70893         msg_conv.inner = untag_ptr(msg);
70894         msg_conv.is_owned = ptr_is_owned(msg);
70895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70896         msg_conv.is_owned = false;
70897         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70898         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
70899         return tag_ptr(ret_conv, true);
70900 }
70901
70902 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) {
70903         LDKNetworkGraph this_arg_conv;
70904         this_arg_conv.inner = untag_ptr(this_arg);
70905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70907         this_arg_conv.is_owned = false;
70908         LDKChannelAnnouncement msg_conv;
70909         msg_conv.inner = untag_ptr(msg);
70910         msg_conv.is_owned = ptr_is_owned(msg);
70911         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70912         msg_conv.is_owned = false;
70913         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
70914         CHECK_ACCESS(utxo_lookup_ptr);
70915         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
70916         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
70917         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
70918                 // Manually implement clone for Java trait instances
70919                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
70920                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70921                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
70922                 }
70923         }
70924         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70925         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
70926         return tag_ptr(ret_conv, true);
70927 }
70928
70929 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) {
70930         LDKNetworkGraph this_arg_conv;
70931         this_arg_conv.inner = untag_ptr(this_arg);
70932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70934         this_arg_conv.is_owned = false;
70935         LDKChannelAnnouncement msg_conv;
70936         msg_conv.inner = untag_ptr(msg);
70937         msg_conv.is_owned = ptr_is_owned(msg);
70938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70939         msg_conv.is_owned = false;
70940         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70941         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
70942         return tag_ptr(ret_conv, true);
70943 }
70944
70945 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) {
70946         LDKNetworkGraph this_arg_conv;
70947         this_arg_conv.inner = untag_ptr(this_arg);
70948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70950         this_arg_conv.is_owned = false;
70951         LDKUnsignedChannelAnnouncement msg_conv;
70952         msg_conv.inner = untag_ptr(msg);
70953         msg_conv.is_owned = ptr_is_owned(msg);
70954         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70955         msg_conv.is_owned = false;
70956         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
70957         CHECK_ACCESS(utxo_lookup_ptr);
70958         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
70959         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
70960         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
70961                 // Manually implement clone for Java trait instances
70962                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
70963                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70964                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
70965                 }
70966         }
70967         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70968         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
70969         return tag_ptr(ret_conv, true);
70970 }
70971
70972 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) {
70973         LDKNetworkGraph this_arg_conv;
70974         this_arg_conv.inner = untag_ptr(this_arg);
70975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70977         this_arg_conv.is_owned = false;
70978         LDKChannelFeatures features_conv;
70979         features_conv.inner = untag_ptr(features);
70980         features_conv.is_owned = ptr_is_owned(features);
70981         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
70982         features_conv = ChannelFeatures_clone(&features_conv);
70983         LDKPublicKey node_id_1_ref;
70984         CHECK(node_id_1->arr_len == 33);
70985         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
70986         LDKPublicKey node_id_2_ref;
70987         CHECK(node_id_2->arr_len == 33);
70988         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
70989         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70990         *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);
70991         return tag_ptr(ret_conv, true);
70992 }
70993
70994 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
70995         LDKNetworkGraph this_arg_conv;
70996         this_arg_conv.inner = untag_ptr(this_arg);
70997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70999         this_arg_conv.is_owned = false;
71000         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
71001 }
71002
71003 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
71004         LDKNetworkGraph this_arg_conv;
71005         this_arg_conv.inner = untag_ptr(this_arg);
71006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71008         this_arg_conv.is_owned = false;
71009         LDKPublicKey node_id_ref;
71010         CHECK(node_id->arr_len == 33);
71011         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
71012         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
71013 }
71014
71015 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) {
71016         LDKNetworkGraph this_arg_conv;
71017         this_arg_conv.inner = untag_ptr(this_arg);
71018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71020         this_arg_conv.is_owned = false;
71021         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
71022 }
71023
71024 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
71025         LDKNetworkGraph this_arg_conv;
71026         this_arg_conv.inner = untag_ptr(this_arg);
71027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71029         this_arg_conv.is_owned = false;
71030         LDKChannelUpdate msg_conv;
71031         msg_conv.inner = untag_ptr(msg);
71032         msg_conv.is_owned = ptr_is_owned(msg);
71033         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71034         msg_conv.is_owned = false;
71035         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71036         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
71037         return tag_ptr(ret_conv, true);
71038 }
71039
71040 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
71041         LDKNetworkGraph this_arg_conv;
71042         this_arg_conv.inner = untag_ptr(this_arg);
71043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71045         this_arg_conv.is_owned = false;
71046         LDKUnsignedChannelUpdate msg_conv;
71047         msg_conv.inner = untag_ptr(msg);
71048         msg_conv.is_owned = ptr_is_owned(msg);
71049         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71050         msg_conv.is_owned = false;
71051         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71052         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
71053         return tag_ptr(ret_conv, true);
71054 }
71055
71056 uint64_t  __attribute__((export_name("TS_NetworkGraph_verify_channel_update"))) TS_NetworkGraph_verify_channel_update(uint64_t this_arg, uint64_t msg) {
71057         LDKNetworkGraph this_arg_conv;
71058         this_arg_conv.inner = untag_ptr(this_arg);
71059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71061         this_arg_conv.is_owned = false;
71062         LDKChannelUpdate msg_conv;
71063         msg_conv.inner = untag_ptr(msg);
71064         msg_conv.is_owned = ptr_is_owned(msg);
71065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71066         msg_conv.is_owned = false;
71067         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71068         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
71069         return tag_ptr(ret_conv, true);
71070 }
71071
71072 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
71073         LDKReadOnlyNetworkGraph this_arg_conv;
71074         this_arg_conv.inner = untag_ptr(this_arg);
71075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71077         this_arg_conv.is_owned = false;
71078         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
71079         uint64_t ret_ref = 0;
71080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71082         return ret_ref;
71083 }
71084
71085 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
71086         LDKReadOnlyNetworkGraph this_arg_conv;
71087         this_arg_conv.inner = untag_ptr(this_arg);
71088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71090         this_arg_conv.is_owned = false;
71091         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
71092         int64_tArray ret_arr = NULL;
71093         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71094         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71095         for (size_t i = 0; i < ret_var.datalen; i++) {
71096                 int64_t ret_conv_8_conv = ret_var.data[i];
71097                 ret_arr_ptr[i] = ret_conv_8_conv;
71098         }
71099         
71100         FREE(ret_var.data);
71101         return ret_arr;
71102 }
71103
71104 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
71105         LDKReadOnlyNetworkGraph this_arg_conv;
71106         this_arg_conv.inner = untag_ptr(this_arg);
71107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71109         this_arg_conv.is_owned = false;
71110         LDKNodeId node_id_conv;
71111         node_id_conv.inner = untag_ptr(node_id);
71112         node_id_conv.is_owned = ptr_is_owned(node_id);
71113         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
71114         node_id_conv.is_owned = false;
71115         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
71116         uint64_t ret_ref = 0;
71117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71119         return ret_ref;
71120 }
71121
71122 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
71123         LDKReadOnlyNetworkGraph this_arg_conv;
71124         this_arg_conv.inner = untag_ptr(this_arg);
71125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71127         this_arg_conv.is_owned = false;
71128         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
71129         uint64_tArray ret_arr = NULL;
71130         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
71131         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
71132         for (size_t i = 0; i < ret_var.datalen; i++) {
71133                 LDKNodeId ret_conv_8_var = ret_var.data[i];
71134                 uint64_t ret_conv_8_ref = 0;
71135                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
71136                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
71137                 ret_arr_ptr[i] = ret_conv_8_ref;
71138         }
71139         
71140         FREE(ret_var.data);
71141         return ret_arr;
71142 }
71143
71144 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
71145         LDKReadOnlyNetworkGraph this_arg_conv;
71146         this_arg_conv.inner = untag_ptr(this_arg);
71147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71149         this_arg_conv.is_owned = false;
71150         LDKPublicKey pubkey_ref;
71151         CHECK(pubkey->arr_len == 33);
71152         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
71153         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
71154         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
71155         uint64_t ret_ref = tag_ptr(ret_copy, true);
71156         return ret_ref;
71157 }
71158
71159 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
71160         LDKDefaultRouter this_obj_conv;
71161         this_obj_conv.inner = untag_ptr(this_obj);
71162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71164         DefaultRouter_free(this_obj_conv);
71165 }
71166
71167 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) {
71168         LDKNetworkGraph network_graph_conv;
71169         network_graph_conv.inner = untag_ptr(network_graph);
71170         network_graph_conv.is_owned = ptr_is_owned(network_graph);
71171         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
71172         network_graph_conv.is_owned = false;
71173         void* logger_ptr = untag_ptr(logger);
71174         CHECK_ACCESS(logger_ptr);
71175         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
71176         if (logger_conv.free == LDKLogger_JCalls_free) {
71177                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71178                 LDKLogger_JCalls_cloned(&logger_conv);
71179         }
71180         void* entropy_source_ptr = untag_ptr(entropy_source);
71181         CHECK_ACCESS(entropy_source_ptr);
71182         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
71183         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
71184                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71185                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
71186         }
71187         void* scorer_ptr = untag_ptr(scorer);
71188         CHECK_ACCESS(scorer_ptr);
71189         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
71190         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
71191                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71192                 LDKLockableScore_JCalls_cloned(&scorer_conv);
71193         }
71194         LDKProbabilisticScoringFeeParameters score_params_conv;
71195         score_params_conv.inner = untag_ptr(score_params);
71196         score_params_conv.is_owned = ptr_is_owned(score_params);
71197         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
71198         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
71199         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
71200         uint64_t ret_ref = 0;
71201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71203         return ret_ref;
71204 }
71205
71206 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
71207         LDKDefaultRouter this_arg_conv;
71208         this_arg_conv.inner = untag_ptr(this_arg);
71209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71211         this_arg_conv.is_owned = false;
71212         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
71213         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
71214         return tag_ptr(ret_ret, true);
71215 }
71216
71217 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_MessageRouter"))) TS_DefaultRouter_as_MessageRouter(uint64_t this_arg) {
71218         LDKDefaultRouter this_arg_conv;
71219         this_arg_conv.inner = untag_ptr(this_arg);
71220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71222         this_arg_conv.is_owned = false;
71223         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
71224         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
71225         return tag_ptr(ret_ret, true);
71226 }
71227
71228 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
71229         if (!ptr_is_owned(this_ptr)) return;
71230         void* this_ptr_ptr = untag_ptr(this_ptr);
71231         CHECK_ACCESS(this_ptr_ptr);
71232         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
71233         FREE(untag_ptr(this_ptr));
71234         Router_free(this_ptr_conv);
71235 }
71236
71237 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
71238         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
71239         this_obj_conv.inner = untag_ptr(this_obj);
71240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71242         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
71243 }
71244
71245 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
71246         void* scorer_ptr = untag_ptr(scorer);
71247         CHECK_ACCESS(scorer_ptr);
71248         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
71249         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
71250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71251                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
71252         }
71253         LDKInFlightHtlcs inflight_htlcs_conv;
71254         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
71255         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
71256         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
71257         inflight_htlcs_conv.is_owned = false;
71258         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
71259         uint64_t ret_ref = 0;
71260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71262         return ret_ref;
71263 }
71264
71265 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp"))) TS_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(uint64_t this_arg) {
71266         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
71267         this_arg_conv.inner = untag_ptr(this_arg);
71268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71270         this_arg_conv.is_owned = false;
71271         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
71272         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
71273         return tag_ptr(ret_ret, true);
71274 }
71275
71276 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
71277         LDKInFlightHtlcs this_obj_conv;
71278         this_obj_conv.inner = untag_ptr(this_obj);
71279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71281         InFlightHtlcs_free(this_obj_conv);
71282 }
71283
71284 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
71285         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
71286         uint64_t ret_ref = 0;
71287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71289         return ret_ref;
71290 }
71291 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
71292         LDKInFlightHtlcs arg_conv;
71293         arg_conv.inner = untag_ptr(arg);
71294         arg_conv.is_owned = ptr_is_owned(arg);
71295         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71296         arg_conv.is_owned = false;
71297         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
71298         return ret_conv;
71299 }
71300
71301 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
71302         LDKInFlightHtlcs orig_conv;
71303         orig_conv.inner = untag_ptr(orig);
71304         orig_conv.is_owned = ptr_is_owned(orig);
71305         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71306         orig_conv.is_owned = false;
71307         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
71308         uint64_t ret_ref = 0;
71309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71311         return ret_ref;
71312 }
71313
71314 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
71315         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
71316         uint64_t ret_ref = 0;
71317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71319         return ret_ref;
71320 }
71321
71322 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
71323         LDKInFlightHtlcs this_arg_conv;
71324         this_arg_conv.inner = untag_ptr(this_arg);
71325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71327         this_arg_conv.is_owned = false;
71328         LDKPath path_conv;
71329         path_conv.inner = untag_ptr(path);
71330         path_conv.is_owned = ptr_is_owned(path);
71331         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71332         path_conv.is_owned = false;
71333         LDKPublicKey payer_node_id_ref;
71334         CHECK(payer_node_id->arr_len == 33);
71335         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
71336         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
71337 }
71338
71339 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) {
71340         LDKInFlightHtlcs this_arg_conv;
71341         this_arg_conv.inner = untag_ptr(this_arg);
71342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71344         this_arg_conv.is_owned = false;
71345         LDKNodeId source_conv;
71346         source_conv.inner = untag_ptr(source);
71347         source_conv.is_owned = ptr_is_owned(source);
71348         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
71349         source_conv.is_owned = false;
71350         LDKNodeId target_conv;
71351         target_conv.inner = untag_ptr(target);
71352         target_conv.is_owned = ptr_is_owned(target);
71353         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
71354         target_conv.is_owned = false;
71355         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
71356 }
71357
71358 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) {
71359         LDKInFlightHtlcs this_arg_conv;
71360         this_arg_conv.inner = untag_ptr(this_arg);
71361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71363         this_arg_conv.is_owned = false;
71364         LDKNodeId source_conv;
71365         source_conv.inner = untag_ptr(source);
71366         source_conv.is_owned = ptr_is_owned(source);
71367         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
71368         source_conv.is_owned = false;
71369         LDKNodeId target_conv;
71370         target_conv.inner = untag_ptr(target);
71371         target_conv.is_owned = ptr_is_owned(target);
71372         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
71373         target_conv.is_owned = false;
71374         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71375         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
71376         uint64_t ret_ref = tag_ptr(ret_copy, true);
71377         return ret_ref;
71378 }
71379
71380 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
71381         LDKInFlightHtlcs obj_conv;
71382         obj_conv.inner = untag_ptr(obj);
71383         obj_conv.is_owned = ptr_is_owned(obj);
71384         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71385         obj_conv.is_owned = false;
71386         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
71387         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71388         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71389         CVec_u8Z_free(ret_var);
71390         return ret_arr;
71391 }
71392
71393 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
71394         LDKu8slice ser_ref;
71395         ser_ref.datalen = ser->arr_len;
71396         ser_ref.data = ser->elems;
71397         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
71398         *ret_conv = InFlightHtlcs_read(ser_ref);
71399         FREE(ser);
71400         return tag_ptr(ret_conv, true);
71401 }
71402
71403 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
71404         LDKRouteHop this_obj_conv;
71405         this_obj_conv.inner = untag_ptr(this_obj);
71406         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71408         RouteHop_free(this_obj_conv);
71409 }
71410
71411 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
71412         LDKRouteHop this_ptr_conv;
71413         this_ptr_conv.inner = untag_ptr(this_ptr);
71414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71416         this_ptr_conv.is_owned = false;
71417         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71418         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
71419         return ret_arr;
71420 }
71421
71422 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
71423         LDKRouteHop this_ptr_conv;
71424         this_ptr_conv.inner = untag_ptr(this_ptr);
71425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71427         this_ptr_conv.is_owned = false;
71428         LDKPublicKey val_ref;
71429         CHECK(val->arr_len == 33);
71430         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71431         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
71432 }
71433
71434 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
71435         LDKRouteHop this_ptr_conv;
71436         this_ptr_conv.inner = untag_ptr(this_ptr);
71437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71439         this_ptr_conv.is_owned = false;
71440         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
71441         uint64_t ret_ref = 0;
71442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71444         return ret_ref;
71445 }
71446
71447 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
71448         LDKRouteHop this_ptr_conv;
71449         this_ptr_conv.inner = untag_ptr(this_ptr);
71450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71452         this_ptr_conv.is_owned = false;
71453         LDKNodeFeatures val_conv;
71454         val_conv.inner = untag_ptr(val);
71455         val_conv.is_owned = ptr_is_owned(val);
71456         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71457         val_conv = NodeFeatures_clone(&val_conv);
71458         RouteHop_set_node_features(&this_ptr_conv, val_conv);
71459 }
71460
71461 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
71462         LDKRouteHop this_ptr_conv;
71463         this_ptr_conv.inner = untag_ptr(this_ptr);
71464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71466         this_ptr_conv.is_owned = false;
71467         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
71468         return ret_conv;
71469 }
71470
71471 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
71472         LDKRouteHop this_ptr_conv;
71473         this_ptr_conv.inner = untag_ptr(this_ptr);
71474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71476         this_ptr_conv.is_owned = false;
71477         RouteHop_set_short_channel_id(&this_ptr_conv, val);
71478 }
71479
71480 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
71481         LDKRouteHop this_ptr_conv;
71482         this_ptr_conv.inner = untag_ptr(this_ptr);
71483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71485         this_ptr_conv.is_owned = false;
71486         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
71487         uint64_t ret_ref = 0;
71488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71490         return ret_ref;
71491 }
71492
71493 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
71494         LDKRouteHop this_ptr_conv;
71495         this_ptr_conv.inner = untag_ptr(this_ptr);
71496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71498         this_ptr_conv.is_owned = false;
71499         LDKChannelFeatures val_conv;
71500         val_conv.inner = untag_ptr(val);
71501         val_conv.is_owned = ptr_is_owned(val);
71502         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71503         val_conv = ChannelFeatures_clone(&val_conv);
71504         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
71505 }
71506
71507 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
71508         LDKRouteHop this_ptr_conv;
71509         this_ptr_conv.inner = untag_ptr(this_ptr);
71510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71512         this_ptr_conv.is_owned = false;
71513         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
71514         return ret_conv;
71515 }
71516
71517 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
71518         LDKRouteHop this_ptr_conv;
71519         this_ptr_conv.inner = untag_ptr(this_ptr);
71520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71522         this_ptr_conv.is_owned = false;
71523         RouteHop_set_fee_msat(&this_ptr_conv, val);
71524 }
71525
71526 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
71527         LDKRouteHop this_ptr_conv;
71528         this_ptr_conv.inner = untag_ptr(this_ptr);
71529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71531         this_ptr_conv.is_owned = false;
71532         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
71533         return ret_conv;
71534 }
71535
71536 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
71537         LDKRouteHop this_ptr_conv;
71538         this_ptr_conv.inner = untag_ptr(this_ptr);
71539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71541         this_ptr_conv.is_owned = false;
71542         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
71543 }
71544
71545 jboolean  __attribute__((export_name("TS_RouteHop_get_maybe_announced_channel"))) TS_RouteHop_get_maybe_announced_channel(uint64_t this_ptr) {
71546         LDKRouteHop this_ptr_conv;
71547         this_ptr_conv.inner = untag_ptr(this_ptr);
71548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71550         this_ptr_conv.is_owned = false;
71551         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
71552         return ret_conv;
71553 }
71554
71555 void  __attribute__((export_name("TS_RouteHop_set_maybe_announced_channel"))) TS_RouteHop_set_maybe_announced_channel(uint64_t this_ptr, jboolean val) {
71556         LDKRouteHop this_ptr_conv;
71557         this_ptr_conv.inner = untag_ptr(this_ptr);
71558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71560         this_ptr_conv.is_owned = false;
71561         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
71562 }
71563
71564 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) {
71565         LDKPublicKey pubkey_arg_ref;
71566         CHECK(pubkey_arg->arr_len == 33);
71567         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
71568         LDKNodeFeatures node_features_arg_conv;
71569         node_features_arg_conv.inner = untag_ptr(node_features_arg);
71570         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
71571         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
71572         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
71573         LDKChannelFeatures channel_features_arg_conv;
71574         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
71575         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
71576         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
71577         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
71578         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);
71579         uint64_t ret_ref = 0;
71580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71582         return ret_ref;
71583 }
71584
71585 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
71586         LDKRouteHop ret_var = RouteHop_clone(arg);
71587         uint64_t ret_ref = 0;
71588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71590         return ret_ref;
71591 }
71592 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
71593         LDKRouteHop arg_conv;
71594         arg_conv.inner = untag_ptr(arg);
71595         arg_conv.is_owned = ptr_is_owned(arg);
71596         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71597         arg_conv.is_owned = false;
71598         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
71599         return ret_conv;
71600 }
71601
71602 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
71603         LDKRouteHop orig_conv;
71604         orig_conv.inner = untag_ptr(orig);
71605         orig_conv.is_owned = ptr_is_owned(orig);
71606         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71607         orig_conv.is_owned = false;
71608         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
71609         uint64_t ret_ref = 0;
71610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71612         return ret_ref;
71613 }
71614
71615 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
71616         LDKRouteHop o_conv;
71617         o_conv.inner = untag_ptr(o);
71618         o_conv.is_owned = ptr_is_owned(o);
71619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71620         o_conv.is_owned = false;
71621         int64_t ret_conv = RouteHop_hash(&o_conv);
71622         return ret_conv;
71623 }
71624
71625 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
71626         LDKRouteHop a_conv;
71627         a_conv.inner = untag_ptr(a);
71628         a_conv.is_owned = ptr_is_owned(a);
71629         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71630         a_conv.is_owned = false;
71631         LDKRouteHop b_conv;
71632         b_conv.inner = untag_ptr(b);
71633         b_conv.is_owned = ptr_is_owned(b);
71634         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71635         b_conv.is_owned = false;
71636         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
71637         return ret_conv;
71638 }
71639
71640 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
71641         LDKRouteHop obj_conv;
71642         obj_conv.inner = untag_ptr(obj);
71643         obj_conv.is_owned = ptr_is_owned(obj);
71644         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71645         obj_conv.is_owned = false;
71646         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
71647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71649         CVec_u8Z_free(ret_var);
71650         return ret_arr;
71651 }
71652
71653 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
71654         LDKu8slice ser_ref;
71655         ser_ref.datalen = ser->arr_len;
71656         ser_ref.data = ser->elems;
71657         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
71658         *ret_conv = RouteHop_read(ser_ref);
71659         FREE(ser);
71660         return tag_ptr(ret_conv, true);
71661 }
71662
71663 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
71664         LDKBlindedTail this_obj_conv;
71665         this_obj_conv.inner = untag_ptr(this_obj);
71666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71668         BlindedTail_free(this_obj_conv);
71669 }
71670
71671 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
71672         LDKBlindedTail this_ptr_conv;
71673         this_ptr_conv.inner = untag_ptr(this_ptr);
71674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71676         this_ptr_conv.is_owned = false;
71677         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
71678         uint64_tArray ret_arr = NULL;
71679         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
71680         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
71681         for (size_t m = 0; m < ret_var.datalen; m++) {
71682                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
71683                 uint64_t ret_conv_12_ref = 0;
71684                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
71685                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
71686                 ret_arr_ptr[m] = ret_conv_12_ref;
71687         }
71688         
71689         FREE(ret_var.data);
71690         return ret_arr;
71691 }
71692
71693 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
71694         LDKBlindedTail this_ptr_conv;
71695         this_ptr_conv.inner = untag_ptr(this_ptr);
71696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71698         this_ptr_conv.is_owned = false;
71699         LDKCVec_BlindedHopZ val_constr;
71700         val_constr.datalen = val->arr_len;
71701         if (val_constr.datalen > 0)
71702                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
71703         else
71704                 val_constr.data = NULL;
71705         uint64_t* val_vals = val->elems;
71706         for (size_t m = 0; m < val_constr.datalen; m++) {
71707                 uint64_t val_conv_12 = val_vals[m];
71708                 LDKBlindedHop val_conv_12_conv;
71709                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
71710                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
71711                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
71712                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
71713                 val_constr.data[m] = val_conv_12_conv;
71714         }
71715         FREE(val);
71716         BlindedTail_set_hops(&this_ptr_conv, val_constr);
71717 }
71718
71719 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
71720         LDKBlindedTail this_ptr_conv;
71721         this_ptr_conv.inner = untag_ptr(this_ptr);
71722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71724         this_ptr_conv.is_owned = false;
71725         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71726         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
71727         return ret_arr;
71728 }
71729
71730 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
71731         LDKBlindedTail this_ptr_conv;
71732         this_ptr_conv.inner = untag_ptr(this_ptr);
71733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71735         this_ptr_conv.is_owned = false;
71736         LDKPublicKey val_ref;
71737         CHECK(val->arr_len == 33);
71738         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71739         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
71740 }
71741
71742 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) {
71743         LDKBlindedTail this_ptr_conv;
71744         this_ptr_conv.inner = untag_ptr(this_ptr);
71745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71747         this_ptr_conv.is_owned = false;
71748         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
71749         return ret_conv;
71750 }
71751
71752 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) {
71753         LDKBlindedTail this_ptr_conv;
71754         this_ptr_conv.inner = untag_ptr(this_ptr);
71755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71757         this_ptr_conv.is_owned = false;
71758         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
71759 }
71760
71761 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
71762         LDKBlindedTail this_ptr_conv;
71763         this_ptr_conv.inner = untag_ptr(this_ptr);
71764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71766         this_ptr_conv.is_owned = false;
71767         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
71768         return ret_conv;
71769 }
71770
71771 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
71772         LDKBlindedTail this_ptr_conv;
71773         this_ptr_conv.inner = untag_ptr(this_ptr);
71774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71776         this_ptr_conv.is_owned = false;
71777         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
71778 }
71779
71780 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) {
71781         LDKCVec_BlindedHopZ hops_arg_constr;
71782         hops_arg_constr.datalen = hops_arg->arr_len;
71783         if (hops_arg_constr.datalen > 0)
71784                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
71785         else
71786                 hops_arg_constr.data = NULL;
71787         uint64_t* hops_arg_vals = hops_arg->elems;
71788         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
71789                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
71790                 LDKBlindedHop hops_arg_conv_12_conv;
71791                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
71792                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
71793                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
71794                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
71795                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
71796         }
71797         FREE(hops_arg);
71798         LDKPublicKey blinding_point_arg_ref;
71799         CHECK(blinding_point_arg->arr_len == 33);
71800         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
71801         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
71802         uint64_t ret_ref = 0;
71803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71805         return ret_ref;
71806 }
71807
71808 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
71809         LDKBlindedTail ret_var = BlindedTail_clone(arg);
71810         uint64_t ret_ref = 0;
71811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71813         return ret_ref;
71814 }
71815 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
71816         LDKBlindedTail arg_conv;
71817         arg_conv.inner = untag_ptr(arg);
71818         arg_conv.is_owned = ptr_is_owned(arg);
71819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71820         arg_conv.is_owned = false;
71821         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
71822         return ret_conv;
71823 }
71824
71825 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
71826         LDKBlindedTail orig_conv;
71827         orig_conv.inner = untag_ptr(orig);
71828         orig_conv.is_owned = ptr_is_owned(orig);
71829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71830         orig_conv.is_owned = false;
71831         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
71832         uint64_t ret_ref = 0;
71833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71835         return ret_ref;
71836 }
71837
71838 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
71839         LDKBlindedTail o_conv;
71840         o_conv.inner = untag_ptr(o);
71841         o_conv.is_owned = ptr_is_owned(o);
71842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71843         o_conv.is_owned = false;
71844         int64_t ret_conv = BlindedTail_hash(&o_conv);
71845         return ret_conv;
71846 }
71847
71848 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
71849         LDKBlindedTail a_conv;
71850         a_conv.inner = untag_ptr(a);
71851         a_conv.is_owned = ptr_is_owned(a);
71852         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71853         a_conv.is_owned = false;
71854         LDKBlindedTail b_conv;
71855         b_conv.inner = untag_ptr(b);
71856         b_conv.is_owned = ptr_is_owned(b);
71857         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71858         b_conv.is_owned = false;
71859         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
71860         return ret_conv;
71861 }
71862
71863 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
71864         LDKBlindedTail obj_conv;
71865         obj_conv.inner = untag_ptr(obj);
71866         obj_conv.is_owned = ptr_is_owned(obj);
71867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71868         obj_conv.is_owned = false;
71869         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
71870         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71871         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71872         CVec_u8Z_free(ret_var);
71873         return ret_arr;
71874 }
71875
71876 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
71877         LDKu8slice ser_ref;
71878         ser_ref.datalen = ser->arr_len;
71879         ser_ref.data = ser->elems;
71880         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
71881         *ret_conv = BlindedTail_read(ser_ref);
71882         FREE(ser);
71883         return tag_ptr(ret_conv, true);
71884 }
71885
71886 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
71887         LDKPath this_obj_conv;
71888         this_obj_conv.inner = untag_ptr(this_obj);
71889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71891         Path_free(this_obj_conv);
71892 }
71893
71894 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
71895         LDKPath this_ptr_conv;
71896         this_ptr_conv.inner = untag_ptr(this_ptr);
71897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71899         this_ptr_conv.is_owned = false;
71900         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
71901         uint64_tArray ret_arr = NULL;
71902         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
71903         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
71904         for (size_t k = 0; k < ret_var.datalen; k++) {
71905                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
71906                 uint64_t ret_conv_10_ref = 0;
71907                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
71908                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
71909                 ret_arr_ptr[k] = ret_conv_10_ref;
71910         }
71911         
71912         FREE(ret_var.data);
71913         return ret_arr;
71914 }
71915
71916 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
71917         LDKPath this_ptr_conv;
71918         this_ptr_conv.inner = untag_ptr(this_ptr);
71919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71921         this_ptr_conv.is_owned = false;
71922         LDKCVec_RouteHopZ val_constr;
71923         val_constr.datalen = val->arr_len;
71924         if (val_constr.datalen > 0)
71925                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
71926         else
71927                 val_constr.data = NULL;
71928         uint64_t* val_vals = val->elems;
71929         for (size_t k = 0; k < val_constr.datalen; k++) {
71930                 uint64_t val_conv_10 = val_vals[k];
71931                 LDKRouteHop val_conv_10_conv;
71932                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
71933                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
71934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
71935                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
71936                 val_constr.data[k] = val_conv_10_conv;
71937         }
71938         FREE(val);
71939         Path_set_hops(&this_ptr_conv, val_constr);
71940 }
71941
71942 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
71943         LDKPath this_ptr_conv;
71944         this_ptr_conv.inner = untag_ptr(this_ptr);
71945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71947         this_ptr_conv.is_owned = false;
71948         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
71949         uint64_t ret_ref = 0;
71950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71952         return ret_ref;
71953 }
71954
71955 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
71956         LDKPath this_ptr_conv;
71957         this_ptr_conv.inner = untag_ptr(this_ptr);
71958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71960         this_ptr_conv.is_owned = false;
71961         LDKBlindedTail val_conv;
71962         val_conv.inner = untag_ptr(val);
71963         val_conv.is_owned = ptr_is_owned(val);
71964         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71965         val_conv = BlindedTail_clone(&val_conv);
71966         Path_set_blinded_tail(&this_ptr_conv, val_conv);
71967 }
71968
71969 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
71970         LDKCVec_RouteHopZ hops_arg_constr;
71971         hops_arg_constr.datalen = hops_arg->arr_len;
71972         if (hops_arg_constr.datalen > 0)
71973                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
71974         else
71975                 hops_arg_constr.data = NULL;
71976         uint64_t* hops_arg_vals = hops_arg->elems;
71977         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
71978                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
71979                 LDKRouteHop hops_arg_conv_10_conv;
71980                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
71981                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
71982                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
71983                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
71984                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
71985         }
71986         FREE(hops_arg);
71987         LDKBlindedTail blinded_tail_arg_conv;
71988         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
71989         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
71990         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
71991         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
71992         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
71993         uint64_t ret_ref = 0;
71994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71996         return ret_ref;
71997 }
71998
71999 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
72000         LDKPath ret_var = Path_clone(arg);
72001         uint64_t ret_ref = 0;
72002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72004         return ret_ref;
72005 }
72006 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
72007         LDKPath arg_conv;
72008         arg_conv.inner = untag_ptr(arg);
72009         arg_conv.is_owned = ptr_is_owned(arg);
72010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72011         arg_conv.is_owned = false;
72012         int64_t ret_conv = Path_clone_ptr(&arg_conv);
72013         return ret_conv;
72014 }
72015
72016 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
72017         LDKPath orig_conv;
72018         orig_conv.inner = untag_ptr(orig);
72019         orig_conv.is_owned = ptr_is_owned(orig);
72020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72021         orig_conv.is_owned = false;
72022         LDKPath ret_var = Path_clone(&orig_conv);
72023         uint64_t ret_ref = 0;
72024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72026         return ret_ref;
72027 }
72028
72029 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
72030         LDKPath o_conv;
72031         o_conv.inner = untag_ptr(o);
72032         o_conv.is_owned = ptr_is_owned(o);
72033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72034         o_conv.is_owned = false;
72035         int64_t ret_conv = Path_hash(&o_conv);
72036         return ret_conv;
72037 }
72038
72039 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
72040         LDKPath a_conv;
72041         a_conv.inner = untag_ptr(a);
72042         a_conv.is_owned = ptr_is_owned(a);
72043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72044         a_conv.is_owned = false;
72045         LDKPath b_conv;
72046         b_conv.inner = untag_ptr(b);
72047         b_conv.is_owned = ptr_is_owned(b);
72048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72049         b_conv.is_owned = false;
72050         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
72051         return ret_conv;
72052 }
72053
72054 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
72055         LDKPath this_arg_conv;
72056         this_arg_conv.inner = untag_ptr(this_arg);
72057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72059         this_arg_conv.is_owned = false;
72060         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
72061         return ret_conv;
72062 }
72063
72064 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
72065         LDKPath this_arg_conv;
72066         this_arg_conv.inner = untag_ptr(this_arg);
72067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72069         this_arg_conv.is_owned = false;
72070         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
72071         return ret_conv;
72072 }
72073
72074 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
72075         LDKPath this_arg_conv;
72076         this_arg_conv.inner = untag_ptr(this_arg);
72077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72079         this_arg_conv.is_owned = false;
72080         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
72081         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
72082         uint64_t ret_ref = tag_ptr(ret_copy, true);
72083         return ret_ref;
72084 }
72085
72086 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
72087         LDKRoute this_obj_conv;
72088         this_obj_conv.inner = untag_ptr(this_obj);
72089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72091         Route_free(this_obj_conv);
72092 }
72093
72094 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
72095         LDKRoute this_ptr_conv;
72096         this_ptr_conv.inner = untag_ptr(this_ptr);
72097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72099         this_ptr_conv.is_owned = false;
72100         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
72101         uint64_tArray ret_arr = NULL;
72102         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
72103         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
72104         for (size_t g = 0; g < ret_var.datalen; g++) {
72105                 LDKPath ret_conv_6_var = ret_var.data[g];
72106                 uint64_t ret_conv_6_ref = 0;
72107                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
72108                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
72109                 ret_arr_ptr[g] = ret_conv_6_ref;
72110         }
72111         
72112         FREE(ret_var.data);
72113         return ret_arr;
72114 }
72115
72116 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
72117         LDKRoute this_ptr_conv;
72118         this_ptr_conv.inner = untag_ptr(this_ptr);
72119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72121         this_ptr_conv.is_owned = false;
72122         LDKCVec_PathZ val_constr;
72123         val_constr.datalen = val->arr_len;
72124         if (val_constr.datalen > 0)
72125                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
72126         else
72127                 val_constr.data = NULL;
72128         uint64_t* val_vals = val->elems;
72129         for (size_t g = 0; g < val_constr.datalen; g++) {
72130                 uint64_t val_conv_6 = val_vals[g];
72131                 LDKPath val_conv_6_conv;
72132                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
72133                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
72134                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
72135                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
72136                 val_constr.data[g] = val_conv_6_conv;
72137         }
72138         FREE(val);
72139         Route_set_paths(&this_ptr_conv, val_constr);
72140 }
72141
72142 uint64_t  __attribute__((export_name("TS_Route_get_route_params"))) TS_Route_get_route_params(uint64_t this_ptr) {
72143         LDKRoute this_ptr_conv;
72144         this_ptr_conv.inner = untag_ptr(this_ptr);
72145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72147         this_ptr_conv.is_owned = false;
72148         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
72149         uint64_t ret_ref = 0;
72150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72152         return ret_ref;
72153 }
72154
72155 void  __attribute__((export_name("TS_Route_set_route_params"))) TS_Route_set_route_params(uint64_t this_ptr, uint64_t val) {
72156         LDKRoute this_ptr_conv;
72157         this_ptr_conv.inner = untag_ptr(this_ptr);
72158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72160         this_ptr_conv.is_owned = false;
72161         LDKRouteParameters val_conv;
72162         val_conv.inner = untag_ptr(val);
72163         val_conv.is_owned = ptr_is_owned(val);
72164         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72165         val_conv = RouteParameters_clone(&val_conv);
72166         Route_set_route_params(&this_ptr_conv, val_conv);
72167 }
72168
72169 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t route_params_arg) {
72170         LDKCVec_PathZ paths_arg_constr;
72171         paths_arg_constr.datalen = paths_arg->arr_len;
72172         if (paths_arg_constr.datalen > 0)
72173                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
72174         else
72175                 paths_arg_constr.data = NULL;
72176         uint64_t* paths_arg_vals = paths_arg->elems;
72177         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
72178                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
72179                 LDKPath paths_arg_conv_6_conv;
72180                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
72181                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
72182                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
72183                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
72184                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
72185         }
72186         FREE(paths_arg);
72187         LDKRouteParameters route_params_arg_conv;
72188         route_params_arg_conv.inner = untag_ptr(route_params_arg);
72189         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
72190         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
72191         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
72192         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
72193         uint64_t ret_ref = 0;
72194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72196         return ret_ref;
72197 }
72198
72199 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
72200         LDKRoute ret_var = Route_clone(arg);
72201         uint64_t ret_ref = 0;
72202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72204         return ret_ref;
72205 }
72206 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
72207         LDKRoute arg_conv;
72208         arg_conv.inner = untag_ptr(arg);
72209         arg_conv.is_owned = ptr_is_owned(arg);
72210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72211         arg_conv.is_owned = false;
72212         int64_t ret_conv = Route_clone_ptr(&arg_conv);
72213         return ret_conv;
72214 }
72215
72216 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
72217         LDKRoute orig_conv;
72218         orig_conv.inner = untag_ptr(orig);
72219         orig_conv.is_owned = ptr_is_owned(orig);
72220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72221         orig_conv.is_owned = false;
72222         LDKRoute ret_var = Route_clone(&orig_conv);
72223         uint64_t ret_ref = 0;
72224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72226         return ret_ref;
72227 }
72228
72229 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
72230         LDKRoute o_conv;
72231         o_conv.inner = untag_ptr(o);
72232         o_conv.is_owned = ptr_is_owned(o);
72233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72234         o_conv.is_owned = false;
72235         int64_t ret_conv = Route_hash(&o_conv);
72236         return ret_conv;
72237 }
72238
72239 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
72240         LDKRoute a_conv;
72241         a_conv.inner = untag_ptr(a);
72242         a_conv.is_owned = ptr_is_owned(a);
72243         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72244         a_conv.is_owned = false;
72245         LDKRoute b_conv;
72246         b_conv.inner = untag_ptr(b);
72247         b_conv.is_owned = ptr_is_owned(b);
72248         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72249         b_conv.is_owned = false;
72250         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
72251         return ret_conv;
72252 }
72253
72254 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
72255         LDKRoute this_arg_conv;
72256         this_arg_conv.inner = untag_ptr(this_arg);
72257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72259         this_arg_conv.is_owned = false;
72260         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
72261         return ret_conv;
72262 }
72263
72264 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
72265         LDKRoute this_arg_conv;
72266         this_arg_conv.inner = untag_ptr(this_arg);
72267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72269         this_arg_conv.is_owned = false;
72270         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
72271         return ret_conv;
72272 }
72273
72274 jstring  __attribute__((export_name("TS_Route_to_str"))) TS_Route_to_str(uint64_t o) {
72275         LDKRoute o_conv;
72276         o_conv.inner = untag_ptr(o);
72277         o_conv.is_owned = ptr_is_owned(o);
72278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72279         o_conv.is_owned = false;
72280         LDKStr ret_str = Route_to_str(&o_conv);
72281         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
72282         Str_free(ret_str);
72283         return ret_conv;
72284 }
72285
72286 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
72287         LDKRoute obj_conv;
72288         obj_conv.inner = untag_ptr(obj);
72289         obj_conv.is_owned = ptr_is_owned(obj);
72290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72291         obj_conv.is_owned = false;
72292         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
72293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72295         CVec_u8Z_free(ret_var);
72296         return ret_arr;
72297 }
72298
72299 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
72300         LDKu8slice ser_ref;
72301         ser_ref.datalen = ser->arr_len;
72302         ser_ref.data = ser->elems;
72303         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
72304         *ret_conv = Route_read(ser_ref);
72305         FREE(ser);
72306         return tag_ptr(ret_conv, true);
72307 }
72308
72309 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
72310         LDKRouteParameters this_obj_conv;
72311         this_obj_conv.inner = untag_ptr(this_obj);
72312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72314         RouteParameters_free(this_obj_conv);
72315 }
72316
72317 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
72318         LDKRouteParameters this_ptr_conv;
72319         this_ptr_conv.inner = untag_ptr(this_ptr);
72320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72322         this_ptr_conv.is_owned = false;
72323         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
72324         uint64_t ret_ref = 0;
72325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72327         return ret_ref;
72328 }
72329
72330 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
72331         LDKRouteParameters this_ptr_conv;
72332         this_ptr_conv.inner = untag_ptr(this_ptr);
72333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72335         this_ptr_conv.is_owned = false;
72336         LDKPaymentParameters val_conv;
72337         val_conv.inner = untag_ptr(val);
72338         val_conv.is_owned = ptr_is_owned(val);
72339         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72340         val_conv = PaymentParameters_clone(&val_conv);
72341         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
72342 }
72343
72344 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
72345         LDKRouteParameters this_ptr_conv;
72346         this_ptr_conv.inner = untag_ptr(this_ptr);
72347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72349         this_ptr_conv.is_owned = false;
72350         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
72351         return ret_conv;
72352 }
72353
72354 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
72355         LDKRouteParameters this_ptr_conv;
72356         this_ptr_conv.inner = untag_ptr(this_ptr);
72357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72359         this_ptr_conv.is_owned = false;
72360         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
72361 }
72362
72363 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) {
72364         LDKRouteParameters this_ptr_conv;
72365         this_ptr_conv.inner = untag_ptr(this_ptr);
72366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72368         this_ptr_conv.is_owned = false;
72369         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72370         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
72371         uint64_t ret_ref = tag_ptr(ret_copy, true);
72372         return ret_ref;
72373 }
72374
72375 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) {
72376         LDKRouteParameters this_ptr_conv;
72377         this_ptr_conv.inner = untag_ptr(this_ptr);
72378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72380         this_ptr_conv.is_owned = false;
72381         void* val_ptr = untag_ptr(val);
72382         CHECK_ACCESS(val_ptr);
72383         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72384         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72385         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
72386 }
72387
72388 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) {
72389         LDKPaymentParameters payment_params_arg_conv;
72390         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
72391         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
72392         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
72393         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
72394         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
72395         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
72396         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
72397         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
72398         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
72399         uint64_t ret_ref = 0;
72400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72402         return ret_ref;
72403 }
72404
72405 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
72406         LDKRouteParameters ret_var = RouteParameters_clone(arg);
72407         uint64_t ret_ref = 0;
72408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72410         return ret_ref;
72411 }
72412 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
72413         LDKRouteParameters arg_conv;
72414         arg_conv.inner = untag_ptr(arg);
72415         arg_conv.is_owned = ptr_is_owned(arg);
72416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72417         arg_conv.is_owned = false;
72418         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
72419         return ret_conv;
72420 }
72421
72422 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
72423         LDKRouteParameters orig_conv;
72424         orig_conv.inner = untag_ptr(orig);
72425         orig_conv.is_owned = ptr_is_owned(orig);
72426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72427         orig_conv.is_owned = false;
72428         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
72429         uint64_t ret_ref = 0;
72430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72432         return ret_ref;
72433 }
72434
72435 int64_t  __attribute__((export_name("TS_RouteParameters_hash"))) TS_RouteParameters_hash(uint64_t o) {
72436         LDKRouteParameters o_conv;
72437         o_conv.inner = untag_ptr(o);
72438         o_conv.is_owned = ptr_is_owned(o);
72439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72440         o_conv.is_owned = false;
72441         int64_t ret_conv = RouteParameters_hash(&o_conv);
72442         return ret_conv;
72443 }
72444
72445 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
72446         LDKRouteParameters a_conv;
72447         a_conv.inner = untag_ptr(a);
72448         a_conv.is_owned = ptr_is_owned(a);
72449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72450         a_conv.is_owned = false;
72451         LDKRouteParameters b_conv;
72452         b_conv.inner = untag_ptr(b);
72453         b_conv.is_owned = ptr_is_owned(b);
72454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72455         b_conv.is_owned = false;
72456         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
72457         return ret_conv;
72458 }
72459
72460 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) {
72461         LDKPaymentParameters payment_params_conv;
72462         payment_params_conv.inner = untag_ptr(payment_params);
72463         payment_params_conv.is_owned = ptr_is_owned(payment_params);
72464         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
72465         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
72466         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
72467         uint64_t ret_ref = 0;
72468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72470         return ret_ref;
72471 }
72472
72473 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
72474         LDKRouteParameters obj_conv;
72475         obj_conv.inner = untag_ptr(obj);
72476         obj_conv.is_owned = ptr_is_owned(obj);
72477         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72478         obj_conv.is_owned = false;
72479         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
72480         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72481         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72482         CVec_u8Z_free(ret_var);
72483         return ret_arr;
72484 }
72485
72486 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
72487         LDKu8slice ser_ref;
72488         ser_ref.datalen = ser->arr_len;
72489         ser_ref.data = ser->elems;
72490         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
72491         *ret_conv = RouteParameters_read(ser_ref);
72492         FREE(ser);
72493         return tag_ptr(ret_conv, true);
72494 }
72495
72496 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
72497         LDKPaymentParameters this_obj_conv;
72498         this_obj_conv.inner = untag_ptr(this_obj);
72499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72501         PaymentParameters_free(this_obj_conv);
72502 }
72503
72504 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
72505         LDKPaymentParameters this_ptr_conv;
72506         this_ptr_conv.inner = untag_ptr(this_ptr);
72507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72509         this_ptr_conv.is_owned = false;
72510         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
72511         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
72512         uint64_t ret_ref = tag_ptr(ret_copy, true);
72513         return ret_ref;
72514 }
72515
72516 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
72517         LDKPaymentParameters this_ptr_conv;
72518         this_ptr_conv.inner = untag_ptr(this_ptr);
72519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72521         this_ptr_conv.is_owned = false;
72522         void* val_ptr = untag_ptr(val);
72523         CHECK_ACCESS(val_ptr);
72524         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
72525         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
72526         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
72527 }
72528
72529 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
72530         LDKPaymentParameters this_ptr_conv;
72531         this_ptr_conv.inner = untag_ptr(this_ptr);
72532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72534         this_ptr_conv.is_owned = false;
72535         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72536         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
72537         uint64_t ret_ref = tag_ptr(ret_copy, true);
72538         return ret_ref;
72539 }
72540
72541 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
72542         LDKPaymentParameters this_ptr_conv;
72543         this_ptr_conv.inner = untag_ptr(this_ptr);
72544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72546         this_ptr_conv.is_owned = false;
72547         void* val_ptr = untag_ptr(val);
72548         CHECK_ACCESS(val_ptr);
72549         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72550         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72551         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
72552 }
72553
72554 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) {
72555         LDKPaymentParameters this_ptr_conv;
72556         this_ptr_conv.inner = untag_ptr(this_ptr);
72557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72559         this_ptr_conv.is_owned = false;
72560         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
72561         return ret_conv;
72562 }
72563
72564 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) {
72565         LDKPaymentParameters this_ptr_conv;
72566         this_ptr_conv.inner = untag_ptr(this_ptr);
72567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72569         this_ptr_conv.is_owned = false;
72570         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
72571 }
72572
72573 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
72574         LDKPaymentParameters this_ptr_conv;
72575         this_ptr_conv.inner = untag_ptr(this_ptr);
72576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72578         this_ptr_conv.is_owned = false;
72579         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
72580         return ret_conv;
72581 }
72582
72583 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
72584         LDKPaymentParameters this_ptr_conv;
72585         this_ptr_conv.inner = untag_ptr(this_ptr);
72586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72588         this_ptr_conv.is_owned = false;
72589         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
72590 }
72591
72592 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) {
72593         LDKPaymentParameters this_ptr_conv;
72594         this_ptr_conv.inner = untag_ptr(this_ptr);
72595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72597         this_ptr_conv.is_owned = false;
72598         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
72599         return ret_conv;
72600 }
72601
72602 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) {
72603         LDKPaymentParameters this_ptr_conv;
72604         this_ptr_conv.inner = untag_ptr(this_ptr);
72605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72607         this_ptr_conv.is_owned = false;
72608         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
72609 }
72610
72611 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
72612         LDKPaymentParameters this_ptr_conv;
72613         this_ptr_conv.inner = untag_ptr(this_ptr);
72614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72616         this_ptr_conv.is_owned = false;
72617         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
72618         int64_tArray ret_arr = NULL;
72619         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
72620         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
72621         for (size_t i = 0; i < ret_var.datalen; i++) {
72622                 int64_t ret_conv_8_conv = ret_var.data[i];
72623                 ret_arr_ptr[i] = ret_conv_8_conv;
72624         }
72625         
72626         FREE(ret_var.data);
72627         return ret_arr;
72628 }
72629
72630 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
72631         LDKPaymentParameters this_ptr_conv;
72632         this_ptr_conv.inner = untag_ptr(this_ptr);
72633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72635         this_ptr_conv.is_owned = false;
72636         LDKCVec_u64Z val_constr;
72637         val_constr.datalen = val->arr_len;
72638         if (val_constr.datalen > 0)
72639                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
72640         else
72641                 val_constr.data = NULL;
72642         int64_t* val_vals = val->elems;
72643         for (size_t i = 0; i < val_constr.datalen; i++) {
72644                 int64_t val_conv_8 = val_vals[i];
72645                 val_constr.data[i] = val_conv_8;
72646         }
72647         FREE(val);
72648         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
72649 }
72650
72651 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) {
72652         LDKPaymentParameters this_ptr_conv;
72653         this_ptr_conv.inner = untag_ptr(this_ptr);
72654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72656         this_ptr_conv.is_owned = false;
72657         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
72658         int64_tArray ret_arr = NULL;
72659         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
72660         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
72661         for (size_t i = 0; i < ret_var.datalen; i++) {
72662                 int64_t ret_conv_8_conv = ret_var.data[i];
72663                 ret_arr_ptr[i] = ret_conv_8_conv;
72664         }
72665         
72666         FREE(ret_var.data);
72667         return ret_arr;
72668 }
72669
72670 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) {
72671         LDKPaymentParameters this_ptr_conv;
72672         this_ptr_conv.inner = untag_ptr(this_ptr);
72673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72675         this_ptr_conv.is_owned = false;
72676         LDKCVec_u64Z val_constr;
72677         val_constr.datalen = val->arr_len;
72678         if (val_constr.datalen > 0)
72679                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
72680         else
72681                 val_constr.data = NULL;
72682         int64_t* val_vals = val->elems;
72683         for (size_t i = 0; i < val_constr.datalen; i++) {
72684                 int64_t val_conv_8 = val_vals[i];
72685                 val_constr.data[i] = val_conv_8;
72686         }
72687         FREE(val);
72688         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
72689 }
72690
72691 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) {
72692         void* payee_arg_ptr = untag_ptr(payee_arg);
72693         CHECK_ACCESS(payee_arg_ptr);
72694         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
72695         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
72696         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
72697         CHECK_ACCESS(expiry_time_arg_ptr);
72698         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
72699         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
72700         LDKCVec_u64Z previously_failed_channels_arg_constr;
72701         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
72702         if (previously_failed_channels_arg_constr.datalen > 0)
72703                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
72704         else
72705                 previously_failed_channels_arg_constr.data = NULL;
72706         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
72707         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
72708                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
72709                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
72710         }
72711         FREE(previously_failed_channels_arg);
72712         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
72713         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
72714         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
72715                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
72716         else
72717                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
72718         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
72719         for (size_t i = 0; i < previously_failed_blinded_path_idxs_arg_constr.datalen; i++) {
72720                 int64_t previously_failed_blinded_path_idxs_arg_conv_8 = previously_failed_blinded_path_idxs_arg_vals[i];
72721                 previously_failed_blinded_path_idxs_arg_constr.data[i] = previously_failed_blinded_path_idxs_arg_conv_8;
72722         }
72723         FREE(previously_failed_blinded_path_idxs_arg);
72724         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);
72725         uint64_t ret_ref = 0;
72726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72728         return ret_ref;
72729 }
72730
72731 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
72732         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
72733         uint64_t ret_ref = 0;
72734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72736         return ret_ref;
72737 }
72738 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
72739         LDKPaymentParameters arg_conv;
72740         arg_conv.inner = untag_ptr(arg);
72741         arg_conv.is_owned = ptr_is_owned(arg);
72742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72743         arg_conv.is_owned = false;
72744         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
72745         return ret_conv;
72746 }
72747
72748 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
72749         LDKPaymentParameters orig_conv;
72750         orig_conv.inner = untag_ptr(orig);
72751         orig_conv.is_owned = ptr_is_owned(orig);
72752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72753         orig_conv.is_owned = false;
72754         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
72755         uint64_t ret_ref = 0;
72756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72758         return ret_ref;
72759 }
72760
72761 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
72762         LDKPaymentParameters o_conv;
72763         o_conv.inner = untag_ptr(o);
72764         o_conv.is_owned = ptr_is_owned(o);
72765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72766         o_conv.is_owned = false;
72767         int64_t ret_conv = PaymentParameters_hash(&o_conv);
72768         return ret_conv;
72769 }
72770
72771 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
72772         LDKPaymentParameters a_conv;
72773         a_conv.inner = untag_ptr(a);
72774         a_conv.is_owned = ptr_is_owned(a);
72775         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72776         a_conv.is_owned = false;
72777         LDKPaymentParameters b_conv;
72778         b_conv.inner = untag_ptr(b);
72779         b_conv.is_owned = ptr_is_owned(b);
72780         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72781         b_conv.is_owned = false;
72782         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
72783         return ret_conv;
72784 }
72785
72786 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
72787         LDKPaymentParameters obj_conv;
72788         obj_conv.inner = untag_ptr(obj);
72789         obj_conv.is_owned = ptr_is_owned(obj);
72790         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72791         obj_conv.is_owned = false;
72792         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
72793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72795         CVec_u8Z_free(ret_var);
72796         return ret_arr;
72797 }
72798
72799 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
72800         LDKu8slice ser_ref;
72801         ser_ref.datalen = ser->arr_len;
72802         ser_ref.data = ser->elems;
72803         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
72804         *ret_conv = PaymentParameters_read(ser_ref, arg);
72805         FREE(ser);
72806         return tag_ptr(ret_conv, true);
72807 }
72808
72809 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) {
72810         LDKPublicKey payee_pubkey_ref;
72811         CHECK(payee_pubkey->arr_len == 33);
72812         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
72813         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
72814         uint64_t ret_ref = 0;
72815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72817         return ret_ref;
72818 }
72819
72820 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) {
72821         LDKPublicKey payee_pubkey_ref;
72822         CHECK(payee_pubkey->arr_len == 33);
72823         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
72824         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
72825         uint64_t ret_ref = 0;
72826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72828         return ret_ref;
72829 }
72830
72831 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
72832         LDKBolt12Invoice invoice_conv;
72833         invoice_conv.inner = untag_ptr(invoice);
72834         invoice_conv.is_owned = ptr_is_owned(invoice);
72835         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
72836         invoice_conv.is_owned = false;
72837         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
72838         uint64_t ret_ref = 0;
72839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72841         return ret_ref;
72842 }
72843
72844 uint64_t  __attribute__((export_name("TS_PaymentParameters_blinded"))) TS_PaymentParameters_blinded(uint64_tArray blinded_route_hints) {
72845         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
72846         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
72847         if (blinded_route_hints_constr.datalen > 0)
72848                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72849         else
72850                 blinded_route_hints_constr.data = NULL;
72851         uint64_t* blinded_route_hints_vals = blinded_route_hints->elems;
72852         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
72853                 uint64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
72854                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
72855                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
72856                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
72857                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
72858                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
72859         }
72860         FREE(blinded_route_hints);
72861         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
72862         uint64_t ret_ref = 0;
72863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72865         return ret_ref;
72866 }
72867
72868 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
72869         if (!ptr_is_owned(this_ptr)) return;
72870         void* this_ptr_ptr = untag_ptr(this_ptr);
72871         CHECK_ACCESS(this_ptr_ptr);
72872         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
72873         FREE(untag_ptr(this_ptr));
72874         Payee_free(this_ptr_conv);
72875 }
72876
72877 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
72878         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
72879         *ret_copy = Payee_clone(arg);
72880         uint64_t ret_ref = tag_ptr(ret_copy, true);
72881         return ret_ref;
72882 }
72883 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
72884         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
72885         int64_t ret_conv = Payee_clone_ptr(arg_conv);
72886         return ret_conv;
72887 }
72888
72889 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
72890         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
72891         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
72892         *ret_copy = Payee_clone(orig_conv);
72893         uint64_t ret_ref = tag_ptr(ret_copy, true);
72894         return ret_ref;
72895 }
72896
72897 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
72898         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
72899         route_hints_constr.datalen = route_hints->arr_len;
72900         if (route_hints_constr.datalen > 0)
72901                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72902         else
72903                 route_hints_constr.data = NULL;
72904         uint64_t* route_hints_vals = route_hints->elems;
72905         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
72906                 uint64_t route_hints_conv_37 = route_hints_vals[l];
72907                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
72908                 CHECK_ACCESS(route_hints_conv_37_ptr);
72909                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
72910                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
72911                 route_hints_constr.data[l] = route_hints_conv_37_conv;
72912         }
72913         FREE(route_hints);
72914         LDKBolt12InvoiceFeatures features_conv;
72915         features_conv.inner = untag_ptr(features);
72916         features_conv.is_owned = ptr_is_owned(features);
72917         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
72918         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
72919         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
72920         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
72921         uint64_t ret_ref = tag_ptr(ret_copy, true);
72922         return ret_ref;
72923 }
72924
72925 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) {
72926         LDKPublicKey node_id_ref;
72927         CHECK(node_id->arr_len == 33);
72928         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72929         LDKCVec_RouteHintZ route_hints_constr;
72930         route_hints_constr.datalen = route_hints->arr_len;
72931         if (route_hints_constr.datalen > 0)
72932                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
72933         else
72934                 route_hints_constr.data = NULL;
72935         uint64_t* route_hints_vals = route_hints->elems;
72936         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
72937                 uint64_t route_hints_conv_11 = route_hints_vals[l];
72938                 LDKRouteHint route_hints_conv_11_conv;
72939                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
72940                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
72941                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
72942                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
72943                 route_hints_constr.data[l] = route_hints_conv_11_conv;
72944         }
72945         FREE(route_hints);
72946         LDKBolt11InvoiceFeatures features_conv;
72947         features_conv.inner = untag_ptr(features);
72948         features_conv.is_owned = ptr_is_owned(features);
72949         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
72950         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
72951         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
72952         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
72953         uint64_t ret_ref = tag_ptr(ret_copy, true);
72954         return ret_ref;
72955 }
72956
72957 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
72958         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
72959         int64_t ret_conv = Payee_hash(o_conv);
72960         return ret_conv;
72961 }
72962
72963 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
72964         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
72965         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
72966         jboolean ret_conv = Payee_eq(a_conv, b_conv);
72967         return ret_conv;
72968 }
72969
72970 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
72971         LDKRouteHint this_obj_conv;
72972         this_obj_conv.inner = untag_ptr(this_obj);
72973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72975         RouteHint_free(this_obj_conv);
72976 }
72977
72978 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
72979         LDKRouteHint this_ptr_conv;
72980         this_ptr_conv.inner = untag_ptr(this_ptr);
72981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72983         this_ptr_conv.is_owned = false;
72984         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
72985         uint64_tArray ret_arr = NULL;
72986         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
72987         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
72988         for (size_t o = 0; o < ret_var.datalen; o++) {
72989                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
72990                 uint64_t ret_conv_14_ref = 0;
72991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
72992                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
72993                 ret_arr_ptr[o] = ret_conv_14_ref;
72994         }
72995         
72996         FREE(ret_var.data);
72997         return ret_arr;
72998 }
72999
73000 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
73001         LDKRouteHint this_ptr_conv;
73002         this_ptr_conv.inner = untag_ptr(this_ptr);
73003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73005         this_ptr_conv.is_owned = false;
73006         LDKCVec_RouteHintHopZ val_constr;
73007         val_constr.datalen = val->arr_len;
73008         if (val_constr.datalen > 0)
73009                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
73010         else
73011                 val_constr.data = NULL;
73012         uint64_t* val_vals = val->elems;
73013         for (size_t o = 0; o < val_constr.datalen; o++) {
73014                 uint64_t val_conv_14 = val_vals[o];
73015                 LDKRouteHintHop val_conv_14_conv;
73016                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
73017                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
73018                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
73019                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
73020                 val_constr.data[o] = val_conv_14_conv;
73021         }
73022         FREE(val);
73023         RouteHint_set_a(&this_ptr_conv, val_constr);
73024 }
73025
73026 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
73027         LDKCVec_RouteHintHopZ a_arg_constr;
73028         a_arg_constr.datalen = a_arg->arr_len;
73029         if (a_arg_constr.datalen > 0)
73030                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
73031         else
73032                 a_arg_constr.data = NULL;
73033         uint64_t* a_arg_vals = a_arg->elems;
73034         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
73035                 uint64_t a_arg_conv_14 = a_arg_vals[o];
73036                 LDKRouteHintHop a_arg_conv_14_conv;
73037                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
73038                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
73039                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
73040                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
73041                 a_arg_constr.data[o] = a_arg_conv_14_conv;
73042         }
73043         FREE(a_arg);
73044         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
73045         uint64_t ret_ref = 0;
73046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73048         return ret_ref;
73049 }
73050
73051 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
73052         LDKRouteHint ret_var = RouteHint_clone(arg);
73053         uint64_t ret_ref = 0;
73054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73056         return ret_ref;
73057 }
73058 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
73059         LDKRouteHint arg_conv;
73060         arg_conv.inner = untag_ptr(arg);
73061         arg_conv.is_owned = ptr_is_owned(arg);
73062         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73063         arg_conv.is_owned = false;
73064         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
73065         return ret_conv;
73066 }
73067
73068 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
73069         LDKRouteHint orig_conv;
73070         orig_conv.inner = untag_ptr(orig);
73071         orig_conv.is_owned = ptr_is_owned(orig);
73072         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73073         orig_conv.is_owned = false;
73074         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
73075         uint64_t ret_ref = 0;
73076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73078         return ret_ref;
73079 }
73080
73081 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
73082         LDKRouteHint o_conv;
73083         o_conv.inner = untag_ptr(o);
73084         o_conv.is_owned = ptr_is_owned(o);
73085         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73086         o_conv.is_owned = false;
73087         int64_t ret_conv = RouteHint_hash(&o_conv);
73088         return ret_conv;
73089 }
73090
73091 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
73092         LDKRouteHint a_conv;
73093         a_conv.inner = untag_ptr(a);
73094         a_conv.is_owned = ptr_is_owned(a);
73095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73096         a_conv.is_owned = false;
73097         LDKRouteHint b_conv;
73098         b_conv.inner = untag_ptr(b);
73099         b_conv.is_owned = ptr_is_owned(b);
73100         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73101         b_conv.is_owned = false;
73102         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
73103         return ret_conv;
73104 }
73105
73106 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
73107         LDKRouteHint obj_conv;
73108         obj_conv.inner = untag_ptr(obj);
73109         obj_conv.is_owned = ptr_is_owned(obj);
73110         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73111         obj_conv.is_owned = false;
73112         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
73113         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73114         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73115         CVec_u8Z_free(ret_var);
73116         return ret_arr;
73117 }
73118
73119 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
73120         LDKu8slice ser_ref;
73121         ser_ref.datalen = ser->arr_len;
73122         ser_ref.data = ser->elems;
73123         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
73124         *ret_conv = RouteHint_read(ser_ref);
73125         FREE(ser);
73126         return tag_ptr(ret_conv, true);
73127 }
73128
73129 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
73130         LDKRouteHintHop this_obj_conv;
73131         this_obj_conv.inner = untag_ptr(this_obj);
73132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73134         RouteHintHop_free(this_obj_conv);
73135 }
73136
73137 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
73138         LDKRouteHintHop this_ptr_conv;
73139         this_ptr_conv.inner = untag_ptr(this_ptr);
73140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73142         this_ptr_conv.is_owned = false;
73143         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
73144         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
73145         return ret_arr;
73146 }
73147
73148 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
73149         LDKRouteHintHop this_ptr_conv;
73150         this_ptr_conv.inner = untag_ptr(this_ptr);
73151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73153         this_ptr_conv.is_owned = false;
73154         LDKPublicKey val_ref;
73155         CHECK(val->arr_len == 33);
73156         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
73157         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
73158 }
73159
73160 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
73161         LDKRouteHintHop this_ptr_conv;
73162         this_ptr_conv.inner = untag_ptr(this_ptr);
73163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73165         this_ptr_conv.is_owned = false;
73166         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
73167         return ret_conv;
73168 }
73169
73170 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
73171         LDKRouteHintHop this_ptr_conv;
73172         this_ptr_conv.inner = untag_ptr(this_ptr);
73173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73175         this_ptr_conv.is_owned = false;
73176         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
73177 }
73178
73179 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
73180         LDKRouteHintHop this_ptr_conv;
73181         this_ptr_conv.inner = untag_ptr(this_ptr);
73182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73184         this_ptr_conv.is_owned = false;
73185         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
73186         uint64_t ret_ref = 0;
73187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73189         return ret_ref;
73190 }
73191
73192 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
73193         LDKRouteHintHop this_ptr_conv;
73194         this_ptr_conv.inner = untag_ptr(this_ptr);
73195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73197         this_ptr_conv.is_owned = false;
73198         LDKRoutingFees val_conv;
73199         val_conv.inner = untag_ptr(val);
73200         val_conv.is_owned = ptr_is_owned(val);
73201         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73202         val_conv = RoutingFees_clone(&val_conv);
73203         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
73204 }
73205
73206 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
73207         LDKRouteHintHop this_ptr_conv;
73208         this_ptr_conv.inner = untag_ptr(this_ptr);
73209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73211         this_ptr_conv.is_owned = false;
73212         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
73213         return ret_conv;
73214 }
73215
73216 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
73217         LDKRouteHintHop this_ptr_conv;
73218         this_ptr_conv.inner = untag_ptr(this_ptr);
73219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73221         this_ptr_conv.is_owned = false;
73222         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
73223 }
73224
73225 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
73226         LDKRouteHintHop this_ptr_conv;
73227         this_ptr_conv.inner = untag_ptr(this_ptr);
73228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73230         this_ptr_conv.is_owned = false;
73231         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73232         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
73233         uint64_t ret_ref = tag_ptr(ret_copy, true);
73234         return ret_ref;
73235 }
73236
73237 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
73238         LDKRouteHintHop this_ptr_conv;
73239         this_ptr_conv.inner = untag_ptr(this_ptr);
73240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73242         this_ptr_conv.is_owned = false;
73243         void* val_ptr = untag_ptr(val);
73244         CHECK_ACCESS(val_ptr);
73245         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
73246         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
73247         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
73248 }
73249
73250 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
73251         LDKRouteHintHop this_ptr_conv;
73252         this_ptr_conv.inner = untag_ptr(this_ptr);
73253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73255         this_ptr_conv.is_owned = false;
73256         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73257         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
73258         uint64_t ret_ref = tag_ptr(ret_copy, true);
73259         return ret_ref;
73260 }
73261
73262 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
73263         LDKRouteHintHop this_ptr_conv;
73264         this_ptr_conv.inner = untag_ptr(this_ptr);
73265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73267         this_ptr_conv.is_owned = false;
73268         void* val_ptr = untag_ptr(val);
73269         CHECK_ACCESS(val_ptr);
73270         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
73271         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
73272         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
73273 }
73274
73275 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) {
73276         LDKPublicKey src_node_id_arg_ref;
73277         CHECK(src_node_id_arg->arr_len == 33);
73278         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
73279         LDKRoutingFees fees_arg_conv;
73280         fees_arg_conv.inner = untag_ptr(fees_arg);
73281         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
73282         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
73283         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
73284         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
73285         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
73286         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
73287         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
73288         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
73289         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
73290         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
73291         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
73292         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);
73293         uint64_t ret_ref = 0;
73294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73296         return ret_ref;
73297 }
73298
73299 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
73300         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
73301         uint64_t ret_ref = 0;
73302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73304         return ret_ref;
73305 }
73306 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
73307         LDKRouteHintHop arg_conv;
73308         arg_conv.inner = untag_ptr(arg);
73309         arg_conv.is_owned = ptr_is_owned(arg);
73310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73311         arg_conv.is_owned = false;
73312         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
73313         return ret_conv;
73314 }
73315
73316 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
73317         LDKRouteHintHop orig_conv;
73318         orig_conv.inner = untag_ptr(orig);
73319         orig_conv.is_owned = ptr_is_owned(orig);
73320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73321         orig_conv.is_owned = false;
73322         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
73323         uint64_t ret_ref = 0;
73324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73326         return ret_ref;
73327 }
73328
73329 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
73330         LDKRouteHintHop o_conv;
73331         o_conv.inner = untag_ptr(o);
73332         o_conv.is_owned = ptr_is_owned(o);
73333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73334         o_conv.is_owned = false;
73335         int64_t ret_conv = RouteHintHop_hash(&o_conv);
73336         return ret_conv;
73337 }
73338
73339 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
73340         LDKRouteHintHop a_conv;
73341         a_conv.inner = untag_ptr(a);
73342         a_conv.is_owned = ptr_is_owned(a);
73343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73344         a_conv.is_owned = false;
73345         LDKRouteHintHop b_conv;
73346         b_conv.inner = untag_ptr(b);
73347         b_conv.is_owned = ptr_is_owned(b);
73348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73349         b_conv.is_owned = false;
73350         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
73351         return ret_conv;
73352 }
73353
73354 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
73355         LDKRouteHintHop obj_conv;
73356         obj_conv.inner = untag_ptr(obj);
73357         obj_conv.is_owned = ptr_is_owned(obj);
73358         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73359         obj_conv.is_owned = false;
73360         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
73361         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73362         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73363         CVec_u8Z_free(ret_var);
73364         return ret_arr;
73365 }
73366
73367 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
73368         LDKu8slice ser_ref;
73369         ser_ref.datalen = ser->arr_len;
73370         ser_ref.data = ser->elems;
73371         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
73372         *ret_conv = RouteHintHop_read(ser_ref);
73373         FREE(ser);
73374         return tag_ptr(ret_conv, true);
73375 }
73376
73377 void  __attribute__((export_name("TS_FirstHopCandidate_free"))) TS_FirstHopCandidate_free(uint64_t this_obj) {
73378         LDKFirstHopCandidate this_obj_conv;
73379         this_obj_conv.inner = untag_ptr(this_obj);
73380         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73382         FirstHopCandidate_free(this_obj_conv);
73383 }
73384
73385 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
73386         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
73387         uint64_t ret_ref = 0;
73388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73390         return ret_ref;
73391 }
73392 int64_t  __attribute__((export_name("TS_FirstHopCandidate_clone_ptr"))) TS_FirstHopCandidate_clone_ptr(uint64_t arg) {
73393         LDKFirstHopCandidate arg_conv;
73394         arg_conv.inner = untag_ptr(arg);
73395         arg_conv.is_owned = ptr_is_owned(arg);
73396         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73397         arg_conv.is_owned = false;
73398         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
73399         return ret_conv;
73400 }
73401
73402 uint64_t  __attribute__((export_name("TS_FirstHopCandidate_clone"))) TS_FirstHopCandidate_clone(uint64_t orig) {
73403         LDKFirstHopCandidate orig_conv;
73404         orig_conv.inner = untag_ptr(orig);
73405         orig_conv.is_owned = ptr_is_owned(orig);
73406         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73407         orig_conv.is_owned = false;
73408         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
73409         uint64_t ret_ref = 0;
73410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73412         return ret_ref;
73413 }
73414
73415 void  __attribute__((export_name("TS_PublicHopCandidate_free"))) TS_PublicHopCandidate_free(uint64_t this_obj) {
73416         LDKPublicHopCandidate this_obj_conv;
73417         this_obj_conv.inner = untag_ptr(this_obj);
73418         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73420         PublicHopCandidate_free(this_obj_conv);
73421 }
73422
73423 int64_t  __attribute__((export_name("TS_PublicHopCandidate_get_short_channel_id"))) TS_PublicHopCandidate_get_short_channel_id(uint64_t this_ptr) {
73424         LDKPublicHopCandidate this_ptr_conv;
73425         this_ptr_conv.inner = untag_ptr(this_ptr);
73426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73428         this_ptr_conv.is_owned = false;
73429         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
73430         return ret_conv;
73431 }
73432
73433 void  __attribute__((export_name("TS_PublicHopCandidate_set_short_channel_id"))) TS_PublicHopCandidate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
73434         LDKPublicHopCandidate this_ptr_conv;
73435         this_ptr_conv.inner = untag_ptr(this_ptr);
73436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73438         this_ptr_conv.is_owned = false;
73439         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
73440 }
73441
73442 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
73443         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
73444         uint64_t ret_ref = 0;
73445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73447         return ret_ref;
73448 }
73449 int64_t  __attribute__((export_name("TS_PublicHopCandidate_clone_ptr"))) TS_PublicHopCandidate_clone_ptr(uint64_t arg) {
73450         LDKPublicHopCandidate arg_conv;
73451         arg_conv.inner = untag_ptr(arg);
73452         arg_conv.is_owned = ptr_is_owned(arg);
73453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73454         arg_conv.is_owned = false;
73455         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
73456         return ret_conv;
73457 }
73458
73459 uint64_t  __attribute__((export_name("TS_PublicHopCandidate_clone"))) TS_PublicHopCandidate_clone(uint64_t orig) {
73460         LDKPublicHopCandidate orig_conv;
73461         orig_conv.inner = untag_ptr(orig);
73462         orig_conv.is_owned = ptr_is_owned(orig);
73463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73464         orig_conv.is_owned = false;
73465         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
73466         uint64_t ret_ref = 0;
73467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73469         return ret_ref;
73470 }
73471
73472 void  __attribute__((export_name("TS_PrivateHopCandidate_free"))) TS_PrivateHopCandidate_free(uint64_t this_obj) {
73473         LDKPrivateHopCandidate this_obj_conv;
73474         this_obj_conv.inner = untag_ptr(this_obj);
73475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73477         PrivateHopCandidate_free(this_obj_conv);
73478 }
73479
73480 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
73481         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
73482         uint64_t ret_ref = 0;
73483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73485         return ret_ref;
73486 }
73487 int64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone_ptr"))) TS_PrivateHopCandidate_clone_ptr(uint64_t arg) {
73488         LDKPrivateHopCandidate arg_conv;
73489         arg_conv.inner = untag_ptr(arg);
73490         arg_conv.is_owned = ptr_is_owned(arg);
73491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73492         arg_conv.is_owned = false;
73493         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
73494         return ret_conv;
73495 }
73496
73497 uint64_t  __attribute__((export_name("TS_PrivateHopCandidate_clone"))) TS_PrivateHopCandidate_clone(uint64_t orig) {
73498         LDKPrivateHopCandidate orig_conv;
73499         orig_conv.inner = untag_ptr(orig);
73500         orig_conv.is_owned = ptr_is_owned(orig);
73501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73502         orig_conv.is_owned = false;
73503         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
73504         uint64_t ret_ref = 0;
73505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73507         return ret_ref;
73508 }
73509
73510 void  __attribute__((export_name("TS_BlindedPathCandidate_free"))) TS_BlindedPathCandidate_free(uint64_t this_obj) {
73511         LDKBlindedPathCandidate this_obj_conv;
73512         this_obj_conv.inner = untag_ptr(this_obj);
73513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73515         BlindedPathCandidate_free(this_obj_conv);
73516 }
73517
73518 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
73519         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
73520         uint64_t ret_ref = 0;
73521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73523         return ret_ref;
73524 }
73525 int64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone_ptr"))) TS_BlindedPathCandidate_clone_ptr(uint64_t arg) {
73526         LDKBlindedPathCandidate arg_conv;
73527         arg_conv.inner = untag_ptr(arg);
73528         arg_conv.is_owned = ptr_is_owned(arg);
73529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73530         arg_conv.is_owned = false;
73531         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
73532         return ret_conv;
73533 }
73534
73535 uint64_t  __attribute__((export_name("TS_BlindedPathCandidate_clone"))) TS_BlindedPathCandidate_clone(uint64_t orig) {
73536         LDKBlindedPathCandidate orig_conv;
73537         orig_conv.inner = untag_ptr(orig);
73538         orig_conv.is_owned = ptr_is_owned(orig);
73539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73540         orig_conv.is_owned = false;
73541         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
73542         uint64_t ret_ref = 0;
73543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73545         return ret_ref;
73546 }
73547
73548 void  __attribute__((export_name("TS_OneHopBlindedPathCandidate_free"))) TS_OneHopBlindedPathCandidate_free(uint64_t this_obj) {
73549         LDKOneHopBlindedPathCandidate this_obj_conv;
73550         this_obj_conv.inner = untag_ptr(this_obj);
73551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73553         OneHopBlindedPathCandidate_free(this_obj_conv);
73554 }
73555
73556 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
73557         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
73558         uint64_t ret_ref = 0;
73559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73561         return ret_ref;
73562 }
73563 int64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone_ptr"))) TS_OneHopBlindedPathCandidate_clone_ptr(uint64_t arg) {
73564         LDKOneHopBlindedPathCandidate arg_conv;
73565         arg_conv.inner = untag_ptr(arg);
73566         arg_conv.is_owned = ptr_is_owned(arg);
73567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73568         arg_conv.is_owned = false;
73569         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
73570         return ret_conv;
73571 }
73572
73573 uint64_t  __attribute__((export_name("TS_OneHopBlindedPathCandidate_clone"))) TS_OneHopBlindedPathCandidate_clone(uint64_t orig) {
73574         LDKOneHopBlindedPathCandidate orig_conv;
73575         orig_conv.inner = untag_ptr(orig);
73576         orig_conv.is_owned = ptr_is_owned(orig);
73577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73578         orig_conv.is_owned = false;
73579         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
73580         uint64_t ret_ref = 0;
73581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73583         return ret_ref;
73584 }
73585
73586 void  __attribute__((export_name("TS_CandidateRouteHop_free"))) TS_CandidateRouteHop_free(uint64_t this_ptr) {
73587         if (!ptr_is_owned(this_ptr)) return;
73588         void* this_ptr_ptr = untag_ptr(this_ptr);
73589         CHECK_ACCESS(this_ptr_ptr);
73590         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
73591         FREE(untag_ptr(this_ptr));
73592         CandidateRouteHop_free(this_ptr_conv);
73593 }
73594
73595 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
73596         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73597         *ret_copy = CandidateRouteHop_clone(arg);
73598         uint64_t ret_ref = tag_ptr(ret_copy, true);
73599         return ret_ref;
73600 }
73601 int64_t  __attribute__((export_name("TS_CandidateRouteHop_clone_ptr"))) TS_CandidateRouteHop_clone_ptr(uint64_t arg) {
73602         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
73603         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
73604         return ret_conv;
73605 }
73606
73607 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_clone"))) TS_CandidateRouteHop_clone(uint64_t orig) {
73608         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
73609         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73610         *ret_copy = CandidateRouteHop_clone(orig_conv);
73611         uint64_t ret_ref = tag_ptr(ret_copy, true);
73612         return ret_ref;
73613 }
73614
73615 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_first_hop"))) TS_CandidateRouteHop_first_hop(uint64_t a) {
73616         LDKFirstHopCandidate a_conv;
73617         a_conv.inner = untag_ptr(a);
73618         a_conv.is_owned = ptr_is_owned(a);
73619         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73620         a_conv = FirstHopCandidate_clone(&a_conv);
73621         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73622         *ret_copy = CandidateRouteHop_first_hop(a_conv);
73623         uint64_t ret_ref = tag_ptr(ret_copy, true);
73624         return ret_ref;
73625 }
73626
73627 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_public_hop"))) TS_CandidateRouteHop_public_hop(uint64_t a) {
73628         LDKPublicHopCandidate a_conv;
73629         a_conv.inner = untag_ptr(a);
73630         a_conv.is_owned = ptr_is_owned(a);
73631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73632         a_conv = PublicHopCandidate_clone(&a_conv);
73633         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73634         *ret_copy = CandidateRouteHop_public_hop(a_conv);
73635         uint64_t ret_ref = tag_ptr(ret_copy, true);
73636         return ret_ref;
73637 }
73638
73639 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_private_hop"))) TS_CandidateRouteHop_private_hop(uint64_t a) {
73640         LDKPrivateHopCandidate a_conv;
73641         a_conv.inner = untag_ptr(a);
73642         a_conv.is_owned = ptr_is_owned(a);
73643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73644         a_conv = PrivateHopCandidate_clone(&a_conv);
73645         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73646         *ret_copy = CandidateRouteHop_private_hop(a_conv);
73647         uint64_t ret_ref = tag_ptr(ret_copy, true);
73648         return ret_ref;
73649 }
73650
73651 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_blinded"))) TS_CandidateRouteHop_blinded(uint64_t a) {
73652         LDKBlindedPathCandidate a_conv;
73653         a_conv.inner = untag_ptr(a);
73654         a_conv.is_owned = ptr_is_owned(a);
73655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73656         a_conv = BlindedPathCandidate_clone(&a_conv);
73657         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73658         *ret_copy = CandidateRouteHop_blinded(a_conv);
73659         uint64_t ret_ref = tag_ptr(ret_copy, true);
73660         return ret_ref;
73661 }
73662
73663 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_one_hop_blinded"))) TS_CandidateRouteHop_one_hop_blinded(uint64_t a) {
73664         LDKOneHopBlindedPathCandidate a_conv;
73665         a_conv.inner = untag_ptr(a);
73666         a_conv.is_owned = ptr_is_owned(a);
73667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73668         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
73669         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
73670         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
73671         uint64_t ret_ref = tag_ptr(ret_copy, true);
73672         return ret_ref;
73673 }
73674
73675 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_globally_unique_short_channel_id"))) TS_CandidateRouteHop_globally_unique_short_channel_id(uint64_t this_arg) {
73676         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
73677         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73678         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
73679         uint64_t ret_ref = tag_ptr(ret_copy, true);
73680         return ret_ref;
73681 }
73682
73683 int32_t  __attribute__((export_name("TS_CandidateRouteHop_cltv_expiry_delta"))) TS_CandidateRouteHop_cltv_expiry_delta(uint64_t this_arg) {
73684         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
73685         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
73686         return ret_conv;
73687 }
73688
73689 int64_t  __attribute__((export_name("TS_CandidateRouteHop_htlc_minimum_msat"))) TS_CandidateRouteHop_htlc_minimum_msat(uint64_t this_arg) {
73690         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
73691         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
73692         return ret_conv;
73693 }
73694
73695 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_fees"))) TS_CandidateRouteHop_fees(uint64_t this_arg) {
73696         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
73697         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
73698         uint64_t ret_ref = 0;
73699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73701         return ret_ref;
73702 }
73703
73704 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_source"))) TS_CandidateRouteHop_source(uint64_t this_arg) {
73705         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
73706         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
73707         uint64_t ret_ref = 0;
73708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73710         return ret_ref;
73711 }
73712
73713 uint64_t  __attribute__((export_name("TS_CandidateRouteHop_target"))) TS_CandidateRouteHop_target(uint64_t this_arg) {
73714         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
73715         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
73716         uint64_t ret_ref = 0;
73717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73719         return ret_ref;
73720 }
73721
73722 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) {
73723         LDKPublicKey our_node_pubkey_ref;
73724         CHECK(our_node_pubkey->arr_len == 33);
73725         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
73726         LDKRouteParameters route_params_conv;
73727         route_params_conv.inner = untag_ptr(route_params);
73728         route_params_conv.is_owned = ptr_is_owned(route_params);
73729         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
73730         route_params_conv.is_owned = false;
73731         LDKNetworkGraph network_graph_conv;
73732         network_graph_conv.inner = untag_ptr(network_graph);
73733         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73734         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73735         network_graph_conv.is_owned = false;
73736         LDKCVec_ChannelDetailsZ first_hops_constr;
73737         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
73738         if (first_hops != 0) {
73739                 first_hops_constr.datalen = first_hops->arr_len;
73740                 if (first_hops_constr.datalen > 0)
73741                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
73742                 else
73743                         first_hops_constr.data = NULL;
73744                 uint64_t* first_hops_vals = first_hops->elems;
73745                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
73746                         uint64_t first_hops_conv_16 = first_hops_vals[q];
73747                         LDKChannelDetails first_hops_conv_16_conv;
73748                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
73749                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
73750                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
73751                         first_hops_conv_16_conv.is_owned = false;
73752                         first_hops_constr.data[q] = first_hops_conv_16_conv;
73753                 }
73754                 FREE(first_hops);
73755                 first_hops_ptr = &first_hops_constr;
73756         }
73757         void* logger_ptr = untag_ptr(logger);
73758         CHECK_ACCESS(logger_ptr);
73759         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73760         if (logger_conv.free == LDKLogger_JCalls_free) {
73761                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73762                 LDKLogger_JCalls_cloned(&logger_conv);
73763         }
73764         void* scorer_ptr = untag_ptr(scorer);
73765         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
73766         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
73767         LDKProbabilisticScoringFeeParameters score_params_conv;
73768         score_params_conv.inner = untag_ptr(score_params);
73769         score_params_conv.is_owned = ptr_is_owned(score_params);
73770         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
73771         score_params_conv.is_owned = false;
73772         uint8_t random_seed_bytes_arr[32];
73773         CHECK(random_seed_bytes->arr_len == 32);
73774         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
73775         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
73776         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
73777         *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);
73778         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
73779         return tag_ptr(ret_conv, true);
73780 }
73781
73782 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) {
73783         LDKPublicKey our_node_pubkey_ref;
73784         CHECK(our_node_pubkey->arr_len == 33);
73785         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
73786         LDKCVec_PublicKeyZ hops_constr;
73787         hops_constr.datalen = hops->arr_len;
73788         if (hops_constr.datalen > 0)
73789                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
73790         else
73791                 hops_constr.data = NULL;
73792         int8_tArray* hops_vals = (void*) hops->elems;
73793         for (size_t m = 0; m < hops_constr.datalen; m++) {
73794                 int8_tArray hops_conv_12 = hops_vals[m];
73795                 LDKPublicKey hops_conv_12_ref;
73796                 CHECK(hops_conv_12->arr_len == 33);
73797                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
73798                 hops_constr.data[m] = hops_conv_12_ref;
73799         }
73800         FREE(hops);
73801         LDKRouteParameters route_params_conv;
73802         route_params_conv.inner = untag_ptr(route_params);
73803         route_params_conv.is_owned = ptr_is_owned(route_params);
73804         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
73805         route_params_conv.is_owned = false;
73806         LDKNetworkGraph network_graph_conv;
73807         network_graph_conv.inner = untag_ptr(network_graph);
73808         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73809         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73810         network_graph_conv.is_owned = false;
73811         void* logger_ptr = untag_ptr(logger);
73812         CHECK_ACCESS(logger_ptr);
73813         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73814         if (logger_conv.free == LDKLogger_JCalls_free) {
73815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73816                 LDKLogger_JCalls_cloned(&logger_conv);
73817         }
73818         uint8_t random_seed_bytes_arr[32];
73819         CHECK(random_seed_bytes->arr_len == 32);
73820         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
73821         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
73822         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
73823         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
73824         return tag_ptr(ret_conv, true);
73825 }
73826
73827 void  __attribute__((export_name("TS_ScoreLookUp_free"))) TS_ScoreLookUp_free(uint64_t this_ptr) {
73828         if (!ptr_is_owned(this_ptr)) return;
73829         void* this_ptr_ptr = untag_ptr(this_ptr);
73830         CHECK_ACCESS(this_ptr_ptr);
73831         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
73832         FREE(untag_ptr(this_ptr));
73833         ScoreLookUp_free(this_ptr_conv);
73834 }
73835
73836 void  __attribute__((export_name("TS_ScoreUpdate_free"))) TS_ScoreUpdate_free(uint64_t this_ptr) {
73837         if (!ptr_is_owned(this_ptr)) return;
73838         void* this_ptr_ptr = untag_ptr(this_ptr);
73839         CHECK_ACCESS(this_ptr_ptr);
73840         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
73841         FREE(untag_ptr(this_ptr));
73842         ScoreUpdate_free(this_ptr_conv);
73843 }
73844
73845 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
73846         if (!ptr_is_owned(this_ptr)) return;
73847         void* this_ptr_ptr = untag_ptr(this_ptr);
73848         CHECK_ACCESS(this_ptr_ptr);
73849         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
73850         FREE(untag_ptr(this_ptr));
73851         Score_free(this_ptr_conv);
73852 }
73853
73854 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
73855         if (!ptr_is_owned(this_ptr)) return;
73856         void* this_ptr_ptr = untag_ptr(this_ptr);
73857         CHECK_ACCESS(this_ptr_ptr);
73858         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
73859         FREE(untag_ptr(this_ptr));
73860         LockableScore_free(this_ptr_conv);
73861 }
73862
73863 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
73864         if (!ptr_is_owned(this_ptr)) return;
73865         void* this_ptr_ptr = untag_ptr(this_ptr);
73866         CHECK_ACCESS(this_ptr_ptr);
73867         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
73868         FREE(untag_ptr(this_ptr));
73869         WriteableScore_free(this_ptr_conv);
73870 }
73871
73872 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
73873         LDKMultiThreadedLockableScore this_obj_conv;
73874         this_obj_conv.inner = untag_ptr(this_obj);
73875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73877         MultiThreadedLockableScore_free(this_obj_conv);
73878 }
73879
73880 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
73881         LDKMultiThreadedLockableScore this_arg_conv;
73882         this_arg_conv.inner = untag_ptr(this_arg);
73883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73885         this_arg_conv.is_owned = false;
73886         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
73887         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
73888         return tag_ptr(ret_ret, true);
73889 }
73890
73891 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
73892         LDKMultiThreadedLockableScore obj_conv;
73893         obj_conv.inner = untag_ptr(obj);
73894         obj_conv.is_owned = ptr_is_owned(obj);
73895         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73896         obj_conv.is_owned = false;
73897         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
73898         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73899         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73900         CVec_u8Z_free(ret_var);
73901         return ret_arr;
73902 }
73903
73904 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
73905         LDKMultiThreadedLockableScore this_arg_conv;
73906         this_arg_conv.inner = untag_ptr(this_arg);
73907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73909         this_arg_conv.is_owned = false;
73910         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
73911         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
73912         return tag_ptr(ret_ret, true);
73913 }
73914
73915 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
73916         void* score_ptr = untag_ptr(score);
73917         CHECK_ACCESS(score_ptr);
73918         LDKScore score_conv = *(LDKScore*)(score_ptr);
73919         if (score_conv.free == LDKScore_JCalls_free) {
73920                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73921                 LDKScore_JCalls_cloned(&score_conv);
73922         }
73923         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
73924         uint64_t ret_ref = 0;
73925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73927         return ret_ref;
73928 }
73929
73930 void  __attribute__((export_name("TS_MultiThreadedScoreLockRead_free"))) TS_MultiThreadedScoreLockRead_free(uint64_t this_obj) {
73931         LDKMultiThreadedScoreLockRead this_obj_conv;
73932         this_obj_conv.inner = untag_ptr(this_obj);
73933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73935         MultiThreadedScoreLockRead_free(this_obj_conv);
73936 }
73937
73938 void  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_free"))) TS_MultiThreadedScoreLockWrite_free(uint64_t this_obj) {
73939         LDKMultiThreadedScoreLockWrite this_obj_conv;
73940         this_obj_conv.inner = untag_ptr(this_obj);
73941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73943         MultiThreadedScoreLockWrite_free(this_obj_conv);
73944 }
73945
73946 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockRead_as_ScoreLookUp"))) TS_MultiThreadedScoreLockRead_as_ScoreLookUp(uint64_t this_arg) {
73947         LDKMultiThreadedScoreLockRead this_arg_conv;
73948         this_arg_conv.inner = untag_ptr(this_arg);
73949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73951         this_arg_conv.is_owned = false;
73952         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
73953         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
73954         return tag_ptr(ret_ret, true);
73955 }
73956
73957 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_write"))) TS_MultiThreadedScoreLockWrite_write(uint64_t obj) {
73958         LDKMultiThreadedScoreLockWrite obj_conv;
73959         obj_conv.inner = untag_ptr(obj);
73960         obj_conv.is_owned = ptr_is_owned(obj);
73961         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73962         obj_conv.is_owned = false;
73963         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
73964         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73965         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73966         CVec_u8Z_free(ret_var);
73967         return ret_arr;
73968 }
73969
73970 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLockWrite_as_ScoreUpdate"))) TS_MultiThreadedScoreLockWrite_as_ScoreUpdate(uint64_t this_arg) {
73971         LDKMultiThreadedScoreLockWrite this_arg_conv;
73972         this_arg_conv.inner = untag_ptr(this_arg);
73973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73975         this_arg_conv.is_owned = false;
73976         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73977         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
73978         return tag_ptr(ret_ret, true);
73979 }
73980
73981 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
73982         LDKChannelUsage this_obj_conv;
73983         this_obj_conv.inner = untag_ptr(this_obj);
73984         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73986         ChannelUsage_free(this_obj_conv);
73987 }
73988
73989 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
73990         LDKChannelUsage this_ptr_conv;
73991         this_ptr_conv.inner = untag_ptr(this_ptr);
73992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73994         this_ptr_conv.is_owned = false;
73995         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
73996         return ret_conv;
73997 }
73998
73999 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
74000         LDKChannelUsage this_ptr_conv;
74001         this_ptr_conv.inner = untag_ptr(this_ptr);
74002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74004         this_ptr_conv.is_owned = false;
74005         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
74006 }
74007
74008 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
74009         LDKChannelUsage this_ptr_conv;
74010         this_ptr_conv.inner = untag_ptr(this_ptr);
74011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74013         this_ptr_conv.is_owned = false;
74014         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
74015         return ret_conv;
74016 }
74017
74018 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
74019         LDKChannelUsage this_ptr_conv;
74020         this_ptr_conv.inner = untag_ptr(this_ptr);
74021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74023         this_ptr_conv.is_owned = false;
74024         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
74025 }
74026
74027 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
74028         LDKChannelUsage this_ptr_conv;
74029         this_ptr_conv.inner = untag_ptr(this_ptr);
74030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74032         this_ptr_conv.is_owned = false;
74033         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74034         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
74035         uint64_t ret_ref = tag_ptr(ret_copy, true);
74036         return ret_ref;
74037 }
74038
74039 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
74040         LDKChannelUsage this_ptr_conv;
74041         this_ptr_conv.inner = untag_ptr(this_ptr);
74042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74044         this_ptr_conv.is_owned = false;
74045         void* val_ptr = untag_ptr(val);
74046         CHECK_ACCESS(val_ptr);
74047         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
74048         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
74049         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
74050 }
74051
74052 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) {
74053         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
74054         CHECK_ACCESS(effective_capacity_arg_ptr);
74055         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
74056         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
74057         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
74058         uint64_t ret_ref = 0;
74059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74061         return ret_ref;
74062 }
74063
74064 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
74065         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
74066         uint64_t ret_ref = 0;
74067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74069         return ret_ref;
74070 }
74071 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
74072         LDKChannelUsage arg_conv;
74073         arg_conv.inner = untag_ptr(arg);
74074         arg_conv.is_owned = ptr_is_owned(arg);
74075         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74076         arg_conv.is_owned = false;
74077         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
74078         return ret_conv;
74079 }
74080
74081 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
74082         LDKChannelUsage orig_conv;
74083         orig_conv.inner = untag_ptr(orig);
74084         orig_conv.is_owned = ptr_is_owned(orig);
74085         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74086         orig_conv.is_owned = false;
74087         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
74088         uint64_t ret_ref = 0;
74089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74091         return ret_ref;
74092 }
74093
74094 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
74095         LDKFixedPenaltyScorer this_obj_conv;
74096         this_obj_conv.inner = untag_ptr(this_obj);
74097         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74099         FixedPenaltyScorer_free(this_obj_conv);
74100 }
74101
74102 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
74103         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
74104         uint64_t ret_ref = 0;
74105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74107         return ret_ref;
74108 }
74109 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
74110         LDKFixedPenaltyScorer arg_conv;
74111         arg_conv.inner = untag_ptr(arg);
74112         arg_conv.is_owned = ptr_is_owned(arg);
74113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74114         arg_conv.is_owned = false;
74115         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
74116         return ret_conv;
74117 }
74118
74119 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
74120         LDKFixedPenaltyScorer orig_conv;
74121         orig_conv.inner = untag_ptr(orig);
74122         orig_conv.is_owned = ptr_is_owned(orig);
74123         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74124         orig_conv.is_owned = false;
74125         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
74126         uint64_t ret_ref = 0;
74127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74129         return ret_ref;
74130 }
74131
74132 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
74133         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
74134         uint64_t ret_ref = 0;
74135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74137         return ret_ref;
74138 }
74139
74140 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreLookUp"))) TS_FixedPenaltyScorer_as_ScoreLookUp(uint64_t this_arg) {
74141         LDKFixedPenaltyScorer this_arg_conv;
74142         this_arg_conv.inner = untag_ptr(this_arg);
74143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74145         this_arg_conv.is_owned = false;
74146         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
74147         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
74148         return tag_ptr(ret_ret, true);
74149 }
74150
74151 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_ScoreUpdate"))) TS_FixedPenaltyScorer_as_ScoreUpdate(uint64_t this_arg) {
74152         LDKFixedPenaltyScorer this_arg_conv;
74153         this_arg_conv.inner = untag_ptr(this_arg);
74154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74156         this_arg_conv.is_owned = false;
74157         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
74158         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
74159         return tag_ptr(ret_ret, true);
74160 }
74161
74162 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
74163         LDKFixedPenaltyScorer obj_conv;
74164         obj_conv.inner = untag_ptr(obj);
74165         obj_conv.is_owned = ptr_is_owned(obj);
74166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74167         obj_conv.is_owned = false;
74168         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
74169         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74170         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74171         CVec_u8Z_free(ret_var);
74172         return ret_arr;
74173 }
74174
74175 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
74176         LDKu8slice ser_ref;
74177         ser_ref.datalen = ser->arr_len;
74178         ser_ref.data = ser->elems;
74179         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
74180         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
74181         FREE(ser);
74182         return tag_ptr(ret_conv, true);
74183 }
74184
74185 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
74186         LDKProbabilisticScorer this_obj_conv;
74187         this_obj_conv.inner = untag_ptr(this_obj);
74188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74190         ProbabilisticScorer_free(this_obj_conv);
74191 }
74192
74193 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
74194         LDKProbabilisticScoringFeeParameters this_obj_conv;
74195         this_obj_conv.inner = untag_ptr(this_obj);
74196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74198         ProbabilisticScoringFeeParameters_free(this_obj_conv);
74199 }
74200
74201 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
74202         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74203         this_ptr_conv.inner = untag_ptr(this_ptr);
74204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74206         this_ptr_conv.is_owned = false;
74207         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
74208         return ret_conv;
74209 }
74210
74211 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
74212         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74213         this_ptr_conv.inner = untag_ptr(this_ptr);
74214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74216         this_ptr_conv.is_owned = false;
74217         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
74218 }
74219
74220 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) {
74221         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74222         this_ptr_conv.inner = untag_ptr(this_ptr);
74223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74225         this_ptr_conv.is_owned = false;
74226         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
74227         return ret_conv;
74228 }
74229
74230 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) {
74231         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74232         this_ptr_conv.inner = untag_ptr(this_ptr);
74233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74235         this_ptr_conv.is_owned = false;
74236         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
74237 }
74238
74239 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
74240         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74241         this_ptr_conv.inner = untag_ptr(this_ptr);
74242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74244         this_ptr_conv.is_owned = false;
74245         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
74246         return ret_conv;
74247 }
74248
74249 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) {
74250         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74251         this_ptr_conv.inner = untag_ptr(this_ptr);
74252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74254         this_ptr_conv.is_owned = false;
74255         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
74256 }
74257
74258 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) {
74259         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74260         this_ptr_conv.inner = untag_ptr(this_ptr);
74261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74263         this_ptr_conv.is_owned = false;
74264         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
74265         return ret_conv;
74266 }
74267
74268 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) {
74269         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74270         this_ptr_conv.inner = untag_ptr(this_ptr);
74271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74273         this_ptr_conv.is_owned = false;
74274         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
74275 }
74276
74277 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) {
74278         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74279         this_ptr_conv.inner = untag_ptr(this_ptr);
74280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74282         this_ptr_conv.is_owned = false;
74283         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
74284         return ret_conv;
74285 }
74286
74287 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) {
74288         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74289         this_ptr_conv.inner = untag_ptr(this_ptr);
74290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74292         this_ptr_conv.is_owned = false;
74293         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
74294 }
74295
74296 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) {
74297         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74298         this_ptr_conv.inner = untag_ptr(this_ptr);
74299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74301         this_ptr_conv.is_owned = false;
74302         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
74303         return ret_conv;
74304 }
74305
74306 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) {
74307         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74308         this_ptr_conv.inner = untag_ptr(this_ptr);
74309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74311         this_ptr_conv.is_owned = false;
74312         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
74313 }
74314
74315 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
74316         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74317         this_ptr_conv.inner = untag_ptr(this_ptr);
74318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74320         this_ptr_conv.is_owned = false;
74321         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
74322         return ret_conv;
74323 }
74324
74325 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) {
74326         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74327         this_ptr_conv.inner = untag_ptr(this_ptr);
74328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74330         this_ptr_conv.is_owned = false;
74331         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
74332 }
74333
74334 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
74335         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74336         this_ptr_conv.inner = untag_ptr(this_ptr);
74337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74339         this_ptr_conv.is_owned = false;
74340         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
74341         return ret_conv;
74342 }
74343
74344 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) {
74345         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74346         this_ptr_conv.inner = untag_ptr(this_ptr);
74347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74349         this_ptr_conv.is_owned = false;
74350         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
74351 }
74352
74353 jboolean  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_get_linear_success_probability(uint64_t this_ptr) {
74354         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74355         this_ptr_conv.inner = untag_ptr(this_ptr);
74356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74358         this_ptr_conv.is_owned = false;
74359         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
74360         return ret_conv;
74361 }
74362
74363 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_linear_success_probability"))) TS_ProbabilisticScoringFeeParameters_set_linear_success_probability(uint64_t this_ptr, jboolean val) {
74364         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74365         this_ptr_conv.inner = untag_ptr(this_ptr);
74366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74368         this_ptr_conv.is_owned = false;
74369         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
74370 }
74371
74372 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
74373         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
74374         uint64_t ret_ref = 0;
74375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74377         return ret_ref;
74378 }
74379 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
74380         LDKProbabilisticScoringFeeParameters arg_conv;
74381         arg_conv.inner = untag_ptr(arg);
74382         arg_conv.is_owned = ptr_is_owned(arg);
74383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74384         arg_conv.is_owned = false;
74385         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
74386         return ret_conv;
74387 }
74388
74389 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
74390         LDKProbabilisticScoringFeeParameters orig_conv;
74391         orig_conv.inner = untag_ptr(orig);
74392         orig_conv.is_owned = ptr_is_owned(orig);
74393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74394         orig_conv.is_owned = false;
74395         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
74396         uint64_t ret_ref = 0;
74397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74399         return ret_ref;
74400 }
74401
74402 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
74403         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
74404         uint64_t ret_ref = 0;
74405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74407         return ret_ref;
74408 }
74409
74410 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
74411         LDKProbabilisticScoringFeeParameters this_arg_conv;
74412         this_arg_conv.inner = untag_ptr(this_arg);
74413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74415         this_arg_conv.is_owned = false;
74416         LDKNodeId node_id_conv;
74417         node_id_conv.inner = untag_ptr(node_id);
74418         node_id_conv.is_owned = ptr_is_owned(node_id);
74419         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
74420         node_id_conv.is_owned = false;
74421         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
74422 }
74423
74424 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
74425         LDKProbabilisticScoringFeeParameters this_arg_conv;
74426         this_arg_conv.inner = untag_ptr(this_arg);
74427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74429         this_arg_conv.is_owned = false;
74430         LDKCVec_NodeIdZ node_ids_constr;
74431         node_ids_constr.datalen = node_ids->arr_len;
74432         if (node_ids_constr.datalen > 0)
74433                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
74434         else
74435                 node_ids_constr.data = NULL;
74436         uint64_t* node_ids_vals = node_ids->elems;
74437         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
74438                 uint64_t node_ids_conv_8 = node_ids_vals[i];
74439                 LDKNodeId node_ids_conv_8_conv;
74440                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
74441                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
74442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
74443                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
74444                 node_ids_constr.data[i] = node_ids_conv_8_conv;
74445         }
74446         FREE(node_ids);
74447         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
74448 }
74449
74450 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
74451         LDKProbabilisticScoringFeeParameters this_arg_conv;
74452         this_arg_conv.inner = untag_ptr(this_arg);
74453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74455         this_arg_conv.is_owned = false;
74456         LDKNodeId node_id_conv;
74457         node_id_conv.inner = untag_ptr(node_id);
74458         node_id_conv.is_owned = ptr_is_owned(node_id);
74459         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
74460         node_id_conv.is_owned = false;
74461         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
74462 }
74463
74464 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) {
74465         LDKProbabilisticScoringFeeParameters this_arg_conv;
74466         this_arg_conv.inner = untag_ptr(this_arg);
74467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74469         this_arg_conv.is_owned = false;
74470         LDKNodeId node_id_conv;
74471         node_id_conv.inner = untag_ptr(node_id);
74472         node_id_conv.is_owned = ptr_is_owned(node_id);
74473         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
74474         node_id_conv.is_owned = false;
74475         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
74476 }
74477
74478 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
74479         LDKProbabilisticScoringFeeParameters this_arg_conv;
74480         this_arg_conv.inner = untag_ptr(this_arg);
74481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74483         this_arg_conv.is_owned = false;
74484         LDKNodeId node_id_conv;
74485         node_id_conv.inner = untag_ptr(node_id);
74486         node_id_conv.is_owned = ptr_is_owned(node_id);
74487         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
74488         node_id_conv.is_owned = false;
74489         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
74490 }
74491
74492 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
74493         LDKProbabilisticScoringFeeParameters this_arg_conv;
74494         this_arg_conv.inner = untag_ptr(this_arg);
74495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74497         this_arg_conv.is_owned = false;
74498         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
74499 }
74500
74501 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
74502         LDKProbabilisticScoringDecayParameters this_obj_conv;
74503         this_obj_conv.inner = untag_ptr(this_obj);
74504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74506         ProbabilisticScoringDecayParameters_free(this_obj_conv);
74507 }
74508
74509 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) {
74510         LDKProbabilisticScoringDecayParameters this_ptr_conv;
74511         this_ptr_conv.inner = untag_ptr(this_ptr);
74512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74514         this_ptr_conv.is_owned = false;
74515         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
74516         return ret_conv;
74517 }
74518
74519 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) {
74520         LDKProbabilisticScoringDecayParameters this_ptr_conv;
74521         this_ptr_conv.inner = untag_ptr(this_ptr);
74522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74524         this_ptr_conv.is_owned = false;
74525         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
74526 }
74527
74528 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
74529         LDKProbabilisticScoringDecayParameters this_ptr_conv;
74530         this_ptr_conv.inner = untag_ptr(this_ptr);
74531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74533         this_ptr_conv.is_owned = false;
74534         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
74535         return ret_conv;
74536 }
74537
74538 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) {
74539         LDKProbabilisticScoringDecayParameters this_ptr_conv;
74540         this_ptr_conv.inner = untag_ptr(this_ptr);
74541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74543         this_ptr_conv.is_owned = false;
74544         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
74545 }
74546
74547 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) {
74548         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
74549         uint64_t ret_ref = 0;
74550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74552         return ret_ref;
74553 }
74554
74555 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
74556         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
74557         uint64_t ret_ref = 0;
74558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74560         return ret_ref;
74561 }
74562 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
74563         LDKProbabilisticScoringDecayParameters arg_conv;
74564         arg_conv.inner = untag_ptr(arg);
74565         arg_conv.is_owned = ptr_is_owned(arg);
74566         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74567         arg_conv.is_owned = false;
74568         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
74569         return ret_conv;
74570 }
74571
74572 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
74573         LDKProbabilisticScoringDecayParameters orig_conv;
74574         orig_conv.inner = untag_ptr(orig);
74575         orig_conv.is_owned = ptr_is_owned(orig);
74576         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74577         orig_conv.is_owned = false;
74578         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
74579         uint64_t ret_ref = 0;
74580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74582         return ret_ref;
74583 }
74584
74585 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
74586         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
74587         uint64_t ret_ref = 0;
74588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74590         return ret_ref;
74591 }
74592
74593 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
74594         LDKProbabilisticScoringDecayParameters decay_params_conv;
74595         decay_params_conv.inner = untag_ptr(decay_params);
74596         decay_params_conv.is_owned = ptr_is_owned(decay_params);
74597         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
74598         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
74599         LDKNetworkGraph network_graph_conv;
74600         network_graph_conv.inner = untag_ptr(network_graph);
74601         network_graph_conv.is_owned = ptr_is_owned(network_graph);
74602         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
74603         network_graph_conv.is_owned = false;
74604         void* logger_ptr = untag_ptr(logger);
74605         CHECK_ACCESS(logger_ptr);
74606         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74607         if (logger_conv.free == LDKLogger_JCalls_free) {
74608                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74609                 LDKLogger_JCalls_cloned(&logger_conv);
74610         }
74611         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
74612         uint64_t ret_ref = 0;
74613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74615         return ret_ref;
74616 }
74617
74618 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
74619         LDKProbabilisticScorer this_arg_conv;
74620         this_arg_conv.inner = untag_ptr(this_arg);
74621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74623         this_arg_conv.is_owned = false;
74624         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
74625 }
74626
74627 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) {
74628         LDKProbabilisticScorer this_arg_conv;
74629         this_arg_conv.inner = untag_ptr(this_arg);
74630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74632         this_arg_conv.is_owned = false;
74633         LDKNodeId target_conv;
74634         target_conv.inner = untag_ptr(target);
74635         target_conv.is_owned = ptr_is_owned(target);
74636         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
74637         target_conv.is_owned = false;
74638         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
74639         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
74640         uint64_t ret_ref = tag_ptr(ret_copy, true);
74641         return ret_ref;
74642 }
74643
74644 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) {
74645         LDKProbabilisticScorer this_arg_conv;
74646         this_arg_conv.inner = untag_ptr(this_arg);
74647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74649         this_arg_conv.is_owned = false;
74650         LDKNodeId target_conv;
74651         target_conv.inner = untag_ptr(target);
74652         target_conv.is_owned = ptr_is_owned(target);
74653         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
74654         target_conv.is_owned = false;
74655         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
74656         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
74657         uint64_t ret_ref = tag_ptr(ret_copy, true);
74658         return ret_ref;
74659 }
74660
74661 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) {
74662         LDKProbabilisticScorer this_arg_conv;
74663         this_arg_conv.inner = untag_ptr(this_arg);
74664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74666         this_arg_conv.is_owned = false;
74667         LDKNodeId target_conv;
74668         target_conv.inner = untag_ptr(target);
74669         target_conv.is_owned = ptr_is_owned(target);
74670         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
74671         target_conv.is_owned = false;
74672         LDKProbabilisticScoringFeeParameters params_conv;
74673         params_conv.inner = untag_ptr(params);
74674         params_conv.is_owned = ptr_is_owned(params);
74675         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
74676         params_conv.is_owned = false;
74677         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
74678         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
74679         uint64_t ret_ref = tag_ptr(ret_copy, true);
74680         return ret_ref;
74681 }
74682
74683 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreLookUp"))) TS_ProbabilisticScorer_as_ScoreLookUp(uint64_t this_arg) {
74684         LDKProbabilisticScorer this_arg_conv;
74685         this_arg_conv.inner = untag_ptr(this_arg);
74686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74688         this_arg_conv.is_owned = false;
74689         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
74690         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
74691         return tag_ptr(ret_ret, true);
74692 }
74693
74694 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_ScoreUpdate"))) TS_ProbabilisticScorer_as_ScoreUpdate(uint64_t this_arg) {
74695         LDKProbabilisticScorer this_arg_conv;
74696         this_arg_conv.inner = untag_ptr(this_arg);
74697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74699         this_arg_conv.is_owned = false;
74700         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
74701         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
74702         return tag_ptr(ret_ret, true);
74703 }
74704
74705 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
74706         LDKProbabilisticScorer this_arg_conv;
74707         this_arg_conv.inner = untag_ptr(this_arg);
74708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74710         this_arg_conv.is_owned = false;
74711         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
74712         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
74713         return tag_ptr(ret_ret, true);
74714 }
74715
74716 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
74717         LDKProbabilisticScorer obj_conv;
74718         obj_conv.inner = untag_ptr(obj);
74719         obj_conv.is_owned = ptr_is_owned(obj);
74720         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74721         obj_conv.is_owned = false;
74722         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
74723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74725         CVec_u8Z_free(ret_var);
74726         return ret_arr;
74727 }
74728
74729 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) {
74730         LDKu8slice ser_ref;
74731         ser_ref.datalen = ser->arr_len;
74732         ser_ref.data = ser->elems;
74733         LDKProbabilisticScoringDecayParameters arg_a_conv;
74734         arg_a_conv.inner = untag_ptr(arg_a);
74735         arg_a_conv.is_owned = ptr_is_owned(arg_a);
74736         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
74737         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
74738         LDKNetworkGraph arg_b_conv;
74739         arg_b_conv.inner = untag_ptr(arg_b);
74740         arg_b_conv.is_owned = ptr_is_owned(arg_b);
74741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
74742         arg_b_conv.is_owned = false;
74743         void* arg_c_ptr = untag_ptr(arg_c);
74744         CHECK_ACCESS(arg_c_ptr);
74745         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
74746         if (arg_c_conv.free == LDKLogger_JCalls_free) {
74747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74748                 LDKLogger_JCalls_cloned(&arg_c_conv);
74749         }
74750         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
74751         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
74752         FREE(ser);
74753         return tag_ptr(ret_conv, true);
74754 }
74755
74756 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
74757         LDKDelayedPaymentOutputDescriptor this_obj_conv;
74758         this_obj_conv.inner = untag_ptr(this_obj);
74759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74761         DelayedPaymentOutputDescriptor_free(this_obj_conv);
74762 }
74763
74764 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
74765         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74766         this_ptr_conv.inner = untag_ptr(this_ptr);
74767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74769         this_ptr_conv.is_owned = false;
74770         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
74771         uint64_t ret_ref = 0;
74772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74774         return ret_ref;
74775 }
74776
74777 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
74778         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74779         this_ptr_conv.inner = untag_ptr(this_ptr);
74780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74782         this_ptr_conv.is_owned = false;
74783         LDKOutPoint val_conv;
74784         val_conv.inner = untag_ptr(val);
74785         val_conv.is_owned = ptr_is_owned(val);
74786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74787         val_conv = OutPoint_clone(&val_conv);
74788         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
74789 }
74790
74791 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
74792         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74793         this_ptr_conv.inner = untag_ptr(this_ptr);
74794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74796         this_ptr_conv.is_owned = false;
74797         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
74798         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
74799         return ret_arr;
74800 }
74801
74802 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
74803         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74804         this_ptr_conv.inner = untag_ptr(this_ptr);
74805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74807         this_ptr_conv.is_owned = false;
74808         LDKPublicKey val_ref;
74809         CHECK(val->arr_len == 33);
74810         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
74811         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
74812 }
74813
74814 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
74815         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74816         this_ptr_conv.inner = untag_ptr(this_ptr);
74817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74819         this_ptr_conv.is_owned = false;
74820         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
74821         return ret_conv;
74822 }
74823
74824 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
74825         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74826         this_ptr_conv.inner = untag_ptr(this_ptr);
74827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74829         this_ptr_conv.is_owned = false;
74830         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
74831 }
74832
74833 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
74834         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74835         this_ptr_conv.inner = untag_ptr(this_ptr);
74836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74838         this_ptr_conv.is_owned = false;
74839         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74840         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
74841         return tag_ptr(ret_ref, true);
74842 }
74843
74844 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
74845         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74846         this_ptr_conv.inner = untag_ptr(this_ptr);
74847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74849         this_ptr_conv.is_owned = false;
74850         void* val_ptr = untag_ptr(val);
74851         CHECK_ACCESS(val_ptr);
74852         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
74853         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
74854         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
74855 }
74856
74857 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
74858         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74859         this_ptr_conv.inner = untag_ptr(this_ptr);
74860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74862         this_ptr_conv.is_owned = false;
74863         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
74864         uint64_t ret_ref = 0;
74865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74867         return ret_ref;
74868 }
74869
74870 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, uint64_t val) {
74871         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74872         this_ptr_conv.inner = untag_ptr(this_ptr);
74873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74875         this_ptr_conv.is_owned = false;
74876         LDKRevocationKey val_conv;
74877         val_conv.inner = untag_ptr(val);
74878         val_conv.is_owned = ptr_is_owned(val);
74879         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74880         val_conv = RevocationKey_clone(&val_conv);
74881         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
74882 }
74883
74884 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
74885         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74886         this_ptr_conv.inner = untag_ptr(this_ptr);
74887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74889         this_ptr_conv.is_owned = false;
74890         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74891         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
74892         return ret_arr;
74893 }
74894
74895 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
74896         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74897         this_ptr_conv.inner = untag_ptr(this_ptr);
74898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74900         this_ptr_conv.is_owned = false;
74901         LDKThirtyTwoBytes val_ref;
74902         CHECK(val->arr_len == 32);
74903         memcpy(val_ref.data, val->elems, 32); FREE(val);
74904         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
74905 }
74906
74907 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
74908         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74909         this_ptr_conv.inner = untag_ptr(this_ptr);
74910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74912         this_ptr_conv.is_owned = false;
74913         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
74914         return ret_conv;
74915 }
74916
74917 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
74918         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74919         this_ptr_conv.inner = untag_ptr(this_ptr);
74920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74922         this_ptr_conv.is_owned = false;
74923         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
74924 }
74925
74926 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
74927         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74928         this_ptr_conv.inner = untag_ptr(this_ptr);
74929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74931         this_ptr_conv.is_owned = false;
74932         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
74933         uint64_t ret_ref = 0;
74934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74936         return ret_ref;
74937 }
74938
74939 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
74940         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74941         this_ptr_conv.inner = untag_ptr(this_ptr);
74942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74944         this_ptr_conv.is_owned = false;
74945         LDKChannelTransactionParameters val_conv;
74946         val_conv.inner = untag_ptr(val);
74947         val_conv.is_owned = ptr_is_owned(val);
74948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74949         val_conv = ChannelTransactionParameters_clone(&val_conv);
74950         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
74951 }
74952
74953 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, uint64_t channel_transaction_parameters_arg) {
74954         LDKOutPoint outpoint_arg_conv;
74955         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74956         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74957         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74958         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74959         LDKPublicKey per_commitment_point_arg_ref;
74960         CHECK(per_commitment_point_arg->arr_len == 33);
74961         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
74962         void* output_arg_ptr = untag_ptr(output_arg);
74963         CHECK_ACCESS(output_arg_ptr);
74964         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
74965         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
74966         LDKRevocationKey revocation_pubkey_arg_conv;
74967         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
74968         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
74969         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
74970         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
74971         LDKThirtyTwoBytes channel_keys_id_arg_ref;
74972         CHECK(channel_keys_id_arg->arr_len == 32);
74973         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
74974         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
74975         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
74976         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
74977         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
74978         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
74979         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, channel_transaction_parameters_arg_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 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
74987         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
74988         uint64_t ret_ref = 0;
74989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74991         return ret_ref;
74992 }
74993 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
74994         LDKDelayedPaymentOutputDescriptor arg_conv;
74995         arg_conv.inner = untag_ptr(arg);
74996         arg_conv.is_owned = ptr_is_owned(arg);
74997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74998         arg_conv.is_owned = false;
74999         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
75000         return ret_conv;
75001 }
75002
75003 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
75004         LDKDelayedPaymentOutputDescriptor orig_conv;
75005         orig_conv.inner = untag_ptr(orig);
75006         orig_conv.is_owned = ptr_is_owned(orig);
75007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75008         orig_conv.is_owned = false;
75009         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
75010         uint64_t ret_ref = 0;
75011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75013         return ret_ref;
75014 }
75015
75016 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_hash"))) TS_DelayedPaymentOutputDescriptor_hash(uint64_t o) {
75017         LDKDelayedPaymentOutputDescriptor o_conv;
75018         o_conv.inner = untag_ptr(o);
75019         o_conv.is_owned = ptr_is_owned(o);
75020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75021         o_conv.is_owned = false;
75022         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
75023         return ret_conv;
75024 }
75025
75026 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
75027         LDKDelayedPaymentOutputDescriptor a_conv;
75028         a_conv.inner = untag_ptr(a);
75029         a_conv.is_owned = ptr_is_owned(a);
75030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75031         a_conv.is_owned = false;
75032         LDKDelayedPaymentOutputDescriptor b_conv;
75033         b_conv.inner = untag_ptr(b);
75034         b_conv.is_owned = ptr_is_owned(b);
75035         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75036         b_conv.is_owned = false;
75037         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
75038         return ret_conv;
75039 }
75040
75041 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
75042         LDKDelayedPaymentOutputDescriptor obj_conv;
75043         obj_conv.inner = untag_ptr(obj);
75044         obj_conv.is_owned = ptr_is_owned(obj);
75045         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75046         obj_conv.is_owned = false;
75047         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
75048         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75049         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75050         CVec_u8Z_free(ret_var);
75051         return ret_arr;
75052 }
75053
75054 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
75055         LDKu8slice ser_ref;
75056         ser_ref.datalen = ser->arr_len;
75057         ser_ref.data = ser->elems;
75058         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
75059         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
75060         FREE(ser);
75061         return tag_ptr(ret_conv, true);
75062 }
75063
75064 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
75065         LDKStaticPaymentOutputDescriptor this_obj_conv;
75066         this_obj_conv.inner = untag_ptr(this_obj);
75067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75069         StaticPaymentOutputDescriptor_free(this_obj_conv);
75070 }
75071
75072 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
75073         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75074         this_ptr_conv.inner = untag_ptr(this_ptr);
75075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75077         this_ptr_conv.is_owned = false;
75078         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
75079         uint64_t ret_ref = 0;
75080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75082         return ret_ref;
75083 }
75084
75085 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
75086         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75087         this_ptr_conv.inner = untag_ptr(this_ptr);
75088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75090         this_ptr_conv.is_owned = false;
75091         LDKOutPoint val_conv;
75092         val_conv.inner = untag_ptr(val);
75093         val_conv.is_owned = ptr_is_owned(val);
75094         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75095         val_conv = OutPoint_clone(&val_conv);
75096         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
75097 }
75098
75099 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
75100         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75101         this_ptr_conv.inner = untag_ptr(this_ptr);
75102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75104         this_ptr_conv.is_owned = false;
75105         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75106         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
75107         return tag_ptr(ret_ref, true);
75108 }
75109
75110 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
75111         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75112         this_ptr_conv.inner = untag_ptr(this_ptr);
75113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75115         this_ptr_conv.is_owned = false;
75116         void* val_ptr = untag_ptr(val);
75117         CHECK_ACCESS(val_ptr);
75118         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
75119         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
75120         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
75121 }
75122
75123 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
75124         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75125         this_ptr_conv.inner = untag_ptr(this_ptr);
75126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75128         this_ptr_conv.is_owned = false;
75129         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75130         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
75131         return ret_arr;
75132 }
75133
75134 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
75135         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75136         this_ptr_conv.inner = untag_ptr(this_ptr);
75137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75139         this_ptr_conv.is_owned = false;
75140         LDKThirtyTwoBytes val_ref;
75141         CHECK(val->arr_len == 32);
75142         memcpy(val_ref.data, val->elems, 32); FREE(val);
75143         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
75144 }
75145
75146 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
75147         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75148         this_ptr_conv.inner = untag_ptr(this_ptr);
75149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75151         this_ptr_conv.is_owned = false;
75152         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
75153         return ret_conv;
75154 }
75155
75156 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
75157         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75158         this_ptr_conv.inner = untag_ptr(this_ptr);
75159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75161         this_ptr_conv.is_owned = false;
75162         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
75163 }
75164
75165 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(uint64_t this_ptr) {
75166         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75167         this_ptr_conv.inner = untag_ptr(this_ptr);
75168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75170         this_ptr_conv.is_owned = false;
75171         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
75172         uint64_t ret_ref = 0;
75173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75175         return ret_ref;
75176 }
75177
75178 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters"))) TS_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(uint64_t this_ptr, uint64_t val) {
75179         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75180         this_ptr_conv.inner = untag_ptr(this_ptr);
75181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75183         this_ptr_conv.is_owned = false;
75184         LDKChannelTransactionParameters val_conv;
75185         val_conv.inner = untag_ptr(val);
75186         val_conv.is_owned = ptr_is_owned(val);
75187         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75188         val_conv = ChannelTransactionParameters_clone(&val_conv);
75189         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
75190 }
75191
75192 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) {
75193         LDKOutPoint outpoint_arg_conv;
75194         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
75195         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
75196         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
75197         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
75198         void* output_arg_ptr = untag_ptr(output_arg);
75199         CHECK_ACCESS(output_arg_ptr);
75200         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
75201         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
75202         LDKThirtyTwoBytes channel_keys_id_arg_ref;
75203         CHECK(channel_keys_id_arg->arr_len == 32);
75204         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
75205         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
75206         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
75207         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
75208         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
75209         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
75210         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);
75211         uint64_t ret_ref = 0;
75212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75214         return ret_ref;
75215 }
75216
75217 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
75218         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
75219         uint64_t ret_ref = 0;
75220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75222         return ret_ref;
75223 }
75224 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
75225         LDKStaticPaymentOutputDescriptor arg_conv;
75226         arg_conv.inner = untag_ptr(arg);
75227         arg_conv.is_owned = ptr_is_owned(arg);
75228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75229         arg_conv.is_owned = false;
75230         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
75231         return ret_conv;
75232 }
75233
75234 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
75235         LDKStaticPaymentOutputDescriptor orig_conv;
75236         orig_conv.inner = untag_ptr(orig);
75237         orig_conv.is_owned = ptr_is_owned(orig);
75238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75239         orig_conv.is_owned = false;
75240         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
75241         uint64_t ret_ref = 0;
75242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75244         return ret_ref;
75245 }
75246
75247 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_hash"))) TS_StaticPaymentOutputDescriptor_hash(uint64_t o) {
75248         LDKStaticPaymentOutputDescriptor o_conv;
75249         o_conv.inner = untag_ptr(o);
75250         o_conv.is_owned = ptr_is_owned(o);
75251         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75252         o_conv.is_owned = false;
75253         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
75254         return ret_conv;
75255 }
75256
75257 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
75258         LDKStaticPaymentOutputDescriptor a_conv;
75259         a_conv.inner = untag_ptr(a);
75260         a_conv.is_owned = ptr_is_owned(a);
75261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75262         a_conv.is_owned = false;
75263         LDKStaticPaymentOutputDescriptor b_conv;
75264         b_conv.inner = untag_ptr(b);
75265         b_conv.is_owned = ptr_is_owned(b);
75266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75267         b_conv.is_owned = false;
75268         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
75269         return ret_conv;
75270 }
75271
75272 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_witness_script"))) TS_StaticPaymentOutputDescriptor_witness_script(uint64_t this_arg) {
75273         LDKStaticPaymentOutputDescriptor this_arg_conv;
75274         this_arg_conv.inner = untag_ptr(this_arg);
75275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75277         this_arg_conv.is_owned = false;
75278         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75279         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
75280         uint64_t ret_ref = tag_ptr(ret_copy, true);
75281         return ret_ref;
75282 }
75283
75284 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_max_witness_length"))) TS_StaticPaymentOutputDescriptor_max_witness_length(uint64_t this_arg) {
75285         LDKStaticPaymentOutputDescriptor this_arg_conv;
75286         this_arg_conv.inner = untag_ptr(this_arg);
75287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75289         this_arg_conv.is_owned = false;
75290         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
75291         return ret_conv;
75292 }
75293
75294 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
75295         LDKStaticPaymentOutputDescriptor obj_conv;
75296         obj_conv.inner = untag_ptr(obj);
75297         obj_conv.is_owned = ptr_is_owned(obj);
75298         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75299         obj_conv.is_owned = false;
75300         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
75301         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75302         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75303         CVec_u8Z_free(ret_var);
75304         return ret_arr;
75305 }
75306
75307 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
75308         LDKu8slice ser_ref;
75309         ser_ref.datalen = ser->arr_len;
75310         ser_ref.data = ser->elems;
75311         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
75312         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
75313         FREE(ser);
75314         return tag_ptr(ret_conv, true);
75315 }
75316
75317 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
75318         if (!ptr_is_owned(this_ptr)) return;
75319         void* this_ptr_ptr = untag_ptr(this_ptr);
75320         CHECK_ACCESS(this_ptr_ptr);
75321         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
75322         FREE(untag_ptr(this_ptr));
75323         SpendableOutputDescriptor_free(this_ptr_conv);
75324 }
75325
75326 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
75327         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75328         *ret_copy = SpendableOutputDescriptor_clone(arg);
75329         uint64_t ret_ref = tag_ptr(ret_copy, true);
75330         return ret_ref;
75331 }
75332 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
75333         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
75334         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
75335         return ret_conv;
75336 }
75337
75338 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
75339         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
75340         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75341         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
75342         uint64_t ret_ref = tag_ptr(ret_copy, true);
75343         return ret_ref;
75344 }
75345
75346 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output, int8_tArray channel_keys_id) {
75347         LDKOutPoint outpoint_conv;
75348         outpoint_conv.inner = untag_ptr(outpoint);
75349         outpoint_conv.is_owned = ptr_is_owned(outpoint);
75350         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
75351         outpoint_conv = OutPoint_clone(&outpoint_conv);
75352         void* output_ptr = untag_ptr(output);
75353         CHECK_ACCESS(output_ptr);
75354         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
75355         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
75356         LDKThirtyTwoBytes channel_keys_id_ref;
75357         CHECK(channel_keys_id->arr_len == 32);
75358         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
75359         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75360         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
75361         uint64_t ret_ref = tag_ptr(ret_copy, true);
75362         return ret_ref;
75363 }
75364
75365 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
75366         LDKDelayedPaymentOutputDescriptor a_conv;
75367         a_conv.inner = untag_ptr(a);
75368         a_conv.is_owned = ptr_is_owned(a);
75369         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75370         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
75371         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75372         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
75373         uint64_t ret_ref = tag_ptr(ret_copy, true);
75374         return ret_ref;
75375 }
75376
75377 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
75378         LDKStaticPaymentOutputDescriptor a_conv;
75379         a_conv.inner = untag_ptr(a);
75380         a_conv.is_owned = ptr_is_owned(a);
75381         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75382         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
75383         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75384         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
75385         uint64_t ret_ref = tag_ptr(ret_copy, true);
75386         return ret_ref;
75387 }
75388
75389 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_hash"))) TS_SpendableOutputDescriptor_hash(uint64_t o) {
75390         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
75391         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
75392         return ret_conv;
75393 }
75394
75395 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
75396         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
75397         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
75398         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
75399         return ret_conv;
75400 }
75401
75402 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
75403         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
75404         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
75405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75407         CVec_u8Z_free(ret_var);
75408         return ret_arr;
75409 }
75410
75411 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
75412         LDKu8slice ser_ref;
75413         ser_ref.datalen = ser->arr_len;
75414         ser_ref.data = ser->elems;
75415         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
75416         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
75417         FREE(ser);
75418         return tag_ptr(ret_conv, true);
75419 }
75420
75421 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) {
75422         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
75423         descriptors_constr.datalen = descriptors->arr_len;
75424         if (descriptors_constr.datalen > 0)
75425                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
75426         else
75427                 descriptors_constr.data = NULL;
75428         uint64_t* descriptors_vals = descriptors->elems;
75429         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
75430                 uint64_t descriptors_conv_27 = descriptors_vals[b];
75431                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
75432                 CHECK_ACCESS(descriptors_conv_27_ptr);
75433                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
75434                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
75435                 descriptors_constr.data[b] = descriptors_conv_27_conv;
75436         }
75437         FREE(descriptors);
75438         LDKCVec_TxOutZ outputs_constr;
75439         outputs_constr.datalen = outputs->arr_len;
75440         if (outputs_constr.datalen > 0)
75441                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
75442         else
75443                 outputs_constr.data = NULL;
75444         uint64_t* outputs_vals = outputs->elems;
75445         for (size_t h = 0; h < outputs_constr.datalen; h++) {
75446                 uint64_t outputs_conv_7 = outputs_vals[h];
75447                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
75448                 CHECK_ACCESS(outputs_conv_7_ptr);
75449                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
75450                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
75451                 outputs_constr.data[h] = outputs_conv_7_conv;
75452         }
75453         FREE(outputs);
75454         LDKCVec_u8Z change_destination_script_ref;
75455         change_destination_script_ref.datalen = change_destination_script->arr_len;
75456         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
75457         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
75458         void* locktime_ptr = untag_ptr(locktime);
75459         CHECK_ACCESS(locktime_ptr);
75460         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
75461         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
75462         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
75463         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
75464         return tag_ptr(ret_conv, true);
75465 }
75466
75467 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
75468         LDKChannelDerivationParameters this_obj_conv;
75469         this_obj_conv.inner = untag_ptr(this_obj);
75470         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75472         ChannelDerivationParameters_free(this_obj_conv);
75473 }
75474
75475 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
75476         LDKChannelDerivationParameters this_ptr_conv;
75477         this_ptr_conv.inner = untag_ptr(this_ptr);
75478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75480         this_ptr_conv.is_owned = false;
75481         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
75482         return ret_conv;
75483 }
75484
75485 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
75486         LDKChannelDerivationParameters this_ptr_conv;
75487         this_ptr_conv.inner = untag_ptr(this_ptr);
75488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75490         this_ptr_conv.is_owned = false;
75491         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
75492 }
75493
75494 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
75495         LDKChannelDerivationParameters this_ptr_conv;
75496         this_ptr_conv.inner = untag_ptr(this_ptr);
75497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75499         this_ptr_conv.is_owned = false;
75500         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75501         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
75502         return ret_arr;
75503 }
75504
75505 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
75506         LDKChannelDerivationParameters this_ptr_conv;
75507         this_ptr_conv.inner = untag_ptr(this_ptr);
75508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75510         this_ptr_conv.is_owned = false;
75511         LDKThirtyTwoBytes val_ref;
75512         CHECK(val->arr_len == 32);
75513         memcpy(val_ref.data, val->elems, 32); FREE(val);
75514         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
75515 }
75516
75517 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
75518         LDKChannelDerivationParameters this_ptr_conv;
75519         this_ptr_conv.inner = untag_ptr(this_ptr);
75520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75522         this_ptr_conv.is_owned = false;
75523         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
75524         uint64_t ret_ref = 0;
75525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75527         return ret_ref;
75528 }
75529
75530 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
75531         LDKChannelDerivationParameters this_ptr_conv;
75532         this_ptr_conv.inner = untag_ptr(this_ptr);
75533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75535         this_ptr_conv.is_owned = false;
75536         LDKChannelTransactionParameters val_conv;
75537         val_conv.inner = untag_ptr(val);
75538         val_conv.is_owned = ptr_is_owned(val);
75539         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75540         val_conv = ChannelTransactionParameters_clone(&val_conv);
75541         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
75542 }
75543
75544 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) {
75545         LDKThirtyTwoBytes keys_id_arg_ref;
75546         CHECK(keys_id_arg->arr_len == 32);
75547         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
75548         LDKChannelTransactionParameters transaction_parameters_arg_conv;
75549         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
75550         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
75551         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
75552         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
75553         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_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 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
75561         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
75562         uint64_t ret_ref = 0;
75563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75565         return ret_ref;
75566 }
75567 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
75568         LDKChannelDerivationParameters arg_conv;
75569         arg_conv.inner = untag_ptr(arg);
75570         arg_conv.is_owned = ptr_is_owned(arg);
75571         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75572         arg_conv.is_owned = false;
75573         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
75574         return ret_conv;
75575 }
75576
75577 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
75578         LDKChannelDerivationParameters orig_conv;
75579         orig_conv.inner = untag_ptr(orig);
75580         orig_conv.is_owned = ptr_is_owned(orig);
75581         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75582         orig_conv.is_owned = false;
75583         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
75584         uint64_t ret_ref = 0;
75585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75587         return ret_ref;
75588 }
75589
75590 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
75591         LDKChannelDerivationParameters a_conv;
75592         a_conv.inner = untag_ptr(a);
75593         a_conv.is_owned = ptr_is_owned(a);
75594         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75595         a_conv.is_owned = false;
75596         LDKChannelDerivationParameters b_conv;
75597         b_conv.inner = untag_ptr(b);
75598         b_conv.is_owned = ptr_is_owned(b);
75599         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75600         b_conv.is_owned = false;
75601         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
75602         return ret_conv;
75603 }
75604
75605 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_write"))) TS_ChannelDerivationParameters_write(uint64_t obj) {
75606         LDKChannelDerivationParameters obj_conv;
75607         obj_conv.inner = untag_ptr(obj);
75608         obj_conv.is_owned = ptr_is_owned(obj);
75609         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75610         obj_conv.is_owned = false;
75611         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
75612         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75613         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75614         CVec_u8Z_free(ret_var);
75615         return ret_arr;
75616 }
75617
75618 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_read"))) TS_ChannelDerivationParameters_read(int8_tArray ser) {
75619         LDKu8slice ser_ref;
75620         ser_ref.datalen = ser->arr_len;
75621         ser_ref.data = ser->elems;
75622         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
75623         *ret_conv = ChannelDerivationParameters_read(ser_ref);
75624         FREE(ser);
75625         return tag_ptr(ret_conv, true);
75626 }
75627
75628 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
75629         LDKHTLCDescriptor this_obj_conv;
75630         this_obj_conv.inner = untag_ptr(this_obj);
75631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75633         HTLCDescriptor_free(this_obj_conv);
75634 }
75635
75636 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
75637         LDKHTLCDescriptor this_ptr_conv;
75638         this_ptr_conv.inner = untag_ptr(this_ptr);
75639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75641         this_ptr_conv.is_owned = false;
75642         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
75643         uint64_t ret_ref = 0;
75644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75646         return ret_ref;
75647 }
75648
75649 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
75650         LDKHTLCDescriptor this_ptr_conv;
75651         this_ptr_conv.inner = untag_ptr(this_ptr);
75652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75654         this_ptr_conv.is_owned = false;
75655         LDKChannelDerivationParameters val_conv;
75656         val_conv.inner = untag_ptr(val);
75657         val_conv.is_owned = ptr_is_owned(val);
75658         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75659         val_conv = ChannelDerivationParameters_clone(&val_conv);
75660         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
75661 }
75662
75663 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_commitment_txid"))) TS_HTLCDescriptor_get_commitment_txid(uint64_t this_ptr) {
75664         LDKHTLCDescriptor this_ptr_conv;
75665         this_ptr_conv.inner = untag_ptr(this_ptr);
75666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75668         this_ptr_conv.is_owned = false;
75669         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75670         memcpy(ret_arr->elems, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv), 32);
75671         return ret_arr;
75672 }
75673
75674 void  __attribute__((export_name("TS_HTLCDescriptor_set_commitment_txid"))) TS_HTLCDescriptor_set_commitment_txid(uint64_t this_ptr, int8_tArray val) {
75675         LDKHTLCDescriptor this_ptr_conv;
75676         this_ptr_conv.inner = untag_ptr(this_ptr);
75677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75679         this_ptr_conv.is_owned = false;
75680         LDKThirtyTwoBytes val_ref;
75681         CHECK(val->arr_len == 32);
75682         memcpy(val_ref.data, val->elems, 32); FREE(val);
75683         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
75684 }
75685
75686 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
75687         LDKHTLCDescriptor this_ptr_conv;
75688         this_ptr_conv.inner = untag_ptr(this_ptr);
75689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75691         this_ptr_conv.is_owned = false;
75692         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
75693         return ret_conv;
75694 }
75695
75696 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
75697         LDKHTLCDescriptor this_ptr_conv;
75698         this_ptr_conv.inner = untag_ptr(this_ptr);
75699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75701         this_ptr_conv.is_owned = false;
75702         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
75703 }
75704
75705 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
75706         LDKHTLCDescriptor this_ptr_conv;
75707         this_ptr_conv.inner = untag_ptr(this_ptr);
75708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75710         this_ptr_conv.is_owned = false;
75711         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75712         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
75713         return ret_arr;
75714 }
75715
75716 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
75717         LDKHTLCDescriptor this_ptr_conv;
75718         this_ptr_conv.inner = untag_ptr(this_ptr);
75719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75721         this_ptr_conv.is_owned = false;
75722         LDKPublicKey val_ref;
75723         CHECK(val->arr_len == 33);
75724         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
75725         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
75726 }
75727
75728 int32_t  __attribute__((export_name("TS_HTLCDescriptor_get_feerate_per_kw"))) TS_HTLCDescriptor_get_feerate_per_kw(uint64_t this_ptr) {
75729         LDKHTLCDescriptor this_ptr_conv;
75730         this_ptr_conv.inner = untag_ptr(this_ptr);
75731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75733         this_ptr_conv.is_owned = false;
75734         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
75735         return ret_conv;
75736 }
75737
75738 void  __attribute__((export_name("TS_HTLCDescriptor_set_feerate_per_kw"))) TS_HTLCDescriptor_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
75739         LDKHTLCDescriptor this_ptr_conv;
75740         this_ptr_conv.inner = untag_ptr(this_ptr);
75741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75743         this_ptr_conv.is_owned = false;
75744         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
75745 }
75746
75747 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
75748         LDKHTLCDescriptor this_ptr_conv;
75749         this_ptr_conv.inner = untag_ptr(this_ptr);
75750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75752         this_ptr_conv.is_owned = false;
75753         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
75754         uint64_t ret_ref = 0;
75755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75757         return ret_ref;
75758 }
75759
75760 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
75761         LDKHTLCDescriptor this_ptr_conv;
75762         this_ptr_conv.inner = untag_ptr(this_ptr);
75763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75765         this_ptr_conv.is_owned = false;
75766         LDKHTLCOutputInCommitment val_conv;
75767         val_conv.inner = untag_ptr(val);
75768         val_conv.is_owned = ptr_is_owned(val);
75769         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75770         val_conv = HTLCOutputInCommitment_clone(&val_conv);
75771         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
75772 }
75773
75774 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
75775         LDKHTLCDescriptor this_ptr_conv;
75776         this_ptr_conv.inner = untag_ptr(this_ptr);
75777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75779         this_ptr_conv.is_owned = false;
75780         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
75781         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
75782         uint64_t ret_ref = tag_ptr(ret_copy, true);
75783         return ret_ref;
75784 }
75785
75786 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
75787         LDKHTLCDescriptor this_ptr_conv;
75788         this_ptr_conv.inner = untag_ptr(this_ptr);
75789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75791         this_ptr_conv.is_owned = false;
75792         void* val_ptr = untag_ptr(val);
75793         CHECK_ACCESS(val_ptr);
75794         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
75795         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
75796         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
75797 }
75798
75799 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
75800         LDKHTLCDescriptor this_ptr_conv;
75801         this_ptr_conv.inner = untag_ptr(this_ptr);
75802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75804         this_ptr_conv.is_owned = false;
75805         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
75806         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
75807         return ret_arr;
75808 }
75809
75810 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
75811         LDKHTLCDescriptor this_ptr_conv;
75812         this_ptr_conv.inner = untag_ptr(this_ptr);
75813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75815         this_ptr_conv.is_owned = false;
75816         LDKECDSASignature val_ref;
75817         CHECK(val->arr_len == 64);
75818         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
75819         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
75820 }
75821
75822 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_new"))) TS_HTLCDescriptor_new(uint64_t channel_derivation_parameters_arg, int8_tArray commitment_txid_arg, int64_t per_commitment_number_arg, int8_tArray per_commitment_point_arg, int32_t feerate_per_kw_arg, uint64_t htlc_arg, uint64_t preimage_arg, int8_tArray counterparty_sig_arg) {
75823         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
75824         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
75825         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
75826         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
75827         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
75828         LDKThirtyTwoBytes commitment_txid_arg_ref;
75829         CHECK(commitment_txid_arg->arr_len == 32);
75830         memcpy(commitment_txid_arg_ref.data, commitment_txid_arg->elems, 32); FREE(commitment_txid_arg);
75831         LDKPublicKey per_commitment_point_arg_ref;
75832         CHECK(per_commitment_point_arg->arr_len == 33);
75833         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
75834         LDKHTLCOutputInCommitment htlc_arg_conv;
75835         htlc_arg_conv.inner = untag_ptr(htlc_arg);
75836         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
75837         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
75838         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
75839         void* preimage_arg_ptr = untag_ptr(preimage_arg);
75840         CHECK_ACCESS(preimage_arg_ptr);
75841         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
75842         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
75843         LDKECDSASignature counterparty_sig_arg_ref;
75844         CHECK(counterparty_sig_arg->arr_len == 64);
75845         memcpy(counterparty_sig_arg_ref.compact_form, counterparty_sig_arg->elems, 64); FREE(counterparty_sig_arg);
75846         LDKHTLCDescriptor ret_var = HTLCDescriptor_new(channel_derivation_parameters_arg_conv, commitment_txid_arg_ref, per_commitment_number_arg, per_commitment_point_arg_ref, feerate_per_kw_arg, htlc_arg_conv, preimage_arg_conv, counterparty_sig_arg_ref);
75847         uint64_t ret_ref = 0;
75848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75850         return ret_ref;
75851 }
75852
75853 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
75854         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
75855         uint64_t ret_ref = 0;
75856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75858         return ret_ref;
75859 }
75860 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
75861         LDKHTLCDescriptor arg_conv;
75862         arg_conv.inner = untag_ptr(arg);
75863         arg_conv.is_owned = ptr_is_owned(arg);
75864         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75865         arg_conv.is_owned = false;
75866         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
75867         return ret_conv;
75868 }
75869
75870 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
75871         LDKHTLCDescriptor orig_conv;
75872         orig_conv.inner = untag_ptr(orig);
75873         orig_conv.is_owned = ptr_is_owned(orig);
75874         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75875         orig_conv.is_owned = false;
75876         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
75877         uint64_t ret_ref = 0;
75878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75880         return ret_ref;
75881 }
75882
75883 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
75884         LDKHTLCDescriptor a_conv;
75885         a_conv.inner = untag_ptr(a);
75886         a_conv.is_owned = ptr_is_owned(a);
75887         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75888         a_conv.is_owned = false;
75889         LDKHTLCDescriptor b_conv;
75890         b_conv.inner = untag_ptr(b);
75891         b_conv.is_owned = ptr_is_owned(b);
75892         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75893         b_conv.is_owned = false;
75894         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
75895         return ret_conv;
75896 }
75897
75898 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_write"))) TS_HTLCDescriptor_write(uint64_t obj) {
75899         LDKHTLCDescriptor obj_conv;
75900         obj_conv.inner = untag_ptr(obj);
75901         obj_conv.is_owned = ptr_is_owned(obj);
75902         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75903         obj_conv.is_owned = false;
75904         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
75905         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75906         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75907         CVec_u8Z_free(ret_var);
75908         return ret_arr;
75909 }
75910
75911 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_read"))) TS_HTLCDescriptor_read(int8_tArray ser) {
75912         LDKu8slice ser_ref;
75913         ser_ref.datalen = ser->arr_len;
75914         ser_ref.data = ser->elems;
75915         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
75916         *ret_conv = HTLCDescriptor_read(ser_ref);
75917         FREE(ser);
75918         return tag_ptr(ret_conv, true);
75919 }
75920
75921 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
75922         LDKHTLCDescriptor 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         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
75928         uint64_t ret_ref = 0;
75929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75931         return ret_ref;
75932 }
75933
75934 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
75935         LDKHTLCDescriptor this_arg_conv;
75936         this_arg_conv.inner = untag_ptr(this_arg);
75937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75939         this_arg_conv.is_owned = false;
75940         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75941         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
75942         return tag_ptr(ret_ref, true);
75943 }
75944
75945 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
75946         LDKHTLCDescriptor this_arg_conv;
75947         this_arg_conv.inner = untag_ptr(this_arg);
75948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75950         this_arg_conv.is_owned = false;
75951         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
75952         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
75953         return tag_ptr(ret_ref, true);
75954 }
75955
75956 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
75957         LDKHTLCDescriptor this_arg_conv;
75958         this_arg_conv.inner = untag_ptr(this_arg);
75959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75961         this_arg_conv.is_owned = false;
75962         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75963         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
75964         return tag_ptr(ret_ref, true);
75965 }
75966
75967 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
75968         LDKHTLCDescriptor this_arg_conv;
75969         this_arg_conv.inner = untag_ptr(this_arg);
75970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75972         this_arg_conv.is_owned = false;
75973         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
75974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75976         CVec_u8Z_free(ret_var);
75977         return ret_arr;
75978 }
75979
75980 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) {
75981         LDKHTLCDescriptor this_arg_conv;
75982         this_arg_conv.inner = untag_ptr(this_arg);
75983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75985         this_arg_conv.is_owned = false;
75986         LDKECDSASignature signature_ref;
75987         CHECK(signature->arr_len == 64);
75988         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
75989         LDKu8slice witness_script_ref;
75990         witness_script_ref.datalen = witness_script->arr_len;
75991         witness_script_ref.data = witness_script->elems;
75992         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
75993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75995         Witness_free(ret_var);
75996         FREE(witness_script);
75997         return ret_arr;
75998 }
75999
76000 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
76001         LDKHTLCDescriptor this_arg_conv;
76002         this_arg_conv.inner = untag_ptr(this_arg);
76003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76005         this_arg_conv.is_owned = false;
76006         void* signer_provider_ptr = untag_ptr(signer_provider);
76007         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
76008         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
76009         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
76010         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
76011         return tag_ptr(ret_ret, true);
76012 }
76013
76014 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
76015         if (!ptr_is_owned(this_ptr)) return;
76016         void* this_ptr_ptr = untag_ptr(this_ptr);
76017         CHECK_ACCESS(this_ptr_ptr);
76018         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
76019         FREE(untag_ptr(this_ptr));
76020         ChannelSigner_free(this_ptr_conv);
76021 }
76022
76023 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
76024         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
76025         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
76026         return ret_conv;
76027 }
76028
76029 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
76030         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
76031         return ret_conv;
76032 }
76033
76034 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
76035         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
76036         return ret_conv;
76037 }
76038
76039 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
76040         if (!ptr_is_owned(this_ptr)) return;
76041         void* this_ptr_ptr = untag_ptr(this_ptr);
76042         CHECK_ACCESS(this_ptr_ptr);
76043         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
76044         FREE(untag_ptr(this_ptr));
76045         EntropySource_free(this_ptr_conv);
76046 }
76047
76048 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
76049         if (!ptr_is_owned(this_ptr)) return;
76050         void* this_ptr_ptr = untag_ptr(this_ptr);
76051         CHECK_ACCESS(this_ptr_ptr);
76052         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
76053         FREE(untag_ptr(this_ptr));
76054         NodeSigner_free(this_ptr_conv);
76055 }
76056
76057 void  __attribute__((export_name("TS_OutputSpender_free"))) TS_OutputSpender_free(uint64_t this_ptr) {
76058         if (!ptr_is_owned(this_ptr)) return;
76059         void* this_ptr_ptr = untag_ptr(this_ptr);
76060         CHECK_ACCESS(this_ptr_ptr);
76061         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
76062         FREE(untag_ptr(this_ptr));
76063         OutputSpender_free(this_ptr_conv);
76064 }
76065
76066 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
76067         if (!ptr_is_owned(this_ptr)) return;
76068         void* this_ptr_ptr = untag_ptr(this_ptr);
76069         CHECK_ACCESS(this_ptr_ptr);
76070         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
76071         FREE(untag_ptr(this_ptr));
76072         SignerProvider_free(this_ptr_conv);
76073 }
76074
76075 void  __attribute__((export_name("TS_ChangeDestinationSource_free"))) TS_ChangeDestinationSource_free(uint64_t this_ptr) {
76076         if (!ptr_is_owned(this_ptr)) return;
76077         void* this_ptr_ptr = untag_ptr(this_ptr);
76078         CHECK_ACCESS(this_ptr_ptr);
76079         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
76080         FREE(untag_ptr(this_ptr));
76081         ChangeDestinationSource_free(this_ptr_conv);
76082 }
76083
76084 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
76085         LDKInMemorySigner this_obj_conv;
76086         this_obj_conv.inner = untag_ptr(this_obj);
76087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76089         InMemorySigner_free(this_obj_conv);
76090 }
76091
76092 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
76093         LDKInMemorySigner this_ptr_conv;
76094         this_ptr_conv.inner = untag_ptr(this_ptr);
76095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76097         this_ptr_conv.is_owned = false;
76098         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76099         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
76100         return ret_arr;
76101 }
76102
76103 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
76104         LDKInMemorySigner this_ptr_conv;
76105         this_ptr_conv.inner = untag_ptr(this_ptr);
76106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76108         this_ptr_conv.is_owned = false;
76109         LDKSecretKey val_ref;
76110         CHECK(val->arr_len == 32);
76111         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76112         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
76113 }
76114
76115 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
76116         LDKInMemorySigner this_ptr_conv;
76117         this_ptr_conv.inner = untag_ptr(this_ptr);
76118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76120         this_ptr_conv.is_owned = false;
76121         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76122         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
76123         return ret_arr;
76124 }
76125
76126 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
76127         LDKInMemorySigner this_ptr_conv;
76128         this_ptr_conv.inner = untag_ptr(this_ptr);
76129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76131         this_ptr_conv.is_owned = false;
76132         LDKSecretKey val_ref;
76133         CHECK(val->arr_len == 32);
76134         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76135         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
76136 }
76137
76138 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
76139         LDKInMemorySigner this_ptr_conv;
76140         this_ptr_conv.inner = untag_ptr(this_ptr);
76141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76143         this_ptr_conv.is_owned = false;
76144         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76145         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
76146         return ret_arr;
76147 }
76148
76149 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
76150         LDKInMemorySigner this_ptr_conv;
76151         this_ptr_conv.inner = untag_ptr(this_ptr);
76152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76154         this_ptr_conv.is_owned = false;
76155         LDKSecretKey val_ref;
76156         CHECK(val->arr_len == 32);
76157         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76158         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
76159 }
76160
76161 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
76162         LDKInMemorySigner this_ptr_conv;
76163         this_ptr_conv.inner = untag_ptr(this_ptr);
76164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76166         this_ptr_conv.is_owned = false;
76167         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76168         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
76169         return ret_arr;
76170 }
76171
76172 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) {
76173         LDKInMemorySigner this_ptr_conv;
76174         this_ptr_conv.inner = untag_ptr(this_ptr);
76175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76177         this_ptr_conv.is_owned = false;
76178         LDKSecretKey val_ref;
76179         CHECK(val->arr_len == 32);
76180         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76181         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
76182 }
76183
76184 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
76185         LDKInMemorySigner this_ptr_conv;
76186         this_ptr_conv.inner = untag_ptr(this_ptr);
76187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76189         this_ptr_conv.is_owned = false;
76190         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76191         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
76192         return ret_arr;
76193 }
76194
76195 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
76196         LDKInMemorySigner this_ptr_conv;
76197         this_ptr_conv.inner = untag_ptr(this_ptr);
76198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76200         this_ptr_conv.is_owned = false;
76201         LDKSecretKey val_ref;
76202         CHECK(val->arr_len == 32);
76203         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76204         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
76205 }
76206
76207 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
76208         LDKInMemorySigner this_ptr_conv;
76209         this_ptr_conv.inner = untag_ptr(this_ptr);
76210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76212         this_ptr_conv.is_owned = false;
76213         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76214         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
76215         return ret_arr;
76216 }
76217
76218 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
76219         LDKInMemorySigner this_ptr_conv;
76220         this_ptr_conv.inner = untag_ptr(this_ptr);
76221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76223         this_ptr_conv.is_owned = false;
76224         LDKThirtyTwoBytes val_ref;
76225         CHECK(val->arr_len == 32);
76226         memcpy(val_ref.data, val->elems, 32); FREE(val);
76227         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
76228 }
76229
76230 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
76231         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
76232         uint64_t ret_ref = 0;
76233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76235         return ret_ref;
76236 }
76237 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
76238         LDKInMemorySigner arg_conv;
76239         arg_conv.inner = untag_ptr(arg);
76240         arg_conv.is_owned = ptr_is_owned(arg);
76241         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76242         arg_conv.is_owned = false;
76243         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
76244         return ret_conv;
76245 }
76246
76247 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
76248         LDKInMemorySigner orig_conv;
76249         orig_conv.inner = untag_ptr(orig);
76250         orig_conv.is_owned = ptr_is_owned(orig);
76251         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76252         orig_conv.is_owned = false;
76253         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
76254         uint64_t ret_ref = 0;
76255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76257         return ret_ref;
76258 }
76259
76260 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) {
76261         LDKSecretKey funding_key_ref;
76262         CHECK(funding_key->arr_len == 32);
76263         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
76264         LDKSecretKey revocation_base_key_ref;
76265         CHECK(revocation_base_key->arr_len == 32);
76266         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
76267         LDKSecretKey payment_key_ref;
76268         CHECK(payment_key->arr_len == 32);
76269         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
76270         LDKSecretKey delayed_payment_base_key_ref;
76271         CHECK(delayed_payment_base_key->arr_len == 32);
76272         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
76273         LDKSecretKey htlc_base_key_ref;
76274         CHECK(htlc_base_key->arr_len == 32);
76275         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
76276         LDKThirtyTwoBytes commitment_seed_ref;
76277         CHECK(commitment_seed->arr_len == 32);
76278         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
76279         LDKThirtyTwoBytes channel_keys_id_ref;
76280         CHECK(channel_keys_id->arr_len == 32);
76281         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
76282         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
76283         CHECK(rand_bytes_unique_start->arr_len == 32);
76284         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
76285         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);
76286         uint64_t ret_ref = 0;
76287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76289         return ret_ref;
76290 }
76291
76292 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
76293         LDKInMemorySigner this_arg_conv;
76294         this_arg_conv.inner = untag_ptr(this_arg);
76295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76297         this_arg_conv.is_owned = false;
76298         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
76299         uint64_t ret_ref = 0;
76300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76302         return ret_ref;
76303 }
76304
76305 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
76306         LDKInMemorySigner this_arg_conv;
76307         this_arg_conv.inner = untag_ptr(this_arg);
76308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76310         this_arg_conv.is_owned = false;
76311         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
76312         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
76313         uint64_t ret_ref = tag_ptr(ret_copy, true);
76314         return ret_ref;
76315 }
76316
76317 uint64_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
76318         LDKInMemorySigner this_arg_conv;
76319         this_arg_conv.inner = untag_ptr(this_arg);
76320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76322         this_arg_conv.is_owned = false;
76323         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
76324         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
76325         uint64_t ret_ref = tag_ptr(ret_copy, true);
76326         return ret_ref;
76327 }
76328
76329 uint64_t  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
76330         LDKInMemorySigner this_arg_conv;
76331         this_arg_conv.inner = untag_ptr(this_arg);
76332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76334         this_arg_conv.is_owned = false;
76335         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
76336         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
76337         uint64_t ret_ref = tag_ptr(ret_copy, true);
76338         return ret_ref;
76339 }
76340
76341 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
76342         LDKInMemorySigner this_arg_conv;
76343         this_arg_conv.inner = untag_ptr(this_arg);
76344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76346         this_arg_conv.is_owned = false;
76347         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
76348         uint64_t ret_ref = 0;
76349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76351         return ret_ref;
76352 }
76353
76354 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
76355         LDKInMemorySigner this_arg_conv;
76356         this_arg_conv.inner = untag_ptr(this_arg);
76357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76359         this_arg_conv.is_owned = false;
76360         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
76361         uint64_t ret_ref = 0;
76362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76364         return ret_ref;
76365 }
76366
76367 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
76368         LDKInMemorySigner this_arg_conv;
76369         this_arg_conv.inner = untag_ptr(this_arg);
76370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76372         this_arg_conv.is_owned = false;
76373         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
76374         uint64_t ret_ref = 0;
76375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76377         return ret_ref;
76378 }
76379
76380 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) {
76381         LDKInMemorySigner this_arg_conv;
76382         this_arg_conv.inner = untag_ptr(this_arg);
76383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76385         this_arg_conv.is_owned = false;
76386         LDKTransaction spend_tx_ref;
76387         spend_tx_ref.datalen = spend_tx->arr_len;
76388         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
76389         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
76390         spend_tx_ref.data_is_owned = true;
76391         LDKStaticPaymentOutputDescriptor descriptor_conv;
76392         descriptor_conv.inner = untag_ptr(descriptor);
76393         descriptor_conv.is_owned = ptr_is_owned(descriptor);
76394         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
76395         descriptor_conv.is_owned = false;
76396         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
76397         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
76398         return tag_ptr(ret_conv, true);
76399 }
76400
76401 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) {
76402         LDKInMemorySigner this_arg_conv;
76403         this_arg_conv.inner = untag_ptr(this_arg);
76404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76406         this_arg_conv.is_owned = false;
76407         LDKTransaction spend_tx_ref;
76408         spend_tx_ref.datalen = spend_tx->arr_len;
76409         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
76410         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
76411         spend_tx_ref.data_is_owned = true;
76412         LDKDelayedPaymentOutputDescriptor descriptor_conv;
76413         descriptor_conv.inner = untag_ptr(descriptor);
76414         descriptor_conv.is_owned = ptr_is_owned(descriptor);
76415         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
76416         descriptor_conv.is_owned = false;
76417         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
76418         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
76419         return tag_ptr(ret_conv, true);
76420 }
76421
76422 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
76423         LDKInMemorySigner this_arg_conv;
76424         this_arg_conv.inner = untag_ptr(this_arg);
76425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76427         this_arg_conv.is_owned = false;
76428         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
76429         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
76430         return tag_ptr(ret_ret, true);
76431 }
76432
76433 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
76434         LDKInMemorySigner this_arg_conv;
76435         this_arg_conv.inner = untag_ptr(this_arg);
76436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76438         this_arg_conv.is_owned = false;
76439         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
76440         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
76441         return tag_ptr(ret_ret, true);
76442 }
76443
76444 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
76445         LDKInMemorySigner this_arg_conv;
76446         this_arg_conv.inner = untag_ptr(this_arg);
76447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76449         this_arg_conv.is_owned = false;
76450         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
76451         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
76452         return tag_ptr(ret_ret, true);
76453 }
76454
76455 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
76456         LDKInMemorySigner this_arg_conv;
76457         this_arg_conv.inner = untag_ptr(this_arg);
76458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76460         this_arg_conv.is_owned = false;
76461         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
76462         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
76463         return tag_ptr(ret_ret, true);
76464 }
76465
76466 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
76467         LDKInMemorySigner obj_conv;
76468         obj_conv.inner = untag_ptr(obj);
76469         obj_conv.is_owned = ptr_is_owned(obj);
76470         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76471         obj_conv.is_owned = false;
76472         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
76473         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76474         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76475         CVec_u8Z_free(ret_var);
76476         return ret_arr;
76477 }
76478
76479 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
76480         LDKu8slice ser_ref;
76481         ser_ref.datalen = ser->arr_len;
76482         ser_ref.data = ser->elems;
76483         void* arg_ptr = untag_ptr(arg);
76484         CHECK_ACCESS(arg_ptr);
76485         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
76486         if (arg_conv.free == LDKEntropySource_JCalls_free) {
76487                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76488                 LDKEntropySource_JCalls_cloned(&arg_conv);
76489         }
76490         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
76491         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
76492         FREE(ser);
76493         return tag_ptr(ret_conv, true);
76494 }
76495
76496 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
76497         LDKKeysManager this_obj_conv;
76498         this_obj_conv.inner = untag_ptr(this_obj);
76499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76501         KeysManager_free(this_obj_conv);
76502 }
76503
76504 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
76505         uint8_t seed_arr[32];
76506         CHECK(seed->arr_len == 32);
76507         memcpy(seed_arr, seed->elems, 32); FREE(seed);
76508         uint8_t (*seed_ref)[32] = &seed_arr;
76509         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
76510         uint64_t ret_ref = 0;
76511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76513         return ret_ref;
76514 }
76515
76516 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
76517         LDKKeysManager this_arg_conv;
76518         this_arg_conv.inner = untag_ptr(this_arg);
76519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76521         this_arg_conv.is_owned = false;
76522         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76523         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
76524         return ret_arr;
76525 }
76526
76527 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) {
76528         LDKKeysManager this_arg_conv;
76529         this_arg_conv.inner = untag_ptr(this_arg);
76530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76532         this_arg_conv.is_owned = false;
76533         uint8_t params_arr[32];
76534         CHECK(params->arr_len == 32);
76535         memcpy(params_arr, params->elems, 32); FREE(params);
76536         uint8_t (*params_ref)[32] = &params_arr;
76537         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
76538         uint64_t ret_ref = 0;
76539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76541         return ret_ref;
76542 }
76543
76544 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) {
76545         LDKKeysManager this_arg_conv;
76546         this_arg_conv.inner = untag_ptr(this_arg);
76547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76549         this_arg_conv.is_owned = false;
76550         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
76551         descriptors_constr.datalen = descriptors->arr_len;
76552         if (descriptors_constr.datalen > 0)
76553                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
76554         else
76555                 descriptors_constr.data = NULL;
76556         uint64_t* descriptors_vals = descriptors->elems;
76557         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
76558                 uint64_t descriptors_conv_27 = descriptors_vals[b];
76559                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
76560                 CHECK_ACCESS(descriptors_conv_27_ptr);
76561                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
76562                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
76563                 descriptors_constr.data[b] = descriptors_conv_27_conv;
76564         }
76565         FREE(descriptors);
76566         LDKCVec_u8Z psbt_ref;
76567         psbt_ref.datalen = psbt->arr_len;
76568         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
76569         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
76570         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
76571         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
76572         return tag_ptr(ret_conv, true);
76573 }
76574
76575 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
76576         LDKKeysManager this_arg_conv;
76577         this_arg_conv.inner = untag_ptr(this_arg);
76578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76580         this_arg_conv.is_owned = false;
76581         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
76582         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
76583         return tag_ptr(ret_ret, true);
76584 }
76585
76586 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
76587         LDKKeysManager this_arg_conv;
76588         this_arg_conv.inner = untag_ptr(this_arg);
76589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76591         this_arg_conv.is_owned = false;
76592         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
76593         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
76594         return tag_ptr(ret_ret, true);
76595 }
76596
76597 uint64_t  __attribute__((export_name("TS_KeysManager_as_OutputSpender"))) TS_KeysManager_as_OutputSpender(uint64_t this_arg) {
76598         LDKKeysManager this_arg_conv;
76599         this_arg_conv.inner = untag_ptr(this_arg);
76600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76602         this_arg_conv.is_owned = false;
76603         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
76604         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
76605         return tag_ptr(ret_ret, true);
76606 }
76607
76608 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
76609         LDKKeysManager this_arg_conv;
76610         this_arg_conv.inner = untag_ptr(this_arg);
76611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76613         this_arg_conv.is_owned = false;
76614         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
76615         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
76616         return tag_ptr(ret_ret, true);
76617 }
76618
76619 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
76620         LDKPhantomKeysManager this_obj_conv;
76621         this_obj_conv.inner = untag_ptr(this_obj);
76622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76624         PhantomKeysManager_free(this_obj_conv);
76625 }
76626
76627 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
76628         LDKPhantomKeysManager this_arg_conv;
76629         this_arg_conv.inner = untag_ptr(this_arg);
76630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76632         this_arg_conv.is_owned = false;
76633         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
76634         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
76635         return tag_ptr(ret_ret, true);
76636 }
76637
76638 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
76639         LDKPhantomKeysManager this_arg_conv;
76640         this_arg_conv.inner = untag_ptr(this_arg);
76641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76643         this_arg_conv.is_owned = false;
76644         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
76645         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
76646         return tag_ptr(ret_ret, true);
76647 }
76648
76649 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_OutputSpender"))) TS_PhantomKeysManager_as_OutputSpender(uint64_t this_arg) {
76650         LDKPhantomKeysManager this_arg_conv;
76651         this_arg_conv.inner = untag_ptr(this_arg);
76652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76654         this_arg_conv.is_owned = false;
76655         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
76656         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
76657         return tag_ptr(ret_ret, true);
76658 }
76659
76660 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
76661         LDKPhantomKeysManager this_arg_conv;
76662         this_arg_conv.inner = untag_ptr(this_arg);
76663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76665         this_arg_conv.is_owned = false;
76666         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
76667         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
76668         return tag_ptr(ret_ret, true);
76669 }
76670
76671 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) {
76672         uint8_t seed_arr[32];
76673         CHECK(seed->arr_len == 32);
76674         memcpy(seed_arr, seed->elems, 32); FREE(seed);
76675         uint8_t (*seed_ref)[32] = &seed_arr;
76676         uint8_t cross_node_seed_arr[32];
76677         CHECK(cross_node_seed->arr_len == 32);
76678         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
76679         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
76680         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
76681         uint64_t ret_ref = 0;
76682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76684         return ret_ref;
76685 }
76686
76687 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) {
76688         LDKPhantomKeysManager this_arg_conv;
76689         this_arg_conv.inner = untag_ptr(this_arg);
76690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76692         this_arg_conv.is_owned = false;
76693         uint8_t params_arr[32];
76694         CHECK(params->arr_len == 32);
76695         memcpy(params_arr, params->elems, 32); FREE(params);
76696         uint8_t (*params_ref)[32] = &params_arr;
76697         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
76698         uint64_t ret_ref = 0;
76699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76701         return ret_ref;
76702 }
76703
76704 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
76705         LDKPhantomKeysManager this_arg_conv;
76706         this_arg_conv.inner = untag_ptr(this_arg);
76707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76709         this_arg_conv.is_owned = false;
76710         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76711         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
76712         return ret_arr;
76713 }
76714
76715 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
76716         LDKPhantomKeysManager this_arg_conv;
76717         this_arg_conv.inner = untag_ptr(this_arg);
76718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76720         this_arg_conv.is_owned = false;
76721         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76722         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
76723         return ret_arr;
76724 }
76725
76726 void  __attribute__((export_name("TS_RandomBytes_free"))) TS_RandomBytes_free(uint64_t this_obj) {
76727         LDKRandomBytes this_obj_conv;
76728         this_obj_conv.inner = untag_ptr(this_obj);
76729         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76731         RandomBytes_free(this_obj_conv);
76732 }
76733
76734 uint64_t  __attribute__((export_name("TS_RandomBytes_new"))) TS_RandomBytes_new(int8_tArray seed) {
76735         LDKThirtyTwoBytes seed_ref;
76736         CHECK(seed->arr_len == 32);
76737         memcpy(seed_ref.data, seed->elems, 32); FREE(seed);
76738         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
76739         uint64_t ret_ref = 0;
76740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76742         return ret_ref;
76743 }
76744
76745 uint64_t  __attribute__((export_name("TS_RandomBytes_as_EntropySource"))) TS_RandomBytes_as_EntropySource(uint64_t this_arg) {
76746         LDKRandomBytes this_arg_conv;
76747         this_arg_conv.inner = untag_ptr(this_arg);
76748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76750         this_arg_conv.is_owned = false;
76751         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
76752         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
76753         return tag_ptr(ret_ret, true);
76754 }
76755
76756 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
76757         if (!ptr_is_owned(this_ptr)) return;
76758         void* this_ptr_ptr = untag_ptr(this_ptr);
76759         CHECK_ACCESS(this_ptr_ptr);
76760         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
76761         FREE(untag_ptr(this_ptr));
76762         EcdsaChannelSigner_free(this_ptr_conv);
76763 }
76764
76765 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
76766         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
76767         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
76768         return tag_ptr(ret_ret, true);
76769 }
76770 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
76771         void* arg_ptr = untag_ptr(arg);
76772         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
76773         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
76774         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
76775         return ret_conv;
76776 }
76777
76778 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
76779         void* orig_ptr = untag_ptr(orig);
76780         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
76781         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
76782         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
76783         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
76784         return tag_ptr(ret_ret, true);
76785 }
76786
76787 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
76788         if (!ptr_is_owned(this_ptr)) return;
76789         void* this_ptr_ptr = untag_ptr(this_ptr);
76790         CHECK_ACCESS(this_ptr_ptr);
76791         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
76792         FREE(untag_ptr(this_ptr));
76793         WriteableEcdsaChannelSigner_free(this_ptr_conv);
76794 }
76795
76796 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
76797         LDKOnionMessenger this_obj_conv;
76798         this_obj_conv.inner = untag_ptr(this_obj);
76799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76801         OnionMessenger_free(this_obj_conv);
76802 }
76803
76804 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
76805         if (!ptr_is_owned(this_ptr)) return;
76806         void* this_ptr_ptr = untag_ptr(this_ptr);
76807         CHECK_ACCESS(this_ptr_ptr);
76808         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
76809         FREE(untag_ptr(this_ptr));
76810         MessageRouter_free(this_ptr_conv);
76811 }
76812
76813 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
76814         LDKDefaultMessageRouter this_obj_conv;
76815         this_obj_conv.inner = untag_ptr(this_obj);
76816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76818         DefaultMessageRouter_free(this_obj_conv);
76819 }
76820
76821 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new(uint64_t network_graph, uint64_t entropy_source) {
76822         LDKNetworkGraph network_graph_conv;
76823         network_graph_conv.inner = untag_ptr(network_graph);
76824         network_graph_conv.is_owned = ptr_is_owned(network_graph);
76825         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
76826         network_graph_conv.is_owned = false;
76827         void* entropy_source_ptr = untag_ptr(entropy_source);
76828         CHECK_ACCESS(entropy_source_ptr);
76829         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76830         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76831                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76832                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76833         }
76834         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
76835         uint64_t ret_ref = 0;
76836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76838         return ret_ref;
76839 }
76840
76841 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
76842         LDKDefaultMessageRouter this_arg_conv;
76843         this_arg_conv.inner = untag_ptr(this_arg);
76844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76846         this_arg_conv.is_owned = false;
76847         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
76848         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
76849         return tag_ptr(ret_ret, true);
76850 }
76851
76852 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
76853         LDKOnionMessagePath this_obj_conv;
76854         this_obj_conv.inner = untag_ptr(this_obj);
76855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76857         OnionMessagePath_free(this_obj_conv);
76858 }
76859
76860 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
76861         LDKOnionMessagePath this_ptr_conv;
76862         this_ptr_conv.inner = untag_ptr(this_ptr);
76863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76865         this_ptr_conv.is_owned = false;
76866         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
76867         ptrArray ret_arr = NULL;
76868         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
76869         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
76870         for (size_t m = 0; m < ret_var.datalen; m++) {
76871                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
76872                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
76873                 ret_arr_ptr[m] = ret_conv_12_arr;
76874         }
76875         
76876         FREE(ret_var.data);
76877         return ret_arr;
76878 }
76879
76880 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
76881         LDKOnionMessagePath this_ptr_conv;
76882         this_ptr_conv.inner = untag_ptr(this_ptr);
76883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76885         this_ptr_conv.is_owned = false;
76886         LDKCVec_PublicKeyZ val_constr;
76887         val_constr.datalen = val->arr_len;
76888         if (val_constr.datalen > 0)
76889                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76890         else
76891                 val_constr.data = NULL;
76892         int8_tArray* val_vals = (void*) val->elems;
76893         for (size_t m = 0; m < val_constr.datalen; m++) {
76894                 int8_tArray val_conv_12 = val_vals[m];
76895                 LDKPublicKey val_conv_12_ref;
76896                 CHECK(val_conv_12->arr_len == 33);
76897                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
76898                 val_constr.data[m] = val_conv_12_ref;
76899         }
76900         FREE(val);
76901         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
76902 }
76903
76904 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
76905         LDKOnionMessagePath this_ptr_conv;
76906         this_ptr_conv.inner = untag_ptr(this_ptr);
76907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76909         this_ptr_conv.is_owned = false;
76910         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
76911         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
76912         uint64_t ret_ref = tag_ptr(ret_copy, true);
76913         return ret_ref;
76914 }
76915
76916 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
76917         LDKOnionMessagePath this_ptr_conv;
76918         this_ptr_conv.inner = untag_ptr(this_ptr);
76919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76921         this_ptr_conv.is_owned = false;
76922         void* val_ptr = untag_ptr(val);
76923         CHECK_ACCESS(val_ptr);
76924         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
76925         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
76926         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
76927 }
76928
76929 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_first_node_addresses"))) TS_OnionMessagePath_get_first_node_addresses(uint64_t this_ptr) {
76930         LDKOnionMessagePath this_ptr_conv;
76931         this_ptr_conv.inner = untag_ptr(this_ptr);
76932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76934         this_ptr_conv.is_owned = false;
76935         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
76936         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
76937         uint64_t ret_ref = tag_ptr(ret_copy, true);
76938         return ret_ref;
76939 }
76940
76941 void  __attribute__((export_name("TS_OnionMessagePath_set_first_node_addresses"))) TS_OnionMessagePath_set_first_node_addresses(uint64_t this_ptr, uint64_t val) {
76942         LDKOnionMessagePath this_ptr_conv;
76943         this_ptr_conv.inner = untag_ptr(this_ptr);
76944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76946         this_ptr_conv.is_owned = false;
76947         void* val_ptr = untag_ptr(val);
76948         CHECK_ACCESS(val_ptr);
76949         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
76950         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
76951         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
76952 }
76953
76954 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) {
76955         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
76956         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
76957         if (intermediate_nodes_arg_constr.datalen > 0)
76958                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76959         else
76960                 intermediate_nodes_arg_constr.data = NULL;
76961         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
76962         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
76963                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
76964                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
76965                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
76966                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
76967                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
76968         }
76969         FREE(intermediate_nodes_arg);
76970         void* destination_arg_ptr = untag_ptr(destination_arg);
76971         CHECK_ACCESS(destination_arg_ptr);
76972         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
76973         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
76974         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
76975         CHECK_ACCESS(first_node_addresses_arg_ptr);
76976         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
76977         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
76978         uint64_t ret_ref = 0;
76979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76981         return ret_ref;
76982 }
76983
76984 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
76985         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
76986         uint64_t ret_ref = 0;
76987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76989         return ret_ref;
76990 }
76991 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
76992         LDKOnionMessagePath arg_conv;
76993         arg_conv.inner = untag_ptr(arg);
76994         arg_conv.is_owned = ptr_is_owned(arg);
76995         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76996         arg_conv.is_owned = false;
76997         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
76998         return ret_conv;
76999 }
77000
77001 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
77002         LDKOnionMessagePath orig_conv;
77003         orig_conv.inner = untag_ptr(orig);
77004         orig_conv.is_owned = ptr_is_owned(orig);
77005         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77006         orig_conv.is_owned = false;
77007         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
77008         uint64_t ret_ref = 0;
77009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77011         return ret_ref;
77012 }
77013
77014 int8_tArray  __attribute__((export_name("TS_OnionMessagePath_first_node"))) TS_OnionMessagePath_first_node(uint64_t this_arg) {
77015         LDKOnionMessagePath this_arg_conv;
77016         this_arg_conv.inner = untag_ptr(this_arg);
77017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77019         this_arg_conv.is_owned = false;
77020         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77021         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
77022         return ret_arr;
77023 }
77024
77025 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
77026         if (!ptr_is_owned(this_ptr)) return;
77027         void* this_ptr_ptr = untag_ptr(this_ptr);
77028         CHECK_ACCESS(this_ptr_ptr);
77029         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
77030         FREE(untag_ptr(this_ptr));
77031         Destination_free(this_ptr_conv);
77032 }
77033
77034 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
77035         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77036         *ret_copy = Destination_clone(arg);
77037         uint64_t ret_ref = tag_ptr(ret_copy, true);
77038         return ret_ref;
77039 }
77040 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
77041         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
77042         int64_t ret_conv = Destination_clone_ptr(arg_conv);
77043         return ret_conv;
77044 }
77045
77046 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
77047         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
77048         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77049         *ret_copy = Destination_clone(orig_conv);
77050         uint64_t ret_ref = tag_ptr(ret_copy, true);
77051         return ret_ref;
77052 }
77053
77054 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
77055         LDKPublicKey a_ref;
77056         CHECK(a->arr_len == 33);
77057         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77058         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77059         *ret_copy = Destination_node(a_ref);
77060         uint64_t ret_ref = tag_ptr(ret_copy, true);
77061         return ret_ref;
77062 }
77063
77064 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
77065         LDKBlindedPath a_conv;
77066         a_conv.inner = untag_ptr(a);
77067         a_conv.is_owned = ptr_is_owned(a);
77068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77069         a_conv = BlindedPath_clone(&a_conv);
77070         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77071         *ret_copy = Destination_blinded_path(a_conv);
77072         uint64_t ret_ref = tag_ptr(ret_copy, true);
77073         return ret_ref;
77074 }
77075
77076 int64_t  __attribute__((export_name("TS_Destination_hash"))) TS_Destination_hash(uint64_t o) {
77077         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
77078         int64_t ret_conv = Destination_hash(o_conv);
77079         return ret_conv;
77080 }
77081
77082 jboolean  __attribute__((export_name("TS_Destination_eq"))) TS_Destination_eq(uint64_t a, uint64_t b) {
77083         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
77084         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
77085         jboolean ret_conv = Destination_eq(a_conv, b_conv);
77086         return ret_conv;
77087 }
77088
77089 void  __attribute__((export_name("TS_Destination_resolve"))) TS_Destination_resolve(uint64_t this_arg, uint64_t network_graph) {
77090         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
77091         LDKReadOnlyNetworkGraph network_graph_conv;
77092         network_graph_conv.inner = untag_ptr(network_graph);
77093         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77094         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77095         network_graph_conv.is_owned = false;
77096         Destination_resolve(this_arg_conv, &network_graph_conv);
77097 }
77098
77099 void  __attribute__((export_name("TS_SendSuccess_free"))) TS_SendSuccess_free(uint64_t this_ptr) {
77100         if (!ptr_is_owned(this_ptr)) return;
77101         void* this_ptr_ptr = untag_ptr(this_ptr);
77102         CHECK_ACCESS(this_ptr_ptr);
77103         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
77104         FREE(untag_ptr(this_ptr));
77105         SendSuccess_free(this_ptr_conv);
77106 }
77107
77108 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
77109         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77110         *ret_copy = SendSuccess_clone(arg);
77111         uint64_t ret_ref = tag_ptr(ret_copy, true);
77112         return ret_ref;
77113 }
77114 int64_t  __attribute__((export_name("TS_SendSuccess_clone_ptr"))) TS_SendSuccess_clone_ptr(uint64_t arg) {
77115         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
77116         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
77117         return ret_conv;
77118 }
77119
77120 uint64_t  __attribute__((export_name("TS_SendSuccess_clone"))) TS_SendSuccess_clone(uint64_t orig) {
77121         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
77122         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77123         *ret_copy = SendSuccess_clone(orig_conv);
77124         uint64_t ret_ref = tag_ptr(ret_copy, true);
77125         return ret_ref;
77126 }
77127
77128 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered"))) TS_SendSuccess_buffered() {
77129         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77130         *ret_copy = SendSuccess_buffered();
77131         uint64_t ret_ref = tag_ptr(ret_copy, true);
77132         return ret_ref;
77133 }
77134
77135 uint64_t  __attribute__((export_name("TS_SendSuccess_buffered_awaiting_connection"))) TS_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
77136         LDKPublicKey a_ref;
77137         CHECK(a->arr_len == 33);
77138         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77139         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77140         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
77141         uint64_t ret_ref = tag_ptr(ret_copy, true);
77142         return ret_ref;
77143 }
77144
77145 int64_t  __attribute__((export_name("TS_SendSuccess_hash"))) TS_SendSuccess_hash(uint64_t o) {
77146         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
77147         int64_t ret_conv = SendSuccess_hash(o_conv);
77148         return ret_conv;
77149 }
77150
77151 jboolean  __attribute__((export_name("TS_SendSuccess_eq"))) TS_SendSuccess_eq(uint64_t a, uint64_t b) {
77152         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
77153         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
77154         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
77155         return ret_conv;
77156 }
77157
77158 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
77159         if (!ptr_is_owned(this_ptr)) return;
77160         void* this_ptr_ptr = untag_ptr(this_ptr);
77161         CHECK_ACCESS(this_ptr_ptr);
77162         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
77163         FREE(untag_ptr(this_ptr));
77164         SendError_free(this_ptr_conv);
77165 }
77166
77167 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
77168         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77169         *ret_copy = SendError_clone(arg);
77170         uint64_t ret_ref = tag_ptr(ret_copy, true);
77171         return ret_ref;
77172 }
77173 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
77174         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
77175         int64_t ret_conv = SendError_clone_ptr(arg_conv);
77176         return ret_conv;
77177 }
77178
77179 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
77180         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
77181         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77182         *ret_copy = SendError_clone(orig_conv);
77183         uint64_t ret_ref = tag_ptr(ret_copy, true);
77184         return ret_ref;
77185 }
77186
77187 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
77188         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
77189         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77190         *ret_copy = SendError_secp256k1(a_conv);
77191         uint64_t ret_ref = tag_ptr(ret_copy, true);
77192         return ret_ref;
77193 }
77194
77195 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
77196         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77197         *ret_copy = SendError_too_big_packet();
77198         uint64_t ret_ref = tag_ptr(ret_copy, true);
77199         return ret_ref;
77200 }
77201
77202 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
77203         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77204         *ret_copy = SendError_too_few_blinded_hops();
77205         uint64_t ret_ref = tag_ptr(ret_copy, true);
77206         return ret_ref;
77207 }
77208
77209 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop(int8_tArray a) {
77210         LDKPublicKey a_ref;
77211         CHECK(a->arr_len == 33);
77212         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77213         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77214         *ret_copy = SendError_invalid_first_hop(a_ref);
77215         uint64_t ret_ref = tag_ptr(ret_copy, true);
77216         return ret_ref;
77217 }
77218
77219 uint64_t  __attribute__((export_name("TS_SendError_path_not_found"))) TS_SendError_path_not_found() {
77220         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77221         *ret_copy = SendError_path_not_found();
77222         uint64_t ret_ref = tag_ptr(ret_copy, true);
77223         return ret_ref;
77224 }
77225
77226 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
77227         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77228         *ret_copy = SendError_invalid_message();
77229         uint64_t ret_ref = tag_ptr(ret_copy, true);
77230         return ret_ref;
77231 }
77232
77233 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
77234         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77235         *ret_copy = SendError_buffer_full();
77236         uint64_t ret_ref = tag_ptr(ret_copy, true);
77237         return ret_ref;
77238 }
77239
77240 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
77241         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77242         *ret_copy = SendError_get_node_id_failed();
77243         uint64_t ret_ref = tag_ptr(ret_copy, true);
77244         return ret_ref;
77245 }
77246
77247 uint64_t  __attribute__((export_name("TS_SendError_unresolved_introduction_node"))) TS_SendError_unresolved_introduction_node() {
77248         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77249         *ret_copy = SendError_unresolved_introduction_node();
77250         uint64_t ret_ref = tag_ptr(ret_copy, true);
77251         return ret_ref;
77252 }
77253
77254 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
77255         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77256         *ret_copy = SendError_blinded_path_advance_failed();
77257         uint64_t ret_ref = tag_ptr(ret_copy, true);
77258         return ret_ref;
77259 }
77260
77261 int64_t  __attribute__((export_name("TS_SendError_hash"))) TS_SendError_hash(uint64_t o) {
77262         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
77263         int64_t ret_conv = SendError_hash(o_conv);
77264         return ret_conv;
77265 }
77266
77267 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
77268         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
77269         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
77270         jboolean ret_conv = SendError_eq(a_conv, b_conv);
77271         return ret_conv;
77272 }
77273
77274 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
77275         if (!ptr_is_owned(this_ptr)) return;
77276         void* this_ptr_ptr = untag_ptr(this_ptr);
77277         CHECK_ACCESS(this_ptr_ptr);
77278         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
77279         FREE(untag_ptr(this_ptr));
77280         CustomOnionMessageHandler_free(this_ptr_conv);
77281 }
77282
77283 void  __attribute__((export_name("TS_PeeledOnion_free"))) TS_PeeledOnion_free(uint64_t this_ptr) {
77284         if (!ptr_is_owned(this_ptr)) return;
77285         void* this_ptr_ptr = untag_ptr(this_ptr);
77286         CHECK_ACCESS(this_ptr_ptr);
77287         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
77288         FREE(untag_ptr(this_ptr));
77289         PeeledOnion_free(this_ptr_conv);
77290 }
77291
77292 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
77293         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77294         *ret_copy = PeeledOnion_clone(arg);
77295         uint64_t ret_ref = tag_ptr(ret_copy, true);
77296         return ret_ref;
77297 }
77298 int64_t  __attribute__((export_name("TS_PeeledOnion_clone_ptr"))) TS_PeeledOnion_clone_ptr(uint64_t arg) {
77299         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
77300         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
77301         return ret_conv;
77302 }
77303
77304 uint64_t  __attribute__((export_name("TS_PeeledOnion_clone"))) TS_PeeledOnion_clone(uint64_t orig) {
77305         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
77306         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77307         *ret_copy = PeeledOnion_clone(orig_conv);
77308         uint64_t ret_ref = tag_ptr(ret_copy, true);
77309         return ret_ref;
77310 }
77311
77312 uint64_t  __attribute__((export_name("TS_PeeledOnion_forward"))) TS_PeeledOnion_forward(uint64_t a, uint64_t b) {
77313         void* a_ptr = untag_ptr(a);
77314         CHECK_ACCESS(a_ptr);
77315         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
77316         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
77317         LDKOnionMessage b_conv;
77318         b_conv.inner = untag_ptr(b);
77319         b_conv.is_owned = ptr_is_owned(b);
77320         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77321         b_conv = OnionMessage_clone(&b_conv);
77322         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77323         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
77324         uint64_t ret_ref = tag_ptr(ret_copy, true);
77325         return ret_ref;
77326 }
77327
77328 uint64_t  __attribute__((export_name("TS_PeeledOnion_receive"))) TS_PeeledOnion_receive(uint64_t a, int8_tArray b, uint64_t c) {
77329         void* a_ptr = untag_ptr(a);
77330         CHECK_ACCESS(a_ptr);
77331         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
77332         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
77333         LDKThirtyTwoBytes b_ref;
77334         CHECK(b->arr_len == 32);
77335         memcpy(b_ref.data, b->elems, 32); FREE(b);
77336         LDKBlindedPath c_conv;
77337         c_conv.inner = untag_ptr(c);
77338         c_conv.is_owned = ptr_is_owned(c);
77339         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
77340         c_conv = BlindedPath_clone(&c_conv);
77341         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77342         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
77343         uint64_t ret_ref = tag_ptr(ret_copy, true);
77344         return ret_ref;
77345 }
77346
77347 uint64_t  __attribute__((export_name("TS_create_onion_message_resolving_destination"))) TS_create_onion_message_resolving_destination(uint64_t entropy_source, uint64_t node_signer, uint64_t node_id_lookup, uint64_t network_graph, uint64_t path, uint64_t contents, uint64_t reply_path) {
77348         void* entropy_source_ptr = untag_ptr(entropy_source);
77349         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
77350         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
77351         void* node_signer_ptr = untag_ptr(node_signer);
77352         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
77353         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
77354         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
77355         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
77356         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
77357         LDKReadOnlyNetworkGraph network_graph_conv;
77358         network_graph_conv.inner = untag_ptr(network_graph);
77359         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77360         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77361         network_graph_conv.is_owned = false;
77362         LDKOnionMessagePath path_conv;
77363         path_conv.inner = untag_ptr(path);
77364         path_conv.is_owned = ptr_is_owned(path);
77365         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
77366         path_conv = OnionMessagePath_clone(&path_conv);
77367         void* contents_ptr = untag_ptr(contents);
77368         CHECK_ACCESS(contents_ptr);
77369         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
77370         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
77371                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77372                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
77373         }
77374         LDKBlindedPath reply_path_conv;
77375         reply_path_conv.inner = untag_ptr(reply_path);
77376         reply_path_conv.is_owned = ptr_is_owned(reply_path);
77377         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
77378         reply_path_conv = BlindedPath_clone(&reply_path_conv);
77379         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
77380         *ret_conv = create_onion_message_resolving_destination(entropy_source_conv, node_signer_conv, node_id_lookup_conv, &network_graph_conv, path_conv, contents_conv, reply_path_conv);
77381         return tag_ptr(ret_conv, true);
77382 }
77383
77384 uint64_t  __attribute__((export_name("TS_create_onion_message"))) TS_create_onion_message(uint64_t entropy_source, uint64_t node_signer, uint64_t node_id_lookup, uint64_t path, uint64_t contents, uint64_t reply_path) {
77385         void* entropy_source_ptr = untag_ptr(entropy_source);
77386         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
77387         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
77388         void* node_signer_ptr = untag_ptr(node_signer);
77389         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
77390         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
77391         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
77392         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
77393         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
77394         LDKOnionMessagePath path_conv;
77395         path_conv.inner = untag_ptr(path);
77396         path_conv.is_owned = ptr_is_owned(path);
77397         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
77398         path_conv = OnionMessagePath_clone(&path_conv);
77399         void* contents_ptr = untag_ptr(contents);
77400         CHECK_ACCESS(contents_ptr);
77401         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
77402         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
77403                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77404                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
77405         }
77406         LDKBlindedPath reply_path_conv;
77407         reply_path_conv.inner = untag_ptr(reply_path);
77408         reply_path_conv.is_owned = ptr_is_owned(reply_path);
77409         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
77410         reply_path_conv = BlindedPath_clone(&reply_path_conv);
77411         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
77412         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
77413         return tag_ptr(ret_conv, true);
77414 }
77415
77416 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) {
77417         LDKOnionMessage msg_conv;
77418         msg_conv.inner = untag_ptr(msg);
77419         msg_conv.is_owned = ptr_is_owned(msg);
77420         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77421         msg_conv.is_owned = false;
77422         void* node_signer_ptr = untag_ptr(node_signer);
77423         CHECK_ACCESS(node_signer_ptr);
77424         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77425         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77426                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77427                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77428         }
77429         void* logger_ptr = untag_ptr(logger);
77430         CHECK_ACCESS(logger_ptr);
77431         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77432         if (logger_conv.free == LDKLogger_JCalls_free) {
77433                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77434                 LDKLogger_JCalls_cloned(&logger_conv);
77435         }
77436         void* custom_handler_ptr = untag_ptr(custom_handler);
77437         CHECK_ACCESS(custom_handler_ptr);
77438         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
77439         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
77440                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77441                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
77442         }
77443         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
77444         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
77445         return tag_ptr(ret_conv, true);
77446 }
77447
77448 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint64_t node_id_lookup, uint64_t message_router, uint64_t offers_handler, uint64_t custom_handler) {
77449         void* entropy_source_ptr = untag_ptr(entropy_source);
77450         CHECK_ACCESS(entropy_source_ptr);
77451         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77452         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77453                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77454                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77455         }
77456         void* node_signer_ptr = untag_ptr(node_signer);
77457         CHECK_ACCESS(node_signer_ptr);
77458         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77459         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77461                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77462         }
77463         void* logger_ptr = untag_ptr(logger);
77464         CHECK_ACCESS(logger_ptr);
77465         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77466         if (logger_conv.free == LDKLogger_JCalls_free) {
77467                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77468                 LDKLogger_JCalls_cloned(&logger_conv);
77469         }
77470         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
77471         CHECK_ACCESS(node_id_lookup_ptr);
77472         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
77473         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
77474                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77475                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
77476         }
77477         void* message_router_ptr = untag_ptr(message_router);
77478         CHECK_ACCESS(message_router_ptr);
77479         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
77480         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
77481                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77482                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
77483         }
77484         void* offers_handler_ptr = untag_ptr(offers_handler);
77485         CHECK_ACCESS(offers_handler_ptr);
77486         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
77487         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
77488                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77489                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
77490         }
77491         void* custom_handler_ptr = untag_ptr(custom_handler);
77492         CHECK_ACCESS(custom_handler_ptr);
77493         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
77494         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
77495                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77496                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
77497         }
77498         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, node_id_lookup_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
77499         uint64_t ret_ref = 0;
77500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77502         return ret_ref;
77503 }
77504
77505 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) {
77506         LDKOnionMessenger this_arg_conv;
77507         this_arg_conv.inner = untag_ptr(this_arg);
77508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77510         this_arg_conv.is_owned = false;
77511         void* contents_ptr = untag_ptr(contents);
77512         CHECK_ACCESS(contents_ptr);
77513         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
77514         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
77515                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77516                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
77517         }
77518         void* destination_ptr = untag_ptr(destination);
77519         CHECK_ACCESS(destination_ptr);
77520         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
77521         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
77522         LDKBlindedPath reply_path_conv;
77523         reply_path_conv.inner = untag_ptr(reply_path);
77524         reply_path_conv.is_owned = ptr_is_owned(reply_path);
77525         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
77526         reply_path_conv = BlindedPath_clone(&reply_path_conv);
77527         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
77528         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
77529         return tag_ptr(ret_conv, true);
77530 }
77531
77532 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
77533         LDKOnionMessenger this_arg_conv;
77534         this_arg_conv.inner = untag_ptr(this_arg);
77535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77537         this_arg_conv.is_owned = false;
77538         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
77539         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
77540         return tag_ptr(ret_ret, true);
77541 }
77542
77543 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
77544         if (!ptr_is_owned(this_ptr)) return;
77545         void* this_ptr_ptr = untag_ptr(this_ptr);
77546         CHECK_ACCESS(this_ptr_ptr);
77547         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
77548         FREE(untag_ptr(this_ptr));
77549         OffersMessageHandler_free(this_ptr_conv);
77550 }
77551
77552 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
77553         if (!ptr_is_owned(this_ptr)) return;
77554         void* this_ptr_ptr = untag_ptr(this_ptr);
77555         CHECK_ACCESS(this_ptr_ptr);
77556         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
77557         FREE(untag_ptr(this_ptr));
77558         OffersMessage_free(this_ptr_conv);
77559 }
77560
77561 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
77562         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
77563         *ret_copy = OffersMessage_clone(arg);
77564         uint64_t ret_ref = tag_ptr(ret_copy, true);
77565         return ret_ref;
77566 }
77567 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
77568         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
77569         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
77570         return ret_conv;
77571 }
77572
77573 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
77574         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
77575         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
77576         *ret_copy = OffersMessage_clone(orig_conv);
77577         uint64_t ret_ref = tag_ptr(ret_copy, true);
77578         return ret_ref;
77579 }
77580
77581 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
77582         LDKInvoiceRequest a_conv;
77583         a_conv.inner = untag_ptr(a);
77584         a_conv.is_owned = ptr_is_owned(a);
77585         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77586         a_conv = InvoiceRequest_clone(&a_conv);
77587         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
77588         *ret_copy = OffersMessage_invoice_request(a_conv);
77589         uint64_t ret_ref = tag_ptr(ret_copy, true);
77590         return ret_ref;
77591 }
77592
77593 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
77594         LDKBolt12Invoice a_conv;
77595         a_conv.inner = untag_ptr(a);
77596         a_conv.is_owned = ptr_is_owned(a);
77597         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77598         a_conv = Bolt12Invoice_clone(&a_conv);
77599         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
77600         *ret_copy = OffersMessage_invoice(a_conv);
77601         uint64_t ret_ref = tag_ptr(ret_copy, true);
77602         return ret_ref;
77603 }
77604
77605 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
77606         LDKInvoiceError a_conv;
77607         a_conv.inner = untag_ptr(a);
77608         a_conv.is_owned = ptr_is_owned(a);
77609         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77610         a_conv = InvoiceError_clone(&a_conv);
77611         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
77612         *ret_copy = OffersMessage_invoice_error(a_conv);
77613         uint64_t ret_ref = tag_ptr(ret_copy, true);
77614         return ret_ref;
77615 }
77616
77617 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
77618         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
77619         return ret_conv;
77620 }
77621
77622 uint64_t  __attribute__((export_name("TS_OffersMessage_as_OnionMessageContents"))) TS_OffersMessage_as_OnionMessageContents(uint64_t this_arg) {
77623         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
77624         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
77625         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
77626         return tag_ptr(ret_ret, true);
77627 }
77628
77629 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
77630         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
77631         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
77632         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77633         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77634         CVec_u8Z_free(ret_var);
77635         return ret_arr;
77636 }
77637
77638 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
77639         LDKu8slice ser_ref;
77640         ser_ref.datalen = ser->arr_len;
77641         ser_ref.data = ser->elems;
77642         void* arg_b_ptr = untag_ptr(arg_b);
77643         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
77644         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
77645         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
77646         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
77647         FREE(ser);
77648         return tag_ptr(ret_conv, true);
77649 }
77650
77651 void  __attribute__((export_name("TS_Packet_free"))) TS_Packet_free(uint64_t this_obj) {
77652         LDKPacket this_obj_conv;
77653         this_obj_conv.inner = untag_ptr(this_obj);
77654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77656         Packet_free(this_obj_conv);
77657 }
77658
77659 int8_t  __attribute__((export_name("TS_Packet_get_version"))) TS_Packet_get_version(uint64_t this_ptr) {
77660         LDKPacket this_ptr_conv;
77661         this_ptr_conv.inner = untag_ptr(this_ptr);
77662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77664         this_ptr_conv.is_owned = false;
77665         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
77666         return ret_conv;
77667 }
77668
77669 void  __attribute__((export_name("TS_Packet_set_version"))) TS_Packet_set_version(uint64_t this_ptr, int8_t val) {
77670         LDKPacket this_ptr_conv;
77671         this_ptr_conv.inner = untag_ptr(this_ptr);
77672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77674         this_ptr_conv.is_owned = false;
77675         Packet_set_version(&this_ptr_conv, val);
77676 }
77677
77678 int8_tArray  __attribute__((export_name("TS_Packet_get_public_key"))) TS_Packet_get_public_key(uint64_t this_ptr) {
77679         LDKPacket this_ptr_conv;
77680         this_ptr_conv.inner = untag_ptr(this_ptr);
77681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77683         this_ptr_conv.is_owned = false;
77684         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77685         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
77686         return ret_arr;
77687 }
77688
77689 void  __attribute__((export_name("TS_Packet_set_public_key"))) TS_Packet_set_public_key(uint64_t this_ptr, int8_tArray val) {
77690         LDKPacket this_ptr_conv;
77691         this_ptr_conv.inner = untag_ptr(this_ptr);
77692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77694         this_ptr_conv.is_owned = false;
77695         LDKPublicKey val_ref;
77696         CHECK(val->arr_len == 33);
77697         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
77698         Packet_set_public_key(&this_ptr_conv, val_ref);
77699 }
77700
77701 int8_tArray  __attribute__((export_name("TS_Packet_get_hop_data"))) TS_Packet_get_hop_data(uint64_t this_ptr) {
77702         LDKPacket this_ptr_conv;
77703         this_ptr_conv.inner = untag_ptr(this_ptr);
77704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77706         this_ptr_conv.is_owned = false;
77707         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
77708         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77709         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77710         CVec_u8Z_free(ret_var);
77711         return ret_arr;
77712 }
77713
77714 void  __attribute__((export_name("TS_Packet_set_hop_data"))) TS_Packet_set_hop_data(uint64_t this_ptr, int8_tArray val) {
77715         LDKPacket this_ptr_conv;
77716         this_ptr_conv.inner = untag_ptr(this_ptr);
77717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77719         this_ptr_conv.is_owned = false;
77720         LDKCVec_u8Z val_ref;
77721         val_ref.datalen = val->arr_len;
77722         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
77723         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
77724         Packet_set_hop_data(&this_ptr_conv, val_ref);
77725 }
77726
77727 int8_tArray  __attribute__((export_name("TS_Packet_get_hmac"))) TS_Packet_get_hmac(uint64_t this_ptr) {
77728         LDKPacket this_ptr_conv;
77729         this_ptr_conv.inner = untag_ptr(this_ptr);
77730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77732         this_ptr_conv.is_owned = false;
77733         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77734         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
77735         return ret_arr;
77736 }
77737
77738 void  __attribute__((export_name("TS_Packet_set_hmac"))) TS_Packet_set_hmac(uint64_t this_ptr, int8_tArray val) {
77739         LDKPacket this_ptr_conv;
77740         this_ptr_conv.inner = untag_ptr(this_ptr);
77741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77743         this_ptr_conv.is_owned = false;
77744         LDKThirtyTwoBytes val_ref;
77745         CHECK(val->arr_len == 32);
77746         memcpy(val_ref.data, val->elems, 32); FREE(val);
77747         Packet_set_hmac(&this_ptr_conv, val_ref);
77748 }
77749
77750 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) {
77751         LDKPublicKey public_key_arg_ref;
77752         CHECK(public_key_arg->arr_len == 33);
77753         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
77754         LDKCVec_u8Z hop_data_arg_ref;
77755         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
77756         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
77757         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
77758         LDKThirtyTwoBytes hmac_arg_ref;
77759         CHECK(hmac_arg->arr_len == 32);
77760         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
77761         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
77762         uint64_t ret_ref = 0;
77763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77765         return ret_ref;
77766 }
77767
77768 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
77769         LDKPacket ret_var = Packet_clone(arg);
77770         uint64_t ret_ref = 0;
77771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77773         return ret_ref;
77774 }
77775 int64_t  __attribute__((export_name("TS_Packet_clone_ptr"))) TS_Packet_clone_ptr(uint64_t arg) {
77776         LDKPacket arg_conv;
77777         arg_conv.inner = untag_ptr(arg);
77778         arg_conv.is_owned = ptr_is_owned(arg);
77779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77780         arg_conv.is_owned = false;
77781         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
77782         return ret_conv;
77783 }
77784
77785 uint64_t  __attribute__((export_name("TS_Packet_clone"))) TS_Packet_clone(uint64_t orig) {
77786         LDKPacket orig_conv;
77787         orig_conv.inner = untag_ptr(orig);
77788         orig_conv.is_owned = ptr_is_owned(orig);
77789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77790         orig_conv.is_owned = false;
77791         LDKPacket ret_var = Packet_clone(&orig_conv);
77792         uint64_t ret_ref = 0;
77793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77795         return ret_ref;
77796 }
77797
77798 int64_t  __attribute__((export_name("TS_Packet_hash"))) TS_Packet_hash(uint64_t o) {
77799         LDKPacket o_conv;
77800         o_conv.inner = untag_ptr(o);
77801         o_conv.is_owned = ptr_is_owned(o);
77802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77803         o_conv.is_owned = false;
77804         int64_t ret_conv = Packet_hash(&o_conv);
77805         return ret_conv;
77806 }
77807
77808 jboolean  __attribute__((export_name("TS_Packet_eq"))) TS_Packet_eq(uint64_t a, uint64_t b) {
77809         LDKPacket a_conv;
77810         a_conv.inner = untag_ptr(a);
77811         a_conv.is_owned = ptr_is_owned(a);
77812         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77813         a_conv.is_owned = false;
77814         LDKPacket b_conv;
77815         b_conv.inner = untag_ptr(b);
77816         b_conv.is_owned = ptr_is_owned(b);
77817         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77818         b_conv.is_owned = false;
77819         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
77820         return ret_conv;
77821 }
77822
77823 int8_tArray  __attribute__((export_name("TS_Packet_write"))) TS_Packet_write(uint64_t obj) {
77824         LDKPacket obj_conv;
77825         obj_conv.inner = untag_ptr(obj);
77826         obj_conv.is_owned = ptr_is_owned(obj);
77827         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77828         obj_conv.is_owned = false;
77829         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
77830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77832         CVec_u8Z_free(ret_var);
77833         return ret_arr;
77834 }
77835
77836 void  __attribute__((export_name("TS_ParsedOnionMessageContents_free"))) TS_ParsedOnionMessageContents_free(uint64_t this_ptr) {
77837         if (!ptr_is_owned(this_ptr)) return;
77838         void* this_ptr_ptr = untag_ptr(this_ptr);
77839         CHECK_ACCESS(this_ptr_ptr);
77840         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
77841         FREE(untag_ptr(this_ptr));
77842         ParsedOnionMessageContents_free(this_ptr_conv);
77843 }
77844
77845 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
77846         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
77847         *ret_copy = ParsedOnionMessageContents_clone(arg);
77848         uint64_t ret_ref = tag_ptr(ret_copy, true);
77849         return ret_ref;
77850 }
77851 int64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone_ptr"))) TS_ParsedOnionMessageContents_clone_ptr(uint64_t arg) {
77852         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
77853         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
77854         return ret_conv;
77855 }
77856
77857 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_clone"))) TS_ParsedOnionMessageContents_clone(uint64_t orig) {
77858         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
77859         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
77860         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
77861         uint64_t ret_ref = tag_ptr(ret_copy, true);
77862         return ret_ref;
77863 }
77864
77865 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_offers"))) TS_ParsedOnionMessageContents_offers(uint64_t a) {
77866         void* a_ptr = untag_ptr(a);
77867         CHECK_ACCESS(a_ptr);
77868         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
77869         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
77870         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
77871         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
77872         uint64_t ret_ref = tag_ptr(ret_copy, true);
77873         return ret_ref;
77874 }
77875
77876 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_custom"))) TS_ParsedOnionMessageContents_custom(uint64_t a) {
77877         void* a_ptr = untag_ptr(a);
77878         CHECK_ACCESS(a_ptr);
77879         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
77880         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
77881                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77882                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
77883         }
77884         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
77885         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
77886         uint64_t ret_ref = tag_ptr(ret_copy, true);
77887         return ret_ref;
77888 }
77889
77890 uint64_t  __attribute__((export_name("TS_ParsedOnionMessageContents_as_OnionMessageContents"))) TS_ParsedOnionMessageContents_as_OnionMessageContents(uint64_t this_arg) {
77891         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
77892         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
77893         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
77894         return tag_ptr(ret_ret, true);
77895 }
77896
77897 int8_tArray  __attribute__((export_name("TS_ParsedOnionMessageContents_write"))) TS_ParsedOnionMessageContents_write(uint64_t obj) {
77898         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
77899         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
77900         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77901         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77902         CVec_u8Z_free(ret_var);
77903         return ret_arr;
77904 }
77905
77906 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
77907         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
77908         *ret_ret = OnionMessageContents_clone(arg);
77909         return tag_ptr(ret_ret, true);
77910 }
77911 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
77912         void* arg_ptr = untag_ptr(arg);
77913         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
77914         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
77915         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
77916         return ret_conv;
77917 }
77918
77919 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
77920         void* orig_ptr = untag_ptr(orig);
77921         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
77922         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
77923         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
77924         *ret_ret = OnionMessageContents_clone(orig_conv);
77925         return tag_ptr(ret_ret, true);
77926 }
77927
77928 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
77929         if (!ptr_is_owned(this_ptr)) return;
77930         void* this_ptr_ptr = untag_ptr(this_ptr);
77931         CHECK_ACCESS(this_ptr_ptr);
77932         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
77933         FREE(untag_ptr(this_ptr));
77934         OnionMessageContents_free(this_ptr_conv);
77935 }
77936
77937 void  __attribute__((export_name("TS_NextMessageHop_free"))) TS_NextMessageHop_free(uint64_t this_ptr) {
77938         if (!ptr_is_owned(this_ptr)) return;
77939         void* this_ptr_ptr = untag_ptr(this_ptr);
77940         CHECK_ACCESS(this_ptr_ptr);
77941         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
77942         FREE(untag_ptr(this_ptr));
77943         NextMessageHop_free(this_ptr_conv);
77944 }
77945
77946 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
77947         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77948         *ret_copy = NextMessageHop_clone(arg);
77949         uint64_t ret_ref = tag_ptr(ret_copy, true);
77950         return ret_ref;
77951 }
77952 int64_t  __attribute__((export_name("TS_NextMessageHop_clone_ptr"))) TS_NextMessageHop_clone_ptr(uint64_t arg) {
77953         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
77954         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
77955         return ret_conv;
77956 }
77957
77958 uint64_t  __attribute__((export_name("TS_NextMessageHop_clone"))) TS_NextMessageHop_clone(uint64_t orig) {
77959         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
77960         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77961         *ret_copy = NextMessageHop_clone(orig_conv);
77962         uint64_t ret_ref = tag_ptr(ret_copy, true);
77963         return ret_ref;
77964 }
77965
77966 uint64_t  __attribute__((export_name("TS_NextMessageHop_node_id"))) TS_NextMessageHop_node_id(int8_tArray a) {
77967         LDKPublicKey a_ref;
77968         CHECK(a->arr_len == 33);
77969         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77970         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77971         *ret_copy = NextMessageHop_node_id(a_ref);
77972         uint64_t ret_ref = tag_ptr(ret_copy, true);
77973         return ret_ref;
77974 }
77975
77976 uint64_t  __attribute__((export_name("TS_NextMessageHop_short_channel_id"))) TS_NextMessageHop_short_channel_id(int64_t a) {
77977         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77978         *ret_copy = NextMessageHop_short_channel_id(a);
77979         uint64_t ret_ref = tag_ptr(ret_copy, true);
77980         return ret_ref;
77981 }
77982
77983 int64_t  __attribute__((export_name("TS_NextMessageHop_hash"))) TS_NextMessageHop_hash(uint64_t o) {
77984         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
77985         int64_t ret_conv = NextMessageHop_hash(o_conv);
77986         return ret_conv;
77987 }
77988
77989 jboolean  __attribute__((export_name("TS_NextMessageHop_eq"))) TS_NextMessageHop_eq(uint64_t a, uint64_t b) {
77990         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
77991         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
77992         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
77993         return ret_conv;
77994 }
77995
77996 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
77997         LDKBlindedPath this_obj_conv;
77998         this_obj_conv.inner = untag_ptr(this_obj);
77999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78001         BlindedPath_free(this_obj_conv);
78002 }
78003
78004 uint64_t  __attribute__((export_name("TS_BlindedPath_get_introduction_node"))) TS_BlindedPath_get_introduction_node(uint64_t this_ptr) {
78005         LDKBlindedPath this_ptr_conv;
78006         this_ptr_conv.inner = untag_ptr(this_ptr);
78007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78009         this_ptr_conv.is_owned = false;
78010         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78011         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
78012         uint64_t ret_ref = tag_ptr(ret_copy, true);
78013         return ret_ref;
78014 }
78015
78016 void  __attribute__((export_name("TS_BlindedPath_set_introduction_node"))) TS_BlindedPath_set_introduction_node(uint64_t this_ptr, uint64_t val) {
78017         LDKBlindedPath this_ptr_conv;
78018         this_ptr_conv.inner = untag_ptr(this_ptr);
78019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78021         this_ptr_conv.is_owned = false;
78022         void* val_ptr = untag_ptr(val);
78023         CHECK_ACCESS(val_ptr);
78024         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
78025         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
78026         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
78027 }
78028
78029 int8_tArray  __attribute__((export_name("TS_BlindedPath_get_blinding_point"))) TS_BlindedPath_get_blinding_point(uint64_t this_ptr) {
78030         LDKBlindedPath this_ptr_conv;
78031         this_ptr_conv.inner = untag_ptr(this_ptr);
78032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78034         this_ptr_conv.is_owned = false;
78035         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
78036         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
78037         return ret_arr;
78038 }
78039
78040 void  __attribute__((export_name("TS_BlindedPath_set_blinding_point"))) TS_BlindedPath_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
78041         LDKBlindedPath this_ptr_conv;
78042         this_ptr_conv.inner = untag_ptr(this_ptr);
78043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78045         this_ptr_conv.is_owned = false;
78046         LDKPublicKey val_ref;
78047         CHECK(val->arr_len == 33);
78048         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
78049         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
78050 }
78051
78052 uint64_tArray  __attribute__((export_name("TS_BlindedPath_get_blinded_hops"))) TS_BlindedPath_get_blinded_hops(uint64_t this_ptr) {
78053         LDKBlindedPath this_ptr_conv;
78054         this_ptr_conv.inner = untag_ptr(this_ptr);
78055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78057         this_ptr_conv.is_owned = false;
78058         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
78059         uint64_tArray ret_arr = NULL;
78060         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
78061         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
78062         for (size_t m = 0; m < ret_var.datalen; m++) {
78063                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
78064                 uint64_t ret_conv_12_ref = 0;
78065                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
78066                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
78067                 ret_arr_ptr[m] = ret_conv_12_ref;
78068         }
78069         
78070         FREE(ret_var.data);
78071         return ret_arr;
78072 }
78073
78074 void  __attribute__((export_name("TS_BlindedPath_set_blinded_hops"))) TS_BlindedPath_set_blinded_hops(uint64_t this_ptr, uint64_tArray val) {
78075         LDKBlindedPath this_ptr_conv;
78076         this_ptr_conv.inner = untag_ptr(this_ptr);
78077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78079         this_ptr_conv.is_owned = false;
78080         LDKCVec_BlindedHopZ val_constr;
78081         val_constr.datalen = val->arr_len;
78082         if (val_constr.datalen > 0)
78083                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
78084         else
78085                 val_constr.data = NULL;
78086         uint64_t* val_vals = val->elems;
78087         for (size_t m = 0; m < val_constr.datalen; m++) {
78088                 uint64_t val_conv_12 = val_vals[m];
78089                 LDKBlindedHop val_conv_12_conv;
78090                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
78091                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
78092                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
78093                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
78094                 val_constr.data[m] = val_conv_12_conv;
78095         }
78096         FREE(val);
78097         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
78098 }
78099
78100 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(uint64_t introduction_node_arg, int8_tArray blinding_point_arg, uint64_tArray blinded_hops_arg) {
78101         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
78102         CHECK_ACCESS(introduction_node_arg_ptr);
78103         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
78104         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
78105         LDKPublicKey blinding_point_arg_ref;
78106         CHECK(blinding_point_arg->arr_len == 33);
78107         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
78108         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
78109         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
78110         if (blinded_hops_arg_constr.datalen > 0)
78111                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
78112         else
78113                 blinded_hops_arg_constr.data = NULL;
78114         uint64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
78115         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
78116                 uint64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
78117                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
78118                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
78119                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
78120                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
78121                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
78122                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
78123         }
78124         FREE(blinded_hops_arg);
78125         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
78126         uint64_t ret_ref = 0;
78127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78129         return ret_ref;
78130 }
78131
78132 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
78133         LDKBlindedPath ret_var = BlindedPath_clone(arg);
78134         uint64_t ret_ref = 0;
78135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78137         return ret_ref;
78138 }
78139 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
78140         LDKBlindedPath arg_conv;
78141         arg_conv.inner = untag_ptr(arg);
78142         arg_conv.is_owned = ptr_is_owned(arg);
78143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78144         arg_conv.is_owned = false;
78145         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
78146         return ret_conv;
78147 }
78148
78149 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
78150         LDKBlindedPath orig_conv;
78151         orig_conv.inner = untag_ptr(orig);
78152         orig_conv.is_owned = ptr_is_owned(orig);
78153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78154         orig_conv.is_owned = false;
78155         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
78156         uint64_t ret_ref = 0;
78157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78159         return ret_ref;
78160 }
78161
78162 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
78163         LDKBlindedPath o_conv;
78164         o_conv.inner = untag_ptr(o);
78165         o_conv.is_owned = ptr_is_owned(o);
78166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78167         o_conv.is_owned = false;
78168         int64_t ret_conv = BlindedPath_hash(&o_conv);
78169         return ret_conv;
78170 }
78171
78172 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
78173         LDKBlindedPath a_conv;
78174         a_conv.inner = untag_ptr(a);
78175         a_conv.is_owned = ptr_is_owned(a);
78176         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78177         a_conv.is_owned = false;
78178         LDKBlindedPath b_conv;
78179         b_conv.inner = untag_ptr(b);
78180         b_conv.is_owned = ptr_is_owned(b);
78181         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78182         b_conv.is_owned = false;
78183         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
78184         return ret_conv;
78185 }
78186
78187 void  __attribute__((export_name("TS_IntroductionNode_free"))) TS_IntroductionNode_free(uint64_t this_ptr) {
78188         if (!ptr_is_owned(this_ptr)) return;
78189         void* this_ptr_ptr = untag_ptr(this_ptr);
78190         CHECK_ACCESS(this_ptr_ptr);
78191         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
78192         FREE(untag_ptr(this_ptr));
78193         IntroductionNode_free(this_ptr_conv);
78194 }
78195
78196 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
78197         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78198         *ret_copy = IntroductionNode_clone(arg);
78199         uint64_t ret_ref = tag_ptr(ret_copy, true);
78200         return ret_ref;
78201 }
78202 int64_t  __attribute__((export_name("TS_IntroductionNode_clone_ptr"))) TS_IntroductionNode_clone_ptr(uint64_t arg) {
78203         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
78204         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
78205         return ret_conv;
78206 }
78207
78208 uint64_t  __attribute__((export_name("TS_IntroductionNode_clone"))) TS_IntroductionNode_clone(uint64_t orig) {
78209         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
78210         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78211         *ret_copy = IntroductionNode_clone(orig_conv);
78212         uint64_t ret_ref = tag_ptr(ret_copy, true);
78213         return ret_ref;
78214 }
78215
78216 uint64_t  __attribute__((export_name("TS_IntroductionNode_node_id"))) TS_IntroductionNode_node_id(int8_tArray a) {
78217         LDKPublicKey a_ref;
78218         CHECK(a->arr_len == 33);
78219         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
78220         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78221         *ret_copy = IntroductionNode_node_id(a_ref);
78222         uint64_t ret_ref = tag_ptr(ret_copy, true);
78223         return ret_ref;
78224 }
78225
78226 uint64_t  __attribute__((export_name("TS_IntroductionNode_directed_short_channel_id"))) TS_IntroductionNode_directed_short_channel_id(uint32_t a, int64_t b) {
78227         LDKDirection a_conv = LDKDirection_from_js(a);
78228         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78229         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
78230         uint64_t ret_ref = tag_ptr(ret_copy, true);
78231         return ret_ref;
78232 }
78233
78234 int64_t  __attribute__((export_name("TS_IntroductionNode_hash"))) TS_IntroductionNode_hash(uint64_t o) {
78235         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
78236         int64_t ret_conv = IntroductionNode_hash(o_conv);
78237         return ret_conv;
78238 }
78239
78240 jboolean  __attribute__((export_name("TS_IntroductionNode_eq"))) TS_IntroductionNode_eq(uint64_t a, uint64_t b) {
78241         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
78242         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
78243         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
78244         return ret_conv;
78245 }
78246
78247 uint32_t  __attribute__((export_name("TS_Direction_clone"))) TS_Direction_clone(uint64_t orig) {
78248         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
78249         uint32_t ret_conv = LDKDirection_to_js(Direction_clone(orig_conv));
78250         return ret_conv;
78251 }
78252
78253 uint32_t  __attribute__((export_name("TS_Direction_node_one"))) TS_Direction_node_one() {
78254         uint32_t ret_conv = LDKDirection_to_js(Direction_node_one());
78255         return ret_conv;
78256 }
78257
78258 uint32_t  __attribute__((export_name("TS_Direction_node_two"))) TS_Direction_node_two() {
78259         uint32_t ret_conv = LDKDirection_to_js(Direction_node_two());
78260         return ret_conv;
78261 }
78262
78263 int64_t  __attribute__((export_name("TS_Direction_hash"))) TS_Direction_hash(uint64_t o) {
78264         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
78265         int64_t ret_conv = Direction_hash(o_conv);
78266         return ret_conv;
78267 }
78268
78269 jboolean  __attribute__((export_name("TS_Direction_eq"))) TS_Direction_eq(uint64_t a, uint64_t b) {
78270         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
78271         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
78272         jboolean ret_conv = Direction_eq(a_conv, b_conv);
78273         return ret_conv;
78274 }
78275
78276 void  __attribute__((export_name("TS_NodeIdLookUp_free"))) TS_NodeIdLookUp_free(uint64_t this_ptr) {
78277         if (!ptr_is_owned(this_ptr)) return;
78278         void* this_ptr_ptr = untag_ptr(this_ptr);
78279         CHECK_ACCESS(this_ptr_ptr);
78280         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
78281         FREE(untag_ptr(this_ptr));
78282         NodeIdLookUp_free(this_ptr_conv);
78283 }
78284
78285 void  __attribute__((export_name("TS_EmptyNodeIdLookUp_free"))) TS_EmptyNodeIdLookUp_free(uint64_t this_obj) {
78286         LDKEmptyNodeIdLookUp this_obj_conv;
78287         this_obj_conv.inner = untag_ptr(this_obj);
78288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78290         EmptyNodeIdLookUp_free(this_obj_conv);
78291 }
78292
78293 uint64_t  __attribute__((export_name("TS_EmptyNodeIdLookUp_new"))) TS_EmptyNodeIdLookUp_new() {
78294         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
78295         uint64_t ret_ref = 0;
78296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78298         return ret_ref;
78299 }
78300
78301 uint64_t  __attribute__((export_name("TS_EmptyNodeIdLookUp_as_NodeIdLookUp"))) TS_EmptyNodeIdLookUp_as_NodeIdLookUp(uint64_t this_arg) {
78302         LDKEmptyNodeIdLookUp this_arg_conv;
78303         this_arg_conv.inner = untag_ptr(this_arg);
78304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78306         this_arg_conv.is_owned = false;
78307         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
78308         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
78309         return tag_ptr(ret_ret, true);
78310 }
78311
78312 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
78313         LDKBlindedHop this_obj_conv;
78314         this_obj_conv.inner = untag_ptr(this_obj);
78315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78317         BlindedHop_free(this_obj_conv);
78318 }
78319
78320 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_blinded_node_id"))) TS_BlindedHop_get_blinded_node_id(uint64_t this_ptr) {
78321         LDKBlindedHop this_ptr_conv;
78322         this_ptr_conv.inner = untag_ptr(this_ptr);
78323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78325         this_ptr_conv.is_owned = false;
78326         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
78327         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
78328         return ret_arr;
78329 }
78330
78331 void  __attribute__((export_name("TS_BlindedHop_set_blinded_node_id"))) TS_BlindedHop_set_blinded_node_id(uint64_t this_ptr, int8_tArray val) {
78332         LDKBlindedHop this_ptr_conv;
78333         this_ptr_conv.inner = untag_ptr(this_ptr);
78334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78336         this_ptr_conv.is_owned = false;
78337         LDKPublicKey val_ref;
78338         CHECK(val->arr_len == 33);
78339         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
78340         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
78341 }
78342
78343 int8_tArray  __attribute__((export_name("TS_BlindedHop_get_encrypted_payload"))) TS_BlindedHop_get_encrypted_payload(uint64_t this_ptr) {
78344         LDKBlindedHop this_ptr_conv;
78345         this_ptr_conv.inner = untag_ptr(this_ptr);
78346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78348         this_ptr_conv.is_owned = false;
78349         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
78350         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78351         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78352         CVec_u8Z_free(ret_var);
78353         return ret_arr;
78354 }
78355
78356 void  __attribute__((export_name("TS_BlindedHop_set_encrypted_payload"))) TS_BlindedHop_set_encrypted_payload(uint64_t this_ptr, int8_tArray val) {
78357         LDKBlindedHop this_ptr_conv;
78358         this_ptr_conv.inner = untag_ptr(this_ptr);
78359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78361         this_ptr_conv.is_owned = false;
78362         LDKCVec_u8Z val_ref;
78363         val_ref.datalen = val->arr_len;
78364         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
78365         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
78366         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
78367 }
78368
78369 uint64_t  __attribute__((export_name("TS_BlindedHop_new"))) TS_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
78370         LDKPublicKey blinded_node_id_arg_ref;
78371         CHECK(blinded_node_id_arg->arr_len == 33);
78372         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
78373         LDKCVec_u8Z encrypted_payload_arg_ref;
78374         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
78375         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
78376         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
78377         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
78378         uint64_t ret_ref = 0;
78379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78381         return ret_ref;
78382 }
78383
78384 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
78385         LDKBlindedHop ret_var = BlindedHop_clone(arg);
78386         uint64_t ret_ref = 0;
78387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78389         return ret_ref;
78390 }
78391 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
78392         LDKBlindedHop arg_conv;
78393         arg_conv.inner = untag_ptr(arg);
78394         arg_conv.is_owned = ptr_is_owned(arg);
78395         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78396         arg_conv.is_owned = false;
78397         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
78398         return ret_conv;
78399 }
78400
78401 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
78402         LDKBlindedHop orig_conv;
78403         orig_conv.inner = untag_ptr(orig);
78404         orig_conv.is_owned = ptr_is_owned(orig);
78405         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78406         orig_conv.is_owned = false;
78407         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
78408         uint64_t ret_ref = 0;
78409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78411         return ret_ref;
78412 }
78413
78414 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
78415         LDKBlindedHop o_conv;
78416         o_conv.inner = untag_ptr(o);
78417         o_conv.is_owned = ptr_is_owned(o);
78418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78419         o_conv.is_owned = false;
78420         int64_t ret_conv = BlindedHop_hash(&o_conv);
78421         return ret_conv;
78422 }
78423
78424 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
78425         LDKBlindedHop a_conv;
78426         a_conv.inner = untag_ptr(a);
78427         a_conv.is_owned = ptr_is_owned(a);
78428         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78429         a_conv.is_owned = false;
78430         LDKBlindedHop b_conv;
78431         b_conv.inner = untag_ptr(b);
78432         b_conv.is_owned = ptr_is_owned(b);
78433         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78434         b_conv.is_owned = false;
78435         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
78436         return ret_conv;
78437 }
78438
78439 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) {
78440         LDKPublicKey recipient_node_id_ref;
78441         CHECK(recipient_node_id->arr_len == 33);
78442         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
78443         void* entropy_source_ptr = untag_ptr(entropy_source);
78444         CHECK_ACCESS(entropy_source_ptr);
78445         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
78446         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
78447                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78448                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
78449         }
78450         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
78451         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
78452         return tag_ptr(ret_conv, true);
78453 }
78454
78455 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
78456         LDKCVec_PublicKeyZ node_pks_constr;
78457         node_pks_constr.datalen = node_pks->arr_len;
78458         if (node_pks_constr.datalen > 0)
78459                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
78460         else
78461                 node_pks_constr.data = NULL;
78462         int8_tArray* node_pks_vals = (void*) node_pks->elems;
78463         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
78464                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
78465                 LDKPublicKey node_pks_conv_12_ref;
78466                 CHECK(node_pks_conv_12->arr_len == 33);
78467                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
78468                 node_pks_constr.data[m] = node_pks_conv_12_ref;
78469         }
78470         FREE(node_pks);
78471         void* entropy_source_ptr = untag_ptr(entropy_source);
78472         CHECK_ACCESS(entropy_source_ptr);
78473         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
78474         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
78475                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78476                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
78477         }
78478         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
78479         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
78480         return tag_ptr(ret_conv, true);
78481 }
78482
78483 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, int16_t min_final_cltv_expiry_delta, uint64_t entropy_source) {
78484         LDKPublicKey payee_node_id_ref;
78485         CHECK(payee_node_id->arr_len == 33);
78486         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
78487         LDKReceiveTlvs payee_tlvs_conv;
78488         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
78489         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
78490         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
78491         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
78492         void* entropy_source_ptr = untag_ptr(entropy_source);
78493         CHECK_ACCESS(entropy_source_ptr);
78494         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
78495         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
78496                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78497                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
78498         }
78499         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
78500         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
78501         return tag_ptr(ret_conv, true);
78502 }
78503
78504 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, int16_t min_final_cltv_expiry_delta, uint64_t entropy_source) {
78505         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
78506         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
78507         if (intermediate_nodes_constr.datalen > 0)
78508                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
78509         else
78510                 intermediate_nodes_constr.data = NULL;
78511         uint64_t* intermediate_nodes_vals = intermediate_nodes->elems;
78512         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
78513                 uint64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
78514                 LDKForwardNode intermediate_nodes_conv_13_conv;
78515                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
78516                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
78517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
78518                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
78519                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
78520         }
78521         FREE(intermediate_nodes);
78522         LDKPublicKey payee_node_id_ref;
78523         CHECK(payee_node_id->arr_len == 33);
78524         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
78525         LDKReceiveTlvs payee_tlvs_conv;
78526         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
78527         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
78528         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
78529         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
78530         void* entropy_source_ptr = untag_ptr(entropy_source);
78531         CHECK_ACCESS(entropy_source_ptr);
78532         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
78533         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
78534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78535                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
78536         }
78537         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
78538         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, min_final_cltv_expiry_delta, entropy_source_conv);
78539         return tag_ptr(ret_conv, true);
78540 }
78541
78542 uint64_t  __attribute__((export_name("TS_BlindedPath_public_introduction_node_id"))) TS_BlindedPath_public_introduction_node_id(uint64_t this_arg, uint64_t network_graph) {
78543         LDKBlindedPath this_arg_conv;
78544         this_arg_conv.inner = untag_ptr(this_arg);
78545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78547         this_arg_conv.is_owned = false;
78548         LDKReadOnlyNetworkGraph network_graph_conv;
78549         network_graph_conv.inner = untag_ptr(network_graph);
78550         network_graph_conv.is_owned = ptr_is_owned(network_graph);
78551         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
78552         network_graph_conv.is_owned = false;
78553         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
78554         uint64_t ret_ref = 0;
78555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78557         return ret_ref;
78558 }
78559
78560 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
78561         LDKBlindedPath obj_conv;
78562         obj_conv.inner = untag_ptr(obj);
78563         obj_conv.is_owned = ptr_is_owned(obj);
78564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78565         obj_conv.is_owned = false;
78566         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
78567         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78568         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78569         CVec_u8Z_free(ret_var);
78570         return ret_arr;
78571 }
78572
78573 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
78574         LDKu8slice ser_ref;
78575         ser_ref.datalen = ser->arr_len;
78576         ser_ref.data = ser->elems;
78577         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
78578         *ret_conv = BlindedPath_read(ser_ref);
78579         FREE(ser);
78580         return tag_ptr(ret_conv, true);
78581 }
78582
78583 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
78584         LDKBlindedHop obj_conv;
78585         obj_conv.inner = untag_ptr(obj);
78586         obj_conv.is_owned = ptr_is_owned(obj);
78587         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78588         obj_conv.is_owned = false;
78589         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
78590         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78591         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78592         CVec_u8Z_free(ret_var);
78593         return ret_arr;
78594 }
78595
78596 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
78597         LDKu8slice ser_ref;
78598         ser_ref.datalen = ser->arr_len;
78599         ser_ref.data = ser->elems;
78600         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
78601         *ret_conv = BlindedHop_read(ser_ref);
78602         FREE(ser);
78603         return tag_ptr(ret_conv, true);
78604 }
78605
78606 void  __attribute__((export_name("TS_ForwardNode_free"))) TS_ForwardNode_free(uint64_t this_obj) {
78607         LDKForwardNode this_obj_conv;
78608         this_obj_conv.inner = untag_ptr(this_obj);
78609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78611         ForwardNode_free(this_obj_conv);
78612 }
78613
78614 uint64_t  __attribute__((export_name("TS_ForwardNode_get_tlvs"))) TS_ForwardNode_get_tlvs(uint64_t this_ptr) {
78615         LDKForwardNode this_ptr_conv;
78616         this_ptr_conv.inner = untag_ptr(this_ptr);
78617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78619         this_ptr_conv.is_owned = false;
78620         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
78621         uint64_t ret_ref = 0;
78622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78624         return ret_ref;
78625 }
78626
78627 void  __attribute__((export_name("TS_ForwardNode_set_tlvs"))) TS_ForwardNode_set_tlvs(uint64_t this_ptr, uint64_t val) {
78628         LDKForwardNode this_ptr_conv;
78629         this_ptr_conv.inner = untag_ptr(this_ptr);
78630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78632         this_ptr_conv.is_owned = false;
78633         LDKForwardTlvs val_conv;
78634         val_conv.inner = untag_ptr(val);
78635         val_conv.is_owned = ptr_is_owned(val);
78636         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78637         val_conv = ForwardTlvs_clone(&val_conv);
78638         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
78639 }
78640
78641 int8_tArray  __attribute__((export_name("TS_ForwardNode_get_node_id"))) TS_ForwardNode_get_node_id(uint64_t this_ptr) {
78642         LDKForwardNode this_ptr_conv;
78643         this_ptr_conv.inner = untag_ptr(this_ptr);
78644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78646         this_ptr_conv.is_owned = false;
78647         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
78648         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
78649         return ret_arr;
78650 }
78651
78652 void  __attribute__((export_name("TS_ForwardNode_set_node_id"))) TS_ForwardNode_set_node_id(uint64_t this_ptr, int8_tArray val) {
78653         LDKForwardNode this_ptr_conv;
78654         this_ptr_conv.inner = untag_ptr(this_ptr);
78655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78657         this_ptr_conv.is_owned = false;
78658         LDKPublicKey val_ref;
78659         CHECK(val->arr_len == 33);
78660         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
78661         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
78662 }
78663
78664 int64_t  __attribute__((export_name("TS_ForwardNode_get_htlc_maximum_msat"))) TS_ForwardNode_get_htlc_maximum_msat(uint64_t this_ptr) {
78665         LDKForwardNode this_ptr_conv;
78666         this_ptr_conv.inner = untag_ptr(this_ptr);
78667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78669         this_ptr_conv.is_owned = false;
78670         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
78671         return ret_conv;
78672 }
78673
78674 void  __attribute__((export_name("TS_ForwardNode_set_htlc_maximum_msat"))) TS_ForwardNode_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
78675         LDKForwardNode this_ptr_conv;
78676         this_ptr_conv.inner = untag_ptr(this_ptr);
78677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78679         this_ptr_conv.is_owned = false;
78680         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
78681 }
78682
78683 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) {
78684         LDKForwardTlvs tlvs_arg_conv;
78685         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
78686         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
78687         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
78688         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
78689         LDKPublicKey node_id_arg_ref;
78690         CHECK(node_id_arg->arr_len == 33);
78691         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
78692         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
78693         uint64_t ret_ref = 0;
78694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78696         return ret_ref;
78697 }
78698
78699 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
78700         LDKForwardNode ret_var = ForwardNode_clone(arg);
78701         uint64_t ret_ref = 0;
78702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78704         return ret_ref;
78705 }
78706 int64_t  __attribute__((export_name("TS_ForwardNode_clone_ptr"))) TS_ForwardNode_clone_ptr(uint64_t arg) {
78707         LDKForwardNode arg_conv;
78708         arg_conv.inner = untag_ptr(arg);
78709         arg_conv.is_owned = ptr_is_owned(arg);
78710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78711         arg_conv.is_owned = false;
78712         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
78713         return ret_conv;
78714 }
78715
78716 uint64_t  __attribute__((export_name("TS_ForwardNode_clone"))) TS_ForwardNode_clone(uint64_t orig) {
78717         LDKForwardNode orig_conv;
78718         orig_conv.inner = untag_ptr(orig);
78719         orig_conv.is_owned = ptr_is_owned(orig);
78720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78721         orig_conv.is_owned = false;
78722         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
78723         uint64_t ret_ref = 0;
78724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78726         return ret_ref;
78727 }
78728
78729 void  __attribute__((export_name("TS_ForwardTlvs_free"))) TS_ForwardTlvs_free(uint64_t this_obj) {
78730         LDKForwardTlvs this_obj_conv;
78731         this_obj_conv.inner = untag_ptr(this_obj);
78732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78734         ForwardTlvs_free(this_obj_conv);
78735 }
78736
78737 int64_t  __attribute__((export_name("TS_ForwardTlvs_get_short_channel_id"))) TS_ForwardTlvs_get_short_channel_id(uint64_t this_ptr) {
78738         LDKForwardTlvs this_ptr_conv;
78739         this_ptr_conv.inner = untag_ptr(this_ptr);
78740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78742         this_ptr_conv.is_owned = false;
78743         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
78744         return ret_conv;
78745 }
78746
78747 void  __attribute__((export_name("TS_ForwardTlvs_set_short_channel_id"))) TS_ForwardTlvs_set_short_channel_id(uint64_t this_ptr, int64_t val) {
78748         LDKForwardTlvs this_ptr_conv;
78749         this_ptr_conv.inner = untag_ptr(this_ptr);
78750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78752         this_ptr_conv.is_owned = false;
78753         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
78754 }
78755
78756 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_relay"))) TS_ForwardTlvs_get_payment_relay(uint64_t this_ptr) {
78757         LDKForwardTlvs this_ptr_conv;
78758         this_ptr_conv.inner = untag_ptr(this_ptr);
78759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78761         this_ptr_conv.is_owned = false;
78762         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
78763         uint64_t ret_ref = 0;
78764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78766         return ret_ref;
78767 }
78768
78769 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_relay"))) TS_ForwardTlvs_set_payment_relay(uint64_t this_ptr, uint64_t val) {
78770         LDKForwardTlvs this_ptr_conv;
78771         this_ptr_conv.inner = untag_ptr(this_ptr);
78772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78774         this_ptr_conv.is_owned = false;
78775         LDKPaymentRelay val_conv;
78776         val_conv.inner = untag_ptr(val);
78777         val_conv.is_owned = ptr_is_owned(val);
78778         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78779         val_conv = PaymentRelay_clone(&val_conv);
78780         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
78781 }
78782
78783 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_payment_constraints"))) TS_ForwardTlvs_get_payment_constraints(uint64_t this_ptr) {
78784         LDKForwardTlvs this_ptr_conv;
78785         this_ptr_conv.inner = untag_ptr(this_ptr);
78786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78788         this_ptr_conv.is_owned = false;
78789         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
78790         uint64_t ret_ref = 0;
78791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78793         return ret_ref;
78794 }
78795
78796 void  __attribute__((export_name("TS_ForwardTlvs_set_payment_constraints"))) TS_ForwardTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
78797         LDKForwardTlvs this_ptr_conv;
78798         this_ptr_conv.inner = untag_ptr(this_ptr);
78799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78801         this_ptr_conv.is_owned = false;
78802         LDKPaymentConstraints val_conv;
78803         val_conv.inner = untag_ptr(val);
78804         val_conv.is_owned = ptr_is_owned(val);
78805         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78806         val_conv = PaymentConstraints_clone(&val_conv);
78807         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
78808 }
78809
78810 uint64_t  __attribute__((export_name("TS_ForwardTlvs_get_features"))) TS_ForwardTlvs_get_features(uint64_t this_ptr) {
78811         LDKForwardTlvs this_ptr_conv;
78812         this_ptr_conv.inner = untag_ptr(this_ptr);
78813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78815         this_ptr_conv.is_owned = false;
78816         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
78817         uint64_t ret_ref = 0;
78818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78820         return ret_ref;
78821 }
78822
78823 void  __attribute__((export_name("TS_ForwardTlvs_set_features"))) TS_ForwardTlvs_set_features(uint64_t this_ptr, uint64_t val) {
78824         LDKForwardTlvs this_ptr_conv;
78825         this_ptr_conv.inner = untag_ptr(this_ptr);
78826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78828         this_ptr_conv.is_owned = false;
78829         LDKBlindedHopFeatures val_conv;
78830         val_conv.inner = untag_ptr(val);
78831         val_conv.is_owned = ptr_is_owned(val);
78832         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78833         val_conv = BlindedHopFeatures_clone(&val_conv);
78834         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
78835 }
78836
78837 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) {
78838         LDKPaymentRelay payment_relay_arg_conv;
78839         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
78840         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
78841         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
78842         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
78843         LDKPaymentConstraints payment_constraints_arg_conv;
78844         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
78845         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
78846         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
78847         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
78848         LDKBlindedHopFeatures features_arg_conv;
78849         features_arg_conv.inner = untag_ptr(features_arg);
78850         features_arg_conv.is_owned = ptr_is_owned(features_arg);
78851         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
78852         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
78853         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
78854         uint64_t ret_ref = 0;
78855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78857         return ret_ref;
78858 }
78859
78860 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
78861         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
78862         uint64_t ret_ref = 0;
78863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78865         return ret_ref;
78866 }
78867 int64_t  __attribute__((export_name("TS_ForwardTlvs_clone_ptr"))) TS_ForwardTlvs_clone_ptr(uint64_t arg) {
78868         LDKForwardTlvs arg_conv;
78869         arg_conv.inner = untag_ptr(arg);
78870         arg_conv.is_owned = ptr_is_owned(arg);
78871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78872         arg_conv.is_owned = false;
78873         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
78874         return ret_conv;
78875 }
78876
78877 uint64_t  __attribute__((export_name("TS_ForwardTlvs_clone"))) TS_ForwardTlvs_clone(uint64_t orig) {
78878         LDKForwardTlvs orig_conv;
78879         orig_conv.inner = untag_ptr(orig);
78880         orig_conv.is_owned = ptr_is_owned(orig);
78881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78882         orig_conv.is_owned = false;
78883         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
78884         uint64_t ret_ref = 0;
78885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78887         return ret_ref;
78888 }
78889
78890 void  __attribute__((export_name("TS_ReceiveTlvs_free"))) TS_ReceiveTlvs_free(uint64_t this_obj) {
78891         LDKReceiveTlvs this_obj_conv;
78892         this_obj_conv.inner = untag_ptr(this_obj);
78893         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78895         ReceiveTlvs_free(this_obj_conv);
78896 }
78897
78898 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_get_payment_secret"))) TS_ReceiveTlvs_get_payment_secret(uint64_t this_ptr) {
78899         LDKReceiveTlvs this_ptr_conv;
78900         this_ptr_conv.inner = untag_ptr(this_ptr);
78901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78903         this_ptr_conv.is_owned = false;
78904         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
78905         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
78906         return ret_arr;
78907 }
78908
78909 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_secret"))) TS_ReceiveTlvs_set_payment_secret(uint64_t this_ptr, int8_tArray val) {
78910         LDKReceiveTlvs this_ptr_conv;
78911         this_ptr_conv.inner = untag_ptr(this_ptr);
78912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78914         this_ptr_conv.is_owned = false;
78915         LDKThirtyTwoBytes val_ref;
78916         CHECK(val->arr_len == 32);
78917         memcpy(val_ref.data, val->elems, 32); FREE(val);
78918         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
78919 }
78920
78921 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_constraints"))) TS_ReceiveTlvs_get_payment_constraints(uint64_t this_ptr) {
78922         LDKReceiveTlvs this_ptr_conv;
78923         this_ptr_conv.inner = untag_ptr(this_ptr);
78924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78926         this_ptr_conv.is_owned = false;
78927         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
78928         uint64_t ret_ref = 0;
78929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78931         return ret_ref;
78932 }
78933
78934 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_constraints"))) TS_ReceiveTlvs_set_payment_constraints(uint64_t this_ptr, uint64_t val) {
78935         LDKReceiveTlvs this_ptr_conv;
78936         this_ptr_conv.inner = untag_ptr(this_ptr);
78937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78939         this_ptr_conv.is_owned = false;
78940         LDKPaymentConstraints val_conv;
78941         val_conv.inner = untag_ptr(val);
78942         val_conv.is_owned = ptr_is_owned(val);
78943         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78944         val_conv = PaymentConstraints_clone(&val_conv);
78945         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
78946 }
78947
78948 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_get_payment_context"))) TS_ReceiveTlvs_get_payment_context(uint64_t this_ptr) {
78949         LDKReceiveTlvs this_ptr_conv;
78950         this_ptr_conv.inner = untag_ptr(this_ptr);
78951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78953         this_ptr_conv.is_owned = false;
78954         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78955         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
78956         uint64_t ret_ref = tag_ptr(ret_copy, true);
78957         return ret_ref;
78958 }
78959
78960 void  __attribute__((export_name("TS_ReceiveTlvs_set_payment_context"))) TS_ReceiveTlvs_set_payment_context(uint64_t this_ptr, uint64_t val) {
78961         LDKReceiveTlvs this_ptr_conv;
78962         this_ptr_conv.inner = untag_ptr(this_ptr);
78963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78965         this_ptr_conv.is_owned = false;
78966         void* val_ptr = untag_ptr(val);
78967         CHECK_ACCESS(val_ptr);
78968         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
78969         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
78970         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
78971 }
78972
78973 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_new"))) TS_ReceiveTlvs_new(int8_tArray payment_secret_arg, uint64_t payment_constraints_arg, uint64_t payment_context_arg) {
78974         LDKThirtyTwoBytes payment_secret_arg_ref;
78975         CHECK(payment_secret_arg->arr_len == 32);
78976         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
78977         LDKPaymentConstraints payment_constraints_arg_conv;
78978         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
78979         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
78980         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
78981         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
78982         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
78983         CHECK_ACCESS(payment_context_arg_ptr);
78984         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
78985         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
78986         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
78987         uint64_t ret_ref = 0;
78988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78990         return ret_ref;
78991 }
78992
78993 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
78994         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
78995         uint64_t ret_ref = 0;
78996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78998         return ret_ref;
78999 }
79000 int64_t  __attribute__((export_name("TS_ReceiveTlvs_clone_ptr"))) TS_ReceiveTlvs_clone_ptr(uint64_t arg) {
79001         LDKReceiveTlvs arg_conv;
79002         arg_conv.inner = untag_ptr(arg);
79003         arg_conv.is_owned = ptr_is_owned(arg);
79004         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79005         arg_conv.is_owned = false;
79006         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
79007         return ret_conv;
79008 }
79009
79010 uint64_t  __attribute__((export_name("TS_ReceiveTlvs_clone"))) TS_ReceiveTlvs_clone(uint64_t orig) {
79011         LDKReceiveTlvs orig_conv;
79012         orig_conv.inner = untag_ptr(orig);
79013         orig_conv.is_owned = ptr_is_owned(orig);
79014         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79015         orig_conv.is_owned = false;
79016         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
79017         uint64_t ret_ref = 0;
79018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79020         return ret_ref;
79021 }
79022
79023 void  __attribute__((export_name("TS_PaymentRelay_free"))) TS_PaymentRelay_free(uint64_t this_obj) {
79024         LDKPaymentRelay this_obj_conv;
79025         this_obj_conv.inner = untag_ptr(this_obj);
79026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79028         PaymentRelay_free(this_obj_conv);
79029 }
79030
79031 int16_t  __attribute__((export_name("TS_PaymentRelay_get_cltv_expiry_delta"))) TS_PaymentRelay_get_cltv_expiry_delta(uint64_t this_ptr) {
79032         LDKPaymentRelay this_ptr_conv;
79033         this_ptr_conv.inner = untag_ptr(this_ptr);
79034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79036         this_ptr_conv.is_owned = false;
79037         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
79038         return ret_conv;
79039 }
79040
79041 void  __attribute__((export_name("TS_PaymentRelay_set_cltv_expiry_delta"))) TS_PaymentRelay_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
79042         LDKPaymentRelay this_ptr_conv;
79043         this_ptr_conv.inner = untag_ptr(this_ptr);
79044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79046         this_ptr_conv.is_owned = false;
79047         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
79048 }
79049
79050 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_proportional_millionths"))) TS_PaymentRelay_get_fee_proportional_millionths(uint64_t this_ptr) {
79051         LDKPaymentRelay this_ptr_conv;
79052         this_ptr_conv.inner = untag_ptr(this_ptr);
79053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79055         this_ptr_conv.is_owned = false;
79056         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
79057         return ret_conv;
79058 }
79059
79060 void  __attribute__((export_name("TS_PaymentRelay_set_fee_proportional_millionths"))) TS_PaymentRelay_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
79061         LDKPaymentRelay this_ptr_conv;
79062         this_ptr_conv.inner = untag_ptr(this_ptr);
79063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79065         this_ptr_conv.is_owned = false;
79066         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
79067 }
79068
79069 int32_t  __attribute__((export_name("TS_PaymentRelay_get_fee_base_msat"))) TS_PaymentRelay_get_fee_base_msat(uint64_t this_ptr) {
79070         LDKPaymentRelay this_ptr_conv;
79071         this_ptr_conv.inner = untag_ptr(this_ptr);
79072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79074         this_ptr_conv.is_owned = false;
79075         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
79076         return ret_conv;
79077 }
79078
79079 void  __attribute__((export_name("TS_PaymentRelay_set_fee_base_msat"))) TS_PaymentRelay_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
79080         LDKPaymentRelay this_ptr_conv;
79081         this_ptr_conv.inner = untag_ptr(this_ptr);
79082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79084         this_ptr_conv.is_owned = false;
79085         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
79086 }
79087
79088 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) {
79089         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
79090         uint64_t ret_ref = 0;
79091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79093         return ret_ref;
79094 }
79095
79096 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
79097         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
79098         uint64_t ret_ref = 0;
79099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79101         return ret_ref;
79102 }
79103 int64_t  __attribute__((export_name("TS_PaymentRelay_clone_ptr"))) TS_PaymentRelay_clone_ptr(uint64_t arg) {
79104         LDKPaymentRelay arg_conv;
79105         arg_conv.inner = untag_ptr(arg);
79106         arg_conv.is_owned = ptr_is_owned(arg);
79107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79108         arg_conv.is_owned = false;
79109         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
79110         return ret_conv;
79111 }
79112
79113 uint64_t  __attribute__((export_name("TS_PaymentRelay_clone"))) TS_PaymentRelay_clone(uint64_t orig) {
79114         LDKPaymentRelay orig_conv;
79115         orig_conv.inner = untag_ptr(orig);
79116         orig_conv.is_owned = ptr_is_owned(orig);
79117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79118         orig_conv.is_owned = false;
79119         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
79120         uint64_t ret_ref = 0;
79121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79123         return ret_ref;
79124 }
79125
79126 void  __attribute__((export_name("TS_PaymentConstraints_free"))) TS_PaymentConstraints_free(uint64_t this_obj) {
79127         LDKPaymentConstraints this_obj_conv;
79128         this_obj_conv.inner = untag_ptr(this_obj);
79129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79131         PaymentConstraints_free(this_obj_conv);
79132 }
79133
79134 int32_t  __attribute__((export_name("TS_PaymentConstraints_get_max_cltv_expiry"))) TS_PaymentConstraints_get_max_cltv_expiry(uint64_t this_ptr) {
79135         LDKPaymentConstraints this_ptr_conv;
79136         this_ptr_conv.inner = untag_ptr(this_ptr);
79137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79139         this_ptr_conv.is_owned = false;
79140         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
79141         return ret_conv;
79142 }
79143
79144 void  __attribute__((export_name("TS_PaymentConstraints_set_max_cltv_expiry"))) TS_PaymentConstraints_set_max_cltv_expiry(uint64_t this_ptr, int32_t val) {
79145         LDKPaymentConstraints this_ptr_conv;
79146         this_ptr_conv.inner = untag_ptr(this_ptr);
79147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79149         this_ptr_conv.is_owned = false;
79150         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
79151 }
79152
79153 int64_t  __attribute__((export_name("TS_PaymentConstraints_get_htlc_minimum_msat"))) TS_PaymentConstraints_get_htlc_minimum_msat(uint64_t this_ptr) {
79154         LDKPaymentConstraints this_ptr_conv;
79155         this_ptr_conv.inner = untag_ptr(this_ptr);
79156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79158         this_ptr_conv.is_owned = false;
79159         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
79160         return ret_conv;
79161 }
79162
79163 void  __attribute__((export_name("TS_PaymentConstraints_set_htlc_minimum_msat"))) TS_PaymentConstraints_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
79164         LDKPaymentConstraints this_ptr_conv;
79165         this_ptr_conv.inner = untag_ptr(this_ptr);
79166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79168         this_ptr_conv.is_owned = false;
79169         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
79170 }
79171
79172 uint64_t  __attribute__((export_name("TS_PaymentConstraints_new"))) TS_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
79173         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
79174         uint64_t ret_ref = 0;
79175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79177         return ret_ref;
79178 }
79179
79180 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
79181         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
79182         uint64_t ret_ref = 0;
79183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79185         return ret_ref;
79186 }
79187 int64_t  __attribute__((export_name("TS_PaymentConstraints_clone_ptr"))) TS_PaymentConstraints_clone_ptr(uint64_t arg) {
79188         LDKPaymentConstraints arg_conv;
79189         arg_conv.inner = untag_ptr(arg);
79190         arg_conv.is_owned = ptr_is_owned(arg);
79191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79192         arg_conv.is_owned = false;
79193         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
79194         return ret_conv;
79195 }
79196
79197 uint64_t  __attribute__((export_name("TS_PaymentConstraints_clone"))) TS_PaymentConstraints_clone(uint64_t orig) {
79198         LDKPaymentConstraints orig_conv;
79199         orig_conv.inner = untag_ptr(orig);
79200         orig_conv.is_owned = ptr_is_owned(orig);
79201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79202         orig_conv.is_owned = false;
79203         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
79204         uint64_t ret_ref = 0;
79205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79207         return ret_ref;
79208 }
79209
79210 void  __attribute__((export_name("TS_PaymentContext_free"))) TS_PaymentContext_free(uint64_t this_ptr) {
79211         if (!ptr_is_owned(this_ptr)) return;
79212         void* this_ptr_ptr = untag_ptr(this_ptr);
79213         CHECK_ACCESS(this_ptr_ptr);
79214         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
79215         FREE(untag_ptr(this_ptr));
79216         PaymentContext_free(this_ptr_conv);
79217 }
79218
79219 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
79220         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79221         *ret_copy = PaymentContext_clone(arg);
79222         uint64_t ret_ref = tag_ptr(ret_copy, true);
79223         return ret_ref;
79224 }
79225 int64_t  __attribute__((export_name("TS_PaymentContext_clone_ptr"))) TS_PaymentContext_clone_ptr(uint64_t arg) {
79226         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
79227         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
79228         return ret_conv;
79229 }
79230
79231 uint64_t  __attribute__((export_name("TS_PaymentContext_clone"))) TS_PaymentContext_clone(uint64_t orig) {
79232         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
79233         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79234         *ret_copy = PaymentContext_clone(orig_conv);
79235         uint64_t ret_ref = tag_ptr(ret_copy, true);
79236         return ret_ref;
79237 }
79238
79239 uint64_t  __attribute__((export_name("TS_PaymentContext_unknown"))) TS_PaymentContext_unknown(uint64_t a) {
79240         LDKUnknownPaymentContext a_conv;
79241         a_conv.inner = untag_ptr(a);
79242         a_conv.is_owned = ptr_is_owned(a);
79243         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79244         a_conv = UnknownPaymentContext_clone(&a_conv);
79245         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79246         *ret_copy = PaymentContext_unknown(a_conv);
79247         uint64_t ret_ref = tag_ptr(ret_copy, true);
79248         return ret_ref;
79249 }
79250
79251 uint64_t  __attribute__((export_name("TS_PaymentContext_bolt12_offer"))) TS_PaymentContext_bolt12_offer(uint64_t a) {
79252         LDKBolt12OfferContext a_conv;
79253         a_conv.inner = untag_ptr(a);
79254         a_conv.is_owned = ptr_is_owned(a);
79255         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79256         a_conv = Bolt12OfferContext_clone(&a_conv);
79257         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79258         *ret_copy = PaymentContext_bolt12_offer(a_conv);
79259         uint64_t ret_ref = tag_ptr(ret_copy, true);
79260         return ret_ref;
79261 }
79262
79263 uint64_t  __attribute__((export_name("TS_PaymentContext_bolt12_refund"))) TS_PaymentContext_bolt12_refund(uint64_t a) {
79264         LDKBolt12RefundContext a_conv;
79265         a_conv.inner = untag_ptr(a);
79266         a_conv.is_owned = ptr_is_owned(a);
79267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79268         a_conv = Bolt12RefundContext_clone(&a_conv);
79269         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79270         *ret_copy = PaymentContext_bolt12_refund(a_conv);
79271         uint64_t ret_ref = tag_ptr(ret_copy, true);
79272         return ret_ref;
79273 }
79274
79275 jboolean  __attribute__((export_name("TS_PaymentContext_eq"))) TS_PaymentContext_eq(uint64_t a, uint64_t b) {
79276         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
79277         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
79278         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
79279         return ret_conv;
79280 }
79281
79282 void  __attribute__((export_name("TS_UnknownPaymentContext_free"))) TS_UnknownPaymentContext_free(uint64_t this_obj) {
79283         LDKUnknownPaymentContext this_obj_conv;
79284         this_obj_conv.inner = untag_ptr(this_obj);
79285         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79287         UnknownPaymentContext_free(this_obj_conv);
79288 }
79289
79290 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
79291         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
79292         uint64_t ret_ref = 0;
79293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79295         return ret_ref;
79296 }
79297 int64_t  __attribute__((export_name("TS_UnknownPaymentContext_clone_ptr"))) TS_UnknownPaymentContext_clone_ptr(uint64_t arg) {
79298         LDKUnknownPaymentContext arg_conv;
79299         arg_conv.inner = untag_ptr(arg);
79300         arg_conv.is_owned = ptr_is_owned(arg);
79301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79302         arg_conv.is_owned = false;
79303         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
79304         return ret_conv;
79305 }
79306
79307 uint64_t  __attribute__((export_name("TS_UnknownPaymentContext_clone"))) TS_UnknownPaymentContext_clone(uint64_t orig) {
79308         LDKUnknownPaymentContext orig_conv;
79309         orig_conv.inner = untag_ptr(orig);
79310         orig_conv.is_owned = ptr_is_owned(orig);
79311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79312         orig_conv.is_owned = false;
79313         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
79314         uint64_t ret_ref = 0;
79315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79317         return ret_ref;
79318 }
79319
79320 jboolean  __attribute__((export_name("TS_UnknownPaymentContext_eq"))) TS_UnknownPaymentContext_eq(uint64_t a, uint64_t b) {
79321         LDKUnknownPaymentContext a_conv;
79322         a_conv.inner = untag_ptr(a);
79323         a_conv.is_owned = ptr_is_owned(a);
79324         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79325         a_conv.is_owned = false;
79326         LDKUnknownPaymentContext b_conv;
79327         b_conv.inner = untag_ptr(b);
79328         b_conv.is_owned = ptr_is_owned(b);
79329         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79330         b_conv.is_owned = false;
79331         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
79332         return ret_conv;
79333 }
79334
79335 void  __attribute__((export_name("TS_Bolt12OfferContext_free"))) TS_Bolt12OfferContext_free(uint64_t this_obj) {
79336         LDKBolt12OfferContext this_obj_conv;
79337         this_obj_conv.inner = untag_ptr(this_obj);
79338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79340         Bolt12OfferContext_free(this_obj_conv);
79341 }
79342
79343 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_get_offer_id"))) TS_Bolt12OfferContext_get_offer_id(uint64_t this_ptr) {
79344         LDKBolt12OfferContext this_ptr_conv;
79345         this_ptr_conv.inner = untag_ptr(this_ptr);
79346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79348         this_ptr_conv.is_owned = false;
79349         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
79350         uint64_t ret_ref = 0;
79351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79353         return ret_ref;
79354 }
79355
79356 void  __attribute__((export_name("TS_Bolt12OfferContext_set_offer_id"))) TS_Bolt12OfferContext_set_offer_id(uint64_t this_ptr, uint64_t val) {
79357         LDKBolt12OfferContext this_ptr_conv;
79358         this_ptr_conv.inner = untag_ptr(this_ptr);
79359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79361         this_ptr_conv.is_owned = false;
79362         LDKOfferId val_conv;
79363         val_conv.inner = untag_ptr(val);
79364         val_conv.is_owned = ptr_is_owned(val);
79365         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79366         val_conv = OfferId_clone(&val_conv);
79367         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
79368 }
79369
79370 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_get_invoice_request"))) TS_Bolt12OfferContext_get_invoice_request(uint64_t this_ptr) {
79371         LDKBolt12OfferContext this_ptr_conv;
79372         this_ptr_conv.inner = untag_ptr(this_ptr);
79373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79375         this_ptr_conv.is_owned = false;
79376         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
79377         uint64_t ret_ref = 0;
79378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79380         return ret_ref;
79381 }
79382
79383 void  __attribute__((export_name("TS_Bolt12OfferContext_set_invoice_request"))) TS_Bolt12OfferContext_set_invoice_request(uint64_t this_ptr, uint64_t val) {
79384         LDKBolt12OfferContext this_ptr_conv;
79385         this_ptr_conv.inner = untag_ptr(this_ptr);
79386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79388         this_ptr_conv.is_owned = false;
79389         LDKInvoiceRequestFields val_conv;
79390         val_conv.inner = untag_ptr(val);
79391         val_conv.is_owned = ptr_is_owned(val);
79392         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79393         val_conv = InvoiceRequestFields_clone(&val_conv);
79394         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
79395 }
79396
79397 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_new"))) TS_Bolt12OfferContext_new(uint64_t offer_id_arg, uint64_t invoice_request_arg) {
79398         LDKOfferId offer_id_arg_conv;
79399         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
79400         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
79401         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
79402         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
79403         LDKInvoiceRequestFields invoice_request_arg_conv;
79404         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
79405         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
79406         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
79407         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
79408         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
79409         uint64_t ret_ref = 0;
79410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79412         return ret_ref;
79413 }
79414
79415 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
79416         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
79417         uint64_t ret_ref = 0;
79418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79420         return ret_ref;
79421 }
79422 int64_t  __attribute__((export_name("TS_Bolt12OfferContext_clone_ptr"))) TS_Bolt12OfferContext_clone_ptr(uint64_t arg) {
79423         LDKBolt12OfferContext arg_conv;
79424         arg_conv.inner = untag_ptr(arg);
79425         arg_conv.is_owned = ptr_is_owned(arg);
79426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79427         arg_conv.is_owned = false;
79428         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
79429         return ret_conv;
79430 }
79431
79432 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_clone"))) TS_Bolt12OfferContext_clone(uint64_t orig) {
79433         LDKBolt12OfferContext orig_conv;
79434         orig_conv.inner = untag_ptr(orig);
79435         orig_conv.is_owned = ptr_is_owned(orig);
79436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79437         orig_conv.is_owned = false;
79438         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
79439         uint64_t ret_ref = 0;
79440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79442         return ret_ref;
79443 }
79444
79445 jboolean  __attribute__((export_name("TS_Bolt12OfferContext_eq"))) TS_Bolt12OfferContext_eq(uint64_t a, uint64_t b) {
79446         LDKBolt12OfferContext a_conv;
79447         a_conv.inner = untag_ptr(a);
79448         a_conv.is_owned = ptr_is_owned(a);
79449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79450         a_conv.is_owned = false;
79451         LDKBolt12OfferContext b_conv;
79452         b_conv.inner = untag_ptr(b);
79453         b_conv.is_owned = ptr_is_owned(b);
79454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79455         b_conv.is_owned = false;
79456         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
79457         return ret_conv;
79458 }
79459
79460 void  __attribute__((export_name("TS_Bolt12RefundContext_free"))) TS_Bolt12RefundContext_free(uint64_t this_obj) {
79461         LDKBolt12RefundContext this_obj_conv;
79462         this_obj_conv.inner = untag_ptr(this_obj);
79463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79465         Bolt12RefundContext_free(this_obj_conv);
79466 }
79467
79468 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_new"))) TS_Bolt12RefundContext_new() {
79469         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
79470         uint64_t ret_ref = 0;
79471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79473         return ret_ref;
79474 }
79475
79476 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
79477         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
79478         uint64_t ret_ref = 0;
79479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79481         return ret_ref;
79482 }
79483 int64_t  __attribute__((export_name("TS_Bolt12RefundContext_clone_ptr"))) TS_Bolt12RefundContext_clone_ptr(uint64_t arg) {
79484         LDKBolt12RefundContext arg_conv;
79485         arg_conv.inner = untag_ptr(arg);
79486         arg_conv.is_owned = ptr_is_owned(arg);
79487         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79488         arg_conv.is_owned = false;
79489         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
79490         return ret_conv;
79491 }
79492
79493 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_clone"))) TS_Bolt12RefundContext_clone(uint64_t orig) {
79494         LDKBolt12RefundContext orig_conv;
79495         orig_conv.inner = untag_ptr(orig);
79496         orig_conv.is_owned = ptr_is_owned(orig);
79497         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79498         orig_conv.is_owned = false;
79499         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
79500         uint64_t ret_ref = 0;
79501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79503         return ret_ref;
79504 }
79505
79506 jboolean  __attribute__((export_name("TS_Bolt12RefundContext_eq"))) TS_Bolt12RefundContext_eq(uint64_t a, uint64_t b) {
79507         LDKBolt12RefundContext a_conv;
79508         a_conv.inner = untag_ptr(a);
79509         a_conv.is_owned = ptr_is_owned(a);
79510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79511         a_conv.is_owned = false;
79512         LDKBolt12RefundContext b_conv;
79513         b_conv.inner = untag_ptr(b);
79514         b_conv.is_owned = ptr_is_owned(b);
79515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79516         b_conv.is_owned = false;
79517         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
79518         return ret_conv;
79519 }
79520
79521 int8_tArray  __attribute__((export_name("TS_ForwardTlvs_write"))) TS_ForwardTlvs_write(uint64_t obj) {
79522         LDKForwardTlvs obj_conv;
79523         obj_conv.inner = untag_ptr(obj);
79524         obj_conv.is_owned = ptr_is_owned(obj);
79525         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79526         obj_conv.is_owned = false;
79527         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
79528         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79529         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79530         CVec_u8Z_free(ret_var);
79531         return ret_arr;
79532 }
79533
79534 int8_tArray  __attribute__((export_name("TS_ReceiveTlvs_write"))) TS_ReceiveTlvs_write(uint64_t obj) {
79535         LDKReceiveTlvs obj_conv;
79536         obj_conv.inner = untag_ptr(obj);
79537         obj_conv.is_owned = ptr_is_owned(obj);
79538         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79539         obj_conv.is_owned = false;
79540         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
79541         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79542         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79543         CVec_u8Z_free(ret_var);
79544         return ret_arr;
79545 }
79546
79547 int8_tArray  __attribute__((export_name("TS_PaymentRelay_write"))) TS_PaymentRelay_write(uint64_t obj) {
79548         LDKPaymentRelay obj_conv;
79549         obj_conv.inner = untag_ptr(obj);
79550         obj_conv.is_owned = ptr_is_owned(obj);
79551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79552         obj_conv.is_owned = false;
79553         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
79554         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79555         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79556         CVec_u8Z_free(ret_var);
79557         return ret_arr;
79558 }
79559
79560 uint64_t  __attribute__((export_name("TS_PaymentRelay_read"))) TS_PaymentRelay_read(int8_tArray ser) {
79561         LDKu8slice ser_ref;
79562         ser_ref.datalen = ser->arr_len;
79563         ser_ref.data = ser->elems;
79564         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
79565         *ret_conv = PaymentRelay_read(ser_ref);
79566         FREE(ser);
79567         return tag_ptr(ret_conv, true);
79568 }
79569
79570 int8_tArray  __attribute__((export_name("TS_PaymentConstraints_write"))) TS_PaymentConstraints_write(uint64_t obj) {
79571         LDKPaymentConstraints obj_conv;
79572         obj_conv.inner = untag_ptr(obj);
79573         obj_conv.is_owned = ptr_is_owned(obj);
79574         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79575         obj_conv.is_owned = false;
79576         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
79577         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79578         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79579         CVec_u8Z_free(ret_var);
79580         return ret_arr;
79581 }
79582
79583 uint64_t  __attribute__((export_name("TS_PaymentConstraints_read"))) TS_PaymentConstraints_read(int8_tArray ser) {
79584         LDKu8slice ser_ref;
79585         ser_ref.datalen = ser->arr_len;
79586         ser_ref.data = ser->elems;
79587         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
79588         *ret_conv = PaymentConstraints_read(ser_ref);
79589         FREE(ser);
79590         return tag_ptr(ret_conv, true);
79591 }
79592
79593 int8_tArray  __attribute__((export_name("TS_PaymentContext_write"))) TS_PaymentContext_write(uint64_t obj) {
79594         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
79595         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
79596         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79597         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79598         CVec_u8Z_free(ret_var);
79599         return ret_arr;
79600 }
79601
79602 uint64_t  __attribute__((export_name("TS_PaymentContext_read"))) TS_PaymentContext_read(int8_tArray ser) {
79603         LDKu8slice ser_ref;
79604         ser_ref.datalen = ser->arr_len;
79605         ser_ref.data = ser->elems;
79606         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
79607         *ret_conv = PaymentContext_read(ser_ref);
79608         FREE(ser);
79609         return tag_ptr(ret_conv, true);
79610 }
79611
79612 int8_tArray  __attribute__((export_name("TS_UnknownPaymentContext_write"))) TS_UnknownPaymentContext_write(uint64_t obj) {
79613         LDKUnknownPaymentContext obj_conv;
79614         obj_conv.inner = untag_ptr(obj);
79615         obj_conv.is_owned = ptr_is_owned(obj);
79616         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79617         obj_conv.is_owned = false;
79618         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
79619         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79620         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79621         CVec_u8Z_free(ret_var);
79622         return ret_arr;
79623 }
79624
79625 uint64_t  __attribute__((export_name("TS_UnknownPaymentContext_read"))) TS_UnknownPaymentContext_read(int8_tArray ser) {
79626         LDKu8slice ser_ref;
79627         ser_ref.datalen = ser->arr_len;
79628         ser_ref.data = ser->elems;
79629         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
79630         *ret_conv = UnknownPaymentContext_read(ser_ref);
79631         FREE(ser);
79632         return tag_ptr(ret_conv, true);
79633 }
79634
79635 int8_tArray  __attribute__((export_name("TS_Bolt12OfferContext_write"))) TS_Bolt12OfferContext_write(uint64_t obj) {
79636         LDKBolt12OfferContext obj_conv;
79637         obj_conv.inner = untag_ptr(obj);
79638         obj_conv.is_owned = ptr_is_owned(obj);
79639         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79640         obj_conv.is_owned = false;
79641         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
79642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79644         CVec_u8Z_free(ret_var);
79645         return ret_arr;
79646 }
79647
79648 uint64_t  __attribute__((export_name("TS_Bolt12OfferContext_read"))) TS_Bolt12OfferContext_read(int8_tArray ser) {
79649         LDKu8slice ser_ref;
79650         ser_ref.datalen = ser->arr_len;
79651         ser_ref.data = ser->elems;
79652         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
79653         *ret_conv = Bolt12OfferContext_read(ser_ref);
79654         FREE(ser);
79655         return tag_ptr(ret_conv, true);
79656 }
79657
79658 int8_tArray  __attribute__((export_name("TS_Bolt12RefundContext_write"))) TS_Bolt12RefundContext_write(uint64_t obj) {
79659         LDKBolt12RefundContext obj_conv;
79660         obj_conv.inner = untag_ptr(obj);
79661         obj_conv.is_owned = ptr_is_owned(obj);
79662         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79663         obj_conv.is_owned = false;
79664         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
79665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79667         CVec_u8Z_free(ret_var);
79668         return ret_arr;
79669 }
79670
79671 uint64_t  __attribute__((export_name("TS_Bolt12RefundContext_read"))) TS_Bolt12RefundContext_read(int8_tArray ser) {
79672         LDKu8slice ser_ref;
79673         ser_ref.datalen = ser->arr_len;
79674         ser_ref.data = ser->elems;
79675         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
79676         *ret_conv = Bolt12RefundContext_read(ser_ref);
79677         FREE(ser);
79678         return tag_ptr(ret_conv, true);
79679 }
79680
79681 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
79682         if (!ptr_is_owned(this_ptr)) return;
79683         void* this_ptr_ptr = untag_ptr(this_ptr);
79684         CHECK_ACCESS(this_ptr_ptr);
79685         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
79686         FREE(untag_ptr(this_ptr));
79687         PaymentPurpose_free(this_ptr_conv);
79688 }
79689
79690 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
79691         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
79692         *ret_copy = PaymentPurpose_clone(arg);
79693         uint64_t ret_ref = tag_ptr(ret_copy, true);
79694         return ret_ref;
79695 }
79696 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
79697         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
79698         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
79699         return ret_conv;
79700 }
79701
79702 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
79703         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
79704         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
79705         *ret_copy = PaymentPurpose_clone(orig_conv);
79706         uint64_t ret_ref = tag_ptr(ret_copy, true);
79707         return ret_ref;
79708 }
79709
79710 uint64_t  __attribute__((export_name("TS_PaymentPurpose_bolt11_invoice_payment"))) TS_PaymentPurpose_bolt11_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
79711         void* payment_preimage_ptr = untag_ptr(payment_preimage);
79712         CHECK_ACCESS(payment_preimage_ptr);
79713         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
79714         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
79715         LDKThirtyTwoBytes payment_secret_ref;
79716         CHECK(payment_secret->arr_len == 32);
79717         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
79718         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
79719         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
79720         uint64_t ret_ref = tag_ptr(ret_copy, true);
79721         return ret_ref;
79722 }
79723
79724 uint64_t  __attribute__((export_name("TS_PaymentPurpose_bolt12_offer_payment"))) TS_PaymentPurpose_bolt12_offer_payment(uint64_t payment_preimage, int8_tArray payment_secret, uint64_t payment_context) {
79725         void* payment_preimage_ptr = untag_ptr(payment_preimage);
79726         CHECK_ACCESS(payment_preimage_ptr);
79727         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
79728         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
79729         LDKThirtyTwoBytes payment_secret_ref;
79730         CHECK(payment_secret->arr_len == 32);
79731         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
79732         LDKBolt12OfferContext payment_context_conv;
79733         payment_context_conv.inner = untag_ptr(payment_context);
79734         payment_context_conv.is_owned = ptr_is_owned(payment_context);
79735         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
79736         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
79737         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
79738         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
79739         uint64_t ret_ref = tag_ptr(ret_copy, true);
79740         return ret_ref;
79741 }
79742
79743 uint64_t  __attribute__((export_name("TS_PaymentPurpose_bolt12_refund_payment"))) TS_PaymentPurpose_bolt12_refund_payment(uint64_t payment_preimage, int8_tArray payment_secret, uint64_t payment_context) {
79744         void* payment_preimage_ptr = untag_ptr(payment_preimage);
79745         CHECK_ACCESS(payment_preimage_ptr);
79746         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
79747         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
79748         LDKThirtyTwoBytes payment_secret_ref;
79749         CHECK(payment_secret->arr_len == 32);
79750         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
79751         LDKBolt12RefundContext payment_context_conv;
79752         payment_context_conv.inner = untag_ptr(payment_context);
79753         payment_context_conv.is_owned = ptr_is_owned(payment_context);
79754         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
79755         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
79756         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
79757         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
79758         uint64_t ret_ref = tag_ptr(ret_copy, true);
79759         return ret_ref;
79760 }
79761
79762 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
79763         LDKThirtyTwoBytes a_ref;
79764         CHECK(a->arr_len == 32);
79765         memcpy(a_ref.data, a->elems, 32); FREE(a);
79766         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
79767         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
79768         uint64_t ret_ref = tag_ptr(ret_copy, true);
79769         return ret_ref;
79770 }
79771
79772 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
79773         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
79774         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
79775         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
79776         return ret_conv;
79777 }
79778
79779 uint64_t  __attribute__((export_name("TS_PaymentPurpose_preimage"))) TS_PaymentPurpose_preimage(uint64_t this_arg) {
79780         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
79781         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
79782         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
79783         uint64_t ret_ref = tag_ptr(ret_copy, true);
79784         return ret_ref;
79785 }
79786
79787 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
79788         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
79789         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
79790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79792         CVec_u8Z_free(ret_var);
79793         return ret_arr;
79794 }
79795
79796 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
79797         LDKu8slice ser_ref;
79798         ser_ref.datalen = ser->arr_len;
79799         ser_ref.data = ser->elems;
79800         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
79801         *ret_conv = PaymentPurpose_read(ser_ref);
79802         FREE(ser);
79803         return tag_ptr(ret_conv, true);
79804 }
79805
79806 void  __attribute__((export_name("TS_ClaimedHTLC_free"))) TS_ClaimedHTLC_free(uint64_t this_obj) {
79807         LDKClaimedHTLC this_obj_conv;
79808         this_obj_conv.inner = untag_ptr(this_obj);
79809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79811         ClaimedHTLC_free(this_obj_conv);
79812 }
79813
79814 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_get_channel_id"))) TS_ClaimedHTLC_get_channel_id(uint64_t this_ptr) {
79815         LDKClaimedHTLC this_ptr_conv;
79816         this_ptr_conv.inner = untag_ptr(this_ptr);
79817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79819         this_ptr_conv.is_owned = false;
79820         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
79821         uint64_t ret_ref = 0;
79822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79824         return ret_ref;
79825 }
79826
79827 void  __attribute__((export_name("TS_ClaimedHTLC_set_channel_id"))) TS_ClaimedHTLC_set_channel_id(uint64_t this_ptr, uint64_t val) {
79828         LDKClaimedHTLC this_ptr_conv;
79829         this_ptr_conv.inner = untag_ptr(this_ptr);
79830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79832         this_ptr_conv.is_owned = false;
79833         LDKChannelId val_conv;
79834         val_conv.inner = untag_ptr(val);
79835         val_conv.is_owned = ptr_is_owned(val);
79836         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79837         val_conv = ChannelId_clone(&val_conv);
79838         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
79839 }
79840
79841 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_get_user_channel_id"))) TS_ClaimedHTLC_get_user_channel_id(uint64_t this_ptr) {
79842         LDKClaimedHTLC this_ptr_conv;
79843         this_ptr_conv.inner = untag_ptr(this_ptr);
79844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79846         this_ptr_conv.is_owned = false;
79847         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
79848         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
79849         return ret_arr;
79850 }
79851
79852 void  __attribute__((export_name("TS_ClaimedHTLC_set_user_channel_id"))) TS_ClaimedHTLC_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
79853         LDKClaimedHTLC this_ptr_conv;
79854         this_ptr_conv.inner = untag_ptr(this_ptr);
79855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79857         this_ptr_conv.is_owned = false;
79858         LDKU128 val_ref;
79859         CHECK(val->arr_len == 16);
79860         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
79861         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
79862 }
79863
79864 int32_t  __attribute__((export_name("TS_ClaimedHTLC_get_cltv_expiry"))) TS_ClaimedHTLC_get_cltv_expiry(uint64_t this_ptr) {
79865         LDKClaimedHTLC this_ptr_conv;
79866         this_ptr_conv.inner = untag_ptr(this_ptr);
79867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79869         this_ptr_conv.is_owned = false;
79870         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
79871         return ret_conv;
79872 }
79873
79874 void  __attribute__((export_name("TS_ClaimedHTLC_set_cltv_expiry"))) TS_ClaimedHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
79875         LDKClaimedHTLC this_ptr_conv;
79876         this_ptr_conv.inner = untag_ptr(this_ptr);
79877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79879         this_ptr_conv.is_owned = false;
79880         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
79881 }
79882
79883 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_value_msat"))) TS_ClaimedHTLC_get_value_msat(uint64_t this_ptr) {
79884         LDKClaimedHTLC this_ptr_conv;
79885         this_ptr_conv.inner = untag_ptr(this_ptr);
79886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79888         this_ptr_conv.is_owned = false;
79889         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
79890         return ret_conv;
79891 }
79892
79893 void  __attribute__((export_name("TS_ClaimedHTLC_set_value_msat"))) TS_ClaimedHTLC_set_value_msat(uint64_t this_ptr, int64_t val) {
79894         LDKClaimedHTLC this_ptr_conv;
79895         this_ptr_conv.inner = untag_ptr(this_ptr);
79896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79898         this_ptr_conv.is_owned = false;
79899         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
79900 }
79901
79902 int64_t  __attribute__((export_name("TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat"))) TS_ClaimedHTLC_get_counterparty_skimmed_fee_msat(uint64_t this_ptr) {
79903         LDKClaimedHTLC this_ptr_conv;
79904         this_ptr_conv.inner = untag_ptr(this_ptr);
79905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79907         this_ptr_conv.is_owned = false;
79908         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
79909         return ret_conv;
79910 }
79911
79912 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) {
79913         LDKClaimedHTLC this_ptr_conv;
79914         this_ptr_conv.inner = untag_ptr(this_ptr);
79915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79917         this_ptr_conv.is_owned = false;
79918         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
79919 }
79920
79921 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_new"))) TS_ClaimedHTLC_new(uint64_t 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) {
79922         LDKChannelId channel_id_arg_conv;
79923         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
79924         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
79925         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
79926         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
79927         LDKU128 user_channel_id_arg_ref;
79928         CHECK(user_channel_id_arg->arr_len == 16);
79929         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
79930         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_conv, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
79931         uint64_t ret_ref = 0;
79932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79934         return ret_ref;
79935 }
79936
79937 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
79938         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
79939         uint64_t ret_ref = 0;
79940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79942         return ret_ref;
79943 }
79944 int64_t  __attribute__((export_name("TS_ClaimedHTLC_clone_ptr"))) TS_ClaimedHTLC_clone_ptr(uint64_t arg) {
79945         LDKClaimedHTLC arg_conv;
79946         arg_conv.inner = untag_ptr(arg);
79947         arg_conv.is_owned = ptr_is_owned(arg);
79948         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79949         arg_conv.is_owned = false;
79950         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
79951         return ret_conv;
79952 }
79953
79954 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_clone"))) TS_ClaimedHTLC_clone(uint64_t orig) {
79955         LDKClaimedHTLC orig_conv;
79956         orig_conv.inner = untag_ptr(orig);
79957         orig_conv.is_owned = ptr_is_owned(orig);
79958         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79959         orig_conv.is_owned = false;
79960         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
79961         uint64_t ret_ref = 0;
79962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79964         return ret_ref;
79965 }
79966
79967 jboolean  __attribute__((export_name("TS_ClaimedHTLC_eq"))) TS_ClaimedHTLC_eq(uint64_t a, uint64_t b) {
79968         LDKClaimedHTLC a_conv;
79969         a_conv.inner = untag_ptr(a);
79970         a_conv.is_owned = ptr_is_owned(a);
79971         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79972         a_conv.is_owned = false;
79973         LDKClaimedHTLC b_conv;
79974         b_conv.inner = untag_ptr(b);
79975         b_conv.is_owned = ptr_is_owned(b);
79976         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79977         b_conv.is_owned = false;
79978         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
79979         return ret_conv;
79980 }
79981
79982 int8_tArray  __attribute__((export_name("TS_ClaimedHTLC_write"))) TS_ClaimedHTLC_write(uint64_t obj) {
79983         LDKClaimedHTLC obj_conv;
79984         obj_conv.inner = untag_ptr(obj);
79985         obj_conv.is_owned = ptr_is_owned(obj);
79986         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79987         obj_conv.is_owned = false;
79988         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
79989         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79990         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79991         CVec_u8Z_free(ret_var);
79992         return ret_arr;
79993 }
79994
79995 uint64_t  __attribute__((export_name("TS_ClaimedHTLC_read"))) TS_ClaimedHTLC_read(int8_tArray ser) {
79996         LDKu8slice ser_ref;
79997         ser_ref.datalen = ser->arr_len;
79998         ser_ref.data = ser->elems;
79999         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
80000         *ret_conv = ClaimedHTLC_read(ser_ref);
80001         FREE(ser);
80002         return tag_ptr(ret_conv, true);
80003 }
80004
80005 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
80006         if (!ptr_is_owned(this_ptr)) return;
80007         void* this_ptr_ptr = untag_ptr(this_ptr);
80008         CHECK_ACCESS(this_ptr_ptr);
80009         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
80010         FREE(untag_ptr(this_ptr));
80011         PathFailure_free(this_ptr_conv);
80012 }
80013
80014 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
80015         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80016         *ret_copy = PathFailure_clone(arg);
80017         uint64_t ret_ref = tag_ptr(ret_copy, true);
80018         return ret_ref;
80019 }
80020 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
80021         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
80022         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
80023         return ret_conv;
80024 }
80025
80026 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
80027         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
80028         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80029         *ret_copy = PathFailure_clone(orig_conv);
80030         uint64_t ret_ref = tag_ptr(ret_copy, true);
80031         return ret_ref;
80032 }
80033
80034 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
80035         void* err_ptr = untag_ptr(err);
80036         CHECK_ACCESS(err_ptr);
80037         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
80038         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
80039         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80040         *ret_copy = PathFailure_initial_send(err_conv);
80041         uint64_t ret_ref = tag_ptr(ret_copy, true);
80042         return ret_ref;
80043 }
80044
80045 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
80046         void* network_update_ptr = untag_ptr(network_update);
80047         CHECK_ACCESS(network_update_ptr);
80048         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
80049         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
80050         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80051         *ret_copy = PathFailure_on_path(network_update_conv);
80052         uint64_t ret_ref = tag_ptr(ret_copy, true);
80053         return ret_ref;
80054 }
80055
80056 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
80057         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
80058         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
80059         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
80060         return ret_conv;
80061 }
80062
80063 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
80064         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
80065         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
80066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80068         CVec_u8Z_free(ret_var);
80069         return ret_arr;
80070 }
80071
80072 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
80073         LDKu8slice ser_ref;
80074         ser_ref.datalen = ser->arr_len;
80075         ser_ref.data = ser->elems;
80076         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
80077         *ret_conv = PathFailure_read(ser_ref);
80078         FREE(ser);
80079         return tag_ptr(ret_conv, true);
80080 }
80081
80082 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
80083         if (!ptr_is_owned(this_ptr)) return;
80084         void* this_ptr_ptr = untag_ptr(this_ptr);
80085         CHECK_ACCESS(this_ptr_ptr);
80086         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
80087         FREE(untag_ptr(this_ptr));
80088         ClosureReason_free(this_ptr_conv);
80089 }
80090
80091 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
80092         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80093         *ret_copy = ClosureReason_clone(arg);
80094         uint64_t ret_ref = tag_ptr(ret_copy, true);
80095         return ret_ref;
80096 }
80097 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
80098         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
80099         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
80100         return ret_conv;
80101 }
80102
80103 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
80104         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
80105         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80106         *ret_copy = ClosureReason_clone(orig_conv);
80107         uint64_t ret_ref = tag_ptr(ret_copy, true);
80108         return ret_ref;
80109 }
80110
80111 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
80112         LDKUntrustedString peer_msg_conv;
80113         peer_msg_conv.inner = untag_ptr(peer_msg);
80114         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
80115         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
80116         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
80117         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80118         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
80119         uint64_t ret_ref = tag_ptr(ret_copy, true);
80120         return ret_ref;
80121 }
80122
80123 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
80124         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80125         *ret_copy = ClosureReason_holder_force_closed();
80126         uint64_t ret_ref = tag_ptr(ret_copy, true);
80127         return ret_ref;
80128 }
80129
80130 uint64_t  __attribute__((export_name("TS_ClosureReason_legacy_cooperative_closure"))) TS_ClosureReason_legacy_cooperative_closure() {
80131         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80132         *ret_copy = ClosureReason_legacy_cooperative_closure();
80133         uint64_t ret_ref = tag_ptr(ret_copy, true);
80134         return ret_ref;
80135 }
80136
80137 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_initiated_cooperative_closure"))) TS_ClosureReason_counterparty_initiated_cooperative_closure() {
80138         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80139         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
80140         uint64_t ret_ref = tag_ptr(ret_copy, true);
80141         return ret_ref;
80142 }
80143
80144 uint64_t  __attribute__((export_name("TS_ClosureReason_locally_initiated_cooperative_closure"))) TS_ClosureReason_locally_initiated_cooperative_closure() {
80145         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80146         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
80147         uint64_t ret_ref = tag_ptr(ret_copy, true);
80148         return ret_ref;
80149 }
80150
80151 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
80152         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80153         *ret_copy = ClosureReason_commitment_tx_confirmed();
80154         uint64_t ret_ref = tag_ptr(ret_copy, true);
80155         return ret_ref;
80156 }
80157
80158 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
80159         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80160         *ret_copy = ClosureReason_funding_timed_out();
80161         uint64_t ret_ref = tag_ptr(ret_copy, true);
80162         return ret_ref;
80163 }
80164
80165 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
80166         LDKStr err_conv = str_ref_to_owned_c(err);
80167         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80168         *ret_copy = ClosureReason_processing_error(err_conv);
80169         uint64_t ret_ref = tag_ptr(ret_copy, true);
80170         return ret_ref;
80171 }
80172
80173 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
80174         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80175         *ret_copy = ClosureReason_disconnected_peer();
80176         uint64_t ret_ref = tag_ptr(ret_copy, true);
80177         return ret_ref;
80178 }
80179
80180 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
80181         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80182         *ret_copy = ClosureReason_outdated_channel_manager();
80183         uint64_t ret_ref = tag_ptr(ret_copy, true);
80184         return ret_ref;
80185 }
80186
80187 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
80188         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80189         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
80190         uint64_t ret_ref = tag_ptr(ret_copy, true);
80191         return ret_ref;
80192 }
80193
80194 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_batch_closure"))) TS_ClosureReason_funding_batch_closure() {
80195         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80196         *ret_copy = ClosureReason_funding_batch_closure();
80197         uint64_t ret_ref = tag_ptr(ret_copy, true);
80198         return ret_ref;
80199 }
80200
80201 uint64_t  __attribute__((export_name("TS_ClosureReason_htlcs_timed_out"))) TS_ClosureReason_htlcs_timed_out() {
80202         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80203         *ret_copy = ClosureReason_htlcs_timed_out();
80204         uint64_t ret_ref = tag_ptr(ret_copy, true);
80205         return ret_ref;
80206 }
80207
80208 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
80209         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
80210         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
80211         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
80212         return ret_conv;
80213 }
80214
80215 jstring  __attribute__((export_name("TS_ClosureReason_to_str"))) TS_ClosureReason_to_str(uint64_t o) {
80216         LDKClosureReason* o_conv = (LDKClosureReason*)untag_ptr(o);
80217         LDKStr ret_str = ClosureReason_to_str(o_conv);
80218         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
80219         Str_free(ret_str);
80220         return ret_conv;
80221 }
80222
80223 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
80224         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
80225         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
80226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80228         CVec_u8Z_free(ret_var);
80229         return ret_arr;
80230 }
80231
80232 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
80233         LDKu8slice ser_ref;
80234         ser_ref.datalen = ser->arr_len;
80235         ser_ref.data = ser->elems;
80236         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
80237         *ret_conv = ClosureReason_read(ser_ref);
80238         FREE(ser);
80239         return tag_ptr(ret_conv, true);
80240 }
80241
80242 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
80243         if (!ptr_is_owned(this_ptr)) return;
80244         void* this_ptr_ptr = untag_ptr(this_ptr);
80245         CHECK_ACCESS(this_ptr_ptr);
80246         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
80247         FREE(untag_ptr(this_ptr));
80248         HTLCDestination_free(this_ptr_conv);
80249 }
80250
80251 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
80252         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80253         *ret_copy = HTLCDestination_clone(arg);
80254         uint64_t ret_ref = tag_ptr(ret_copy, true);
80255         return ret_ref;
80256 }
80257 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
80258         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
80259         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
80260         return ret_conv;
80261 }
80262
80263 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
80264         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
80265         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80266         *ret_copy = HTLCDestination_clone(orig_conv);
80267         uint64_t ret_ref = tag_ptr(ret_copy, true);
80268         return ret_ref;
80269 }
80270
80271 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, uint64_t channel_id) {
80272         LDKPublicKey node_id_ref;
80273         CHECK(node_id->arr_len == 33);
80274         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80275         LDKChannelId channel_id_conv;
80276         channel_id_conv.inner = untag_ptr(channel_id);
80277         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80278         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80279         channel_id_conv = ChannelId_clone(&channel_id_conv);
80280         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80281         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
80282         uint64_t ret_ref = tag_ptr(ret_copy, true);
80283         return ret_ref;
80284 }
80285
80286 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
80287         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80288         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
80289         uint64_t ret_ref = tag_ptr(ret_copy, true);
80290         return ret_ref;
80291 }
80292
80293 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
80294         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80295         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
80296         uint64_t ret_ref = tag_ptr(ret_copy, true);
80297         return ret_ref;
80298 }
80299
80300 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_onion"))) TS_HTLCDestination_invalid_onion() {
80301         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80302         *ret_copy = HTLCDestination_invalid_onion();
80303         uint64_t ret_ref = tag_ptr(ret_copy, true);
80304         return ret_ref;
80305 }
80306
80307 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
80308         LDKThirtyTwoBytes payment_hash_ref;
80309         CHECK(payment_hash->arr_len == 32);
80310         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80311         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80312         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
80313         uint64_t ret_ref = tag_ptr(ret_copy, true);
80314         return ret_ref;
80315 }
80316
80317 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
80318         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
80319         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
80320         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
80321         return ret_conv;
80322 }
80323
80324 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
80325         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
80326         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
80327         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80328         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80329         CVec_u8Z_free(ret_var);
80330         return ret_arr;
80331 }
80332
80333 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
80334         LDKu8slice ser_ref;
80335         ser_ref.datalen = ser->arr_len;
80336         ser_ref.data = ser->elems;
80337         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
80338         *ret_conv = HTLCDestination_read(ser_ref);
80339         FREE(ser);
80340         return tag_ptr(ret_conv, true);
80341 }
80342
80343 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
80344         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
80345         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
80346         return ret_conv;
80347 }
80348
80349 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
80350         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
80351         return ret_conv;
80352 }
80353
80354 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
80355         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
80356         return ret_conv;
80357 }
80358
80359 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
80360         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
80361         return ret_conv;
80362 }
80363
80364 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
80365         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
80366         return ret_conv;
80367 }
80368
80369 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
80370         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
80371         return ret_conv;
80372 }
80373
80374 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
80375         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
80376         return ret_conv;
80377 }
80378
80379 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
80380         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
80381         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
80382         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
80383         return ret_conv;
80384 }
80385
80386 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
80387         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
80388         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
80389         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80390         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80391         CVec_u8Z_free(ret_var);
80392         return ret_arr;
80393 }
80394
80395 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
80396         LDKu8slice ser_ref;
80397         ser_ref.datalen = ser->arr_len;
80398         ser_ref.data = ser->elems;
80399         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
80400         *ret_conv = PaymentFailureReason_read(ser_ref);
80401         FREE(ser);
80402         return tag_ptr(ret_conv, true);
80403 }
80404
80405 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
80406         if (!ptr_is_owned(this_ptr)) return;
80407         void* this_ptr_ptr = untag_ptr(this_ptr);
80408         CHECK_ACCESS(this_ptr_ptr);
80409         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
80410         FREE(untag_ptr(this_ptr));
80411         Event_free(this_ptr_conv);
80412 }
80413
80414 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
80415         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80416         *ret_copy = Event_clone(arg);
80417         uint64_t ret_ref = tag_ptr(ret_copy, true);
80418         return ret_ref;
80419 }
80420 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
80421         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
80422         int64_t ret_conv = Event_clone_ptr(arg_conv);
80423         return ret_conv;
80424 }
80425
80426 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
80427         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
80428         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80429         *ret_copy = Event_clone(orig_conv);
80430         uint64_t ret_ref = tag_ptr(ret_copy, true);
80431         return ret_ref;
80432 }
80433
80434 uint64_t  __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(uint64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
80435         LDKChannelId temporary_channel_id_conv;
80436         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
80437         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
80438         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
80439         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
80440         LDKPublicKey counterparty_node_id_ref;
80441         CHECK(counterparty_node_id->arr_len == 33);
80442         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80443         LDKCVec_u8Z output_script_ref;
80444         output_script_ref.datalen = output_script->arr_len;
80445         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
80446         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
80447         LDKU128 user_channel_id_ref;
80448         CHECK(user_channel_id->arr_len == 16);
80449         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
80450         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80451         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
80452         uint64_t ret_ref = tag_ptr(ret_copy, true);
80453         return ret_ref;
80454 }
80455
80456 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) {
80457         LDKPublicKey receiver_node_id_ref;
80458         CHECK(receiver_node_id->arr_len == 33);
80459         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
80460         LDKThirtyTwoBytes payment_hash_ref;
80461         CHECK(payment_hash->arr_len == 32);
80462         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80463         LDKRecipientOnionFields onion_fields_conv;
80464         onion_fields_conv.inner = untag_ptr(onion_fields);
80465         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
80466         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
80467         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
80468         void* purpose_ptr = untag_ptr(purpose);
80469         CHECK_ACCESS(purpose_ptr);
80470         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
80471         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
80472         LDKChannelId via_channel_id_conv;
80473         via_channel_id_conv.inner = untag_ptr(via_channel_id);
80474         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
80475         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
80476         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
80477         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
80478         CHECK_ACCESS(via_user_channel_id_ptr);
80479         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
80480         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
80481         void* claim_deadline_ptr = untag_ptr(claim_deadline);
80482         CHECK_ACCESS(claim_deadline_ptr);
80483         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
80484         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
80485         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80486         *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);
80487         uint64_t ret_ref = tag_ptr(ret_copy, true);
80488         return ret_ref;
80489 }
80490
80491 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) {
80492         LDKPublicKey receiver_node_id_ref;
80493         CHECK(receiver_node_id->arr_len == 33);
80494         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
80495         LDKThirtyTwoBytes payment_hash_ref;
80496         CHECK(payment_hash->arr_len == 32);
80497         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80498         void* purpose_ptr = untag_ptr(purpose);
80499         CHECK_ACCESS(purpose_ptr);
80500         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
80501         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
80502         LDKCVec_ClaimedHTLCZ htlcs_constr;
80503         htlcs_constr.datalen = htlcs->arr_len;
80504         if (htlcs_constr.datalen > 0)
80505                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
80506         else
80507                 htlcs_constr.data = NULL;
80508         uint64_t* htlcs_vals = htlcs->elems;
80509         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
80510                 uint64_t htlcs_conv_13 = htlcs_vals[n];
80511                 LDKClaimedHTLC htlcs_conv_13_conv;
80512                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
80513                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
80514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
80515                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
80516                 htlcs_constr.data[n] = htlcs_conv_13_conv;
80517         }
80518         FREE(htlcs);
80519         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
80520         CHECK_ACCESS(sender_intended_total_msat_ptr);
80521         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
80522         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
80523         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80524         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
80525         uint64_t ret_ref = tag_ptr(ret_copy, true);
80526         return ret_ref;
80527 }
80528
80529 uint64_t  __attribute__((export_name("TS_Event_connection_needed"))) TS_Event_connection_needed(int8_tArray node_id, uint64_tArray addresses) {
80530         LDKPublicKey node_id_ref;
80531         CHECK(node_id->arr_len == 33);
80532         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80533         LDKCVec_SocketAddressZ addresses_constr;
80534         addresses_constr.datalen = addresses->arr_len;
80535         if (addresses_constr.datalen > 0)
80536                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
80537         else
80538                 addresses_constr.data = NULL;
80539         uint64_t* addresses_vals = addresses->elems;
80540         for (size_t p = 0; p < addresses_constr.datalen; p++) {
80541                 uint64_t addresses_conv_15 = addresses_vals[p];
80542                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
80543                 CHECK_ACCESS(addresses_conv_15_ptr);
80544                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
80545                 addresses_constr.data[p] = addresses_conv_15_conv;
80546         }
80547         FREE(addresses);
80548         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80549         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
80550         uint64_t ret_ref = tag_ptr(ret_copy, true);
80551         return ret_ref;
80552 }
80553
80554 uint64_t  __attribute__((export_name("TS_Event_invoice_request_failed"))) TS_Event_invoice_request_failed(int8_tArray payment_id) {
80555         LDKThirtyTwoBytes payment_id_ref;
80556         CHECK(payment_id->arr_len == 32);
80557         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
80558         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80559         *ret_copy = Event_invoice_request_failed(payment_id_ref);
80560         uint64_t ret_ref = tag_ptr(ret_copy, true);
80561         return ret_ref;
80562 }
80563
80564 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) {
80565         void* payment_id_ptr = untag_ptr(payment_id);
80566         CHECK_ACCESS(payment_id_ptr);
80567         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
80568         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
80569         LDKThirtyTwoBytes payment_preimage_ref;
80570         CHECK(payment_preimage->arr_len == 32);
80571         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
80572         LDKThirtyTwoBytes payment_hash_ref;
80573         CHECK(payment_hash->arr_len == 32);
80574         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80575         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
80576         CHECK_ACCESS(fee_paid_msat_ptr);
80577         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
80578         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
80579         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80580         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
80581         uint64_t ret_ref = tag_ptr(ret_copy, true);
80582         return ret_ref;
80583 }
80584
80585 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
80586         LDKThirtyTwoBytes payment_id_ref;
80587         CHECK(payment_id->arr_len == 32);
80588         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
80589         LDKThirtyTwoBytes payment_hash_ref;
80590         CHECK(payment_hash->arr_len == 32);
80591         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80592         void* reason_ptr = untag_ptr(reason);
80593         CHECK_ACCESS(reason_ptr);
80594         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
80595         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
80596         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80597         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
80598         uint64_t ret_ref = tag_ptr(ret_copy, true);
80599         return ret_ref;
80600 }
80601
80602 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) {
80603         LDKThirtyTwoBytes payment_id_ref;
80604         CHECK(payment_id->arr_len == 32);
80605         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
80606         void* payment_hash_ptr = untag_ptr(payment_hash);
80607         CHECK_ACCESS(payment_hash_ptr);
80608         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
80609         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
80610         LDKPath path_conv;
80611         path_conv.inner = untag_ptr(path);
80612         path_conv.is_owned = ptr_is_owned(path);
80613         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
80614         path_conv = Path_clone(&path_conv);
80615         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80616         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
80617         uint64_t ret_ref = tag_ptr(ret_copy, true);
80618         return ret_ref;
80619 }
80620
80621 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) {
80622         void* payment_id_ptr = untag_ptr(payment_id);
80623         CHECK_ACCESS(payment_id_ptr);
80624         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
80625         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
80626         LDKThirtyTwoBytes payment_hash_ref;
80627         CHECK(payment_hash->arr_len == 32);
80628         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80629         void* failure_ptr = untag_ptr(failure);
80630         CHECK_ACCESS(failure_ptr);
80631         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
80632         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
80633         LDKPath path_conv;
80634         path_conv.inner = untag_ptr(path);
80635         path_conv.is_owned = ptr_is_owned(path);
80636         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
80637         path_conv = Path_clone(&path_conv);
80638         void* short_channel_id_ptr = untag_ptr(short_channel_id);
80639         CHECK_ACCESS(short_channel_id_ptr);
80640         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
80641         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
80642         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80643         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
80644         uint64_t ret_ref = tag_ptr(ret_copy, true);
80645         return ret_ref;
80646 }
80647
80648 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
80649         LDKThirtyTwoBytes payment_id_ref;
80650         CHECK(payment_id->arr_len == 32);
80651         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
80652         LDKThirtyTwoBytes payment_hash_ref;
80653         CHECK(payment_hash->arr_len == 32);
80654         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80655         LDKPath path_conv;
80656         path_conv.inner = untag_ptr(path);
80657         path_conv.is_owned = ptr_is_owned(path);
80658         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
80659         path_conv = Path_clone(&path_conv);
80660         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80661         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
80662         uint64_t ret_ref = tag_ptr(ret_copy, true);
80663         return ret_ref;
80664 }
80665
80666 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) {
80667         LDKThirtyTwoBytes payment_id_ref;
80668         CHECK(payment_id->arr_len == 32);
80669         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
80670         LDKThirtyTwoBytes payment_hash_ref;
80671         CHECK(payment_hash->arr_len == 32);
80672         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80673         LDKPath path_conv;
80674         path_conv.inner = untag_ptr(path);
80675         path_conv.is_owned = ptr_is_owned(path);
80676         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
80677         path_conv = Path_clone(&path_conv);
80678         void* short_channel_id_ptr = untag_ptr(short_channel_id);
80679         CHECK_ACCESS(short_channel_id_ptr);
80680         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
80681         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
80682         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80683         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
80684         uint64_t ret_ref = tag_ptr(ret_copy, true);
80685         return ret_ref;
80686 }
80687
80688 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
80689         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80690         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
80691         uint64_t ret_ref = tag_ptr(ret_copy, true);
80692         return ret_ref;
80693 }
80694
80695 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) {
80696         LDKThirtyTwoBytes intercept_id_ref;
80697         CHECK(intercept_id->arr_len == 32);
80698         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
80699         LDKThirtyTwoBytes payment_hash_ref;
80700         CHECK(payment_hash->arr_len == 32);
80701         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80702         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80703         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
80704         uint64_t ret_ref = tag_ptr(ret_copy, true);
80705         return ret_ref;
80706 }
80707
80708 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs, uint64_t channel_id) {
80709         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
80710         outputs_constr.datalen = outputs->arr_len;
80711         if (outputs_constr.datalen > 0)
80712                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
80713         else
80714                 outputs_constr.data = NULL;
80715         uint64_t* outputs_vals = outputs->elems;
80716         for (size_t b = 0; b < outputs_constr.datalen; b++) {
80717                 uint64_t outputs_conv_27 = outputs_vals[b];
80718                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
80719                 CHECK_ACCESS(outputs_conv_27_ptr);
80720                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
80721                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
80722                 outputs_constr.data[b] = outputs_conv_27_conv;
80723         }
80724         FREE(outputs);
80725         LDKChannelId channel_id_conv;
80726         channel_id_conv.inner = untag_ptr(channel_id);
80727         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80728         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80729         channel_id_conv = ChannelId_clone(&channel_id_conv);
80730         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80731         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
80732         uint64_t ret_ref = tag_ptr(ret_copy, true);
80733         return ret_ref;
80734 }
80735
80736 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 prev_user_channel_id, uint64_t next_user_channel_id, uint64_t total_fee_earned_msat, uint64_t skimmed_fee_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
80737         LDKChannelId prev_channel_id_conv;
80738         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
80739         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
80740         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
80741         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
80742         LDKChannelId next_channel_id_conv;
80743         next_channel_id_conv.inner = untag_ptr(next_channel_id);
80744         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
80745         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
80746         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
80747         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
80748         CHECK_ACCESS(prev_user_channel_id_ptr);
80749         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
80750         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
80751         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
80752         CHECK_ACCESS(next_user_channel_id_ptr);
80753         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
80754         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
80755         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
80756         CHECK_ACCESS(total_fee_earned_msat_ptr);
80757         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
80758         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
80759         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
80760         CHECK_ACCESS(skimmed_fee_msat_ptr);
80761         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
80762         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
80763         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
80764         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
80765         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
80766         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
80767         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80768         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, prev_user_channel_id_conv, next_user_channel_id_conv, total_fee_earned_msat_conv, skimmed_fee_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
80769         uint64_t ret_ref = tag_ptr(ret_copy, true);
80770         return ret_ref;
80771 }
80772
80773 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(uint64_t channel_id, int8_tArray user_channel_id, uint64_t former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo, uint64_t channel_type) {
80774         LDKChannelId channel_id_conv;
80775         channel_id_conv.inner = untag_ptr(channel_id);
80776         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80777         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80778         channel_id_conv = ChannelId_clone(&channel_id_conv);
80779         LDKU128 user_channel_id_ref;
80780         CHECK(user_channel_id->arr_len == 16);
80781         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
80782         LDKChannelId former_temporary_channel_id_conv;
80783         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
80784         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
80785         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
80786         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
80787         LDKPublicKey counterparty_node_id_ref;
80788         CHECK(counterparty_node_id->arr_len == 33);
80789         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80790         LDKOutPoint funding_txo_conv;
80791         funding_txo_conv.inner = untag_ptr(funding_txo);
80792         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
80793         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
80794         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
80795         LDKChannelTypeFeatures channel_type_conv;
80796         channel_type_conv.inner = untag_ptr(channel_type);
80797         channel_type_conv.is_owned = ptr_is_owned(channel_type);
80798         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
80799         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
80800         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80801         *ret_copy = Event_channel_pending(channel_id_conv, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv, channel_type_conv);
80802         uint64_t ret_ref = tag_ptr(ret_copy, true);
80803         return ret_ref;
80804 }
80805
80806 uint64_t  __attribute__((export_name("TS_Event_channel_ready"))) TS_Event_channel_ready(uint64_t channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, uint64_t channel_type) {
80807         LDKChannelId channel_id_conv;
80808         channel_id_conv.inner = untag_ptr(channel_id);
80809         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80810         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80811         channel_id_conv = ChannelId_clone(&channel_id_conv);
80812         LDKU128 user_channel_id_ref;
80813         CHECK(user_channel_id->arr_len == 16);
80814         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
80815         LDKPublicKey counterparty_node_id_ref;
80816         CHECK(counterparty_node_id->arr_len == 33);
80817         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80818         LDKChannelTypeFeatures channel_type_conv;
80819         channel_type_conv.inner = untag_ptr(channel_type);
80820         channel_type_conv.is_owned = ptr_is_owned(channel_type);
80821         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
80822         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
80823         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80824         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
80825         uint64_t ret_ref = tag_ptr(ret_copy, true);
80826         return ret_ref;
80827 }
80828
80829 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(uint64_t 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) {
80830         LDKChannelId channel_id_conv;
80831         channel_id_conv.inner = untag_ptr(channel_id);
80832         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80833         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80834         channel_id_conv = ChannelId_clone(&channel_id_conv);
80835         LDKU128 user_channel_id_ref;
80836         CHECK(user_channel_id->arr_len == 16);
80837         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
80838         void* reason_ptr = untag_ptr(reason);
80839         CHECK_ACCESS(reason_ptr);
80840         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
80841         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
80842         LDKPublicKey counterparty_node_id_ref;
80843         CHECK(counterparty_node_id->arr_len == 33);
80844         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80845         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
80846         CHECK_ACCESS(channel_capacity_sats_ptr);
80847         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
80848         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
80849         LDKOutPoint channel_funding_txo_conv;
80850         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
80851         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
80852         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
80853         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
80854         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80855         *ret_copy = Event_channel_closed(channel_id_conv, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
80856         uint64_t ret_ref = tag_ptr(ret_copy, true);
80857         return ret_ref;
80858 }
80859
80860 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(uint64_t channel_id, int8_tArray transaction) {
80861         LDKChannelId channel_id_conv;
80862         channel_id_conv.inner = untag_ptr(channel_id);
80863         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80864         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80865         channel_id_conv = ChannelId_clone(&channel_id_conv);
80866         LDKTransaction transaction_ref;
80867         transaction_ref.datalen = transaction->arr_len;
80868         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
80869         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
80870         transaction_ref.data_is_owned = true;
80871         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80872         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
80873         uint64_t ret_ref = tag_ptr(ret_copy, true);
80874         return ret_ref;
80875 }
80876
80877 uint64_t  __attribute__((export_name("TS_Event_open_channel_request"))) TS_Event_open_channel_request(uint64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, uint64_t channel_type) {
80878         LDKChannelId temporary_channel_id_conv;
80879         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
80880         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
80881         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
80882         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
80883         LDKPublicKey counterparty_node_id_ref;
80884         CHECK(counterparty_node_id->arr_len == 33);
80885         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80886         LDKChannelTypeFeatures channel_type_conv;
80887         channel_type_conv.inner = untag_ptr(channel_type);
80888         channel_type_conv.is_owned = ptr_is_owned(channel_type);
80889         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
80890         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
80891         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80892         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
80893         uint64_t ret_ref = tag_ptr(ret_copy, true);
80894         return ret_ref;
80895 }
80896
80897 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(uint64_t prev_channel_id, uint64_t failed_next_destination) {
80898         LDKChannelId prev_channel_id_conv;
80899         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
80900         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
80901         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
80902         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
80903         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
80904         CHECK_ACCESS(failed_next_destination_ptr);
80905         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
80906         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
80907         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80908         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
80909         uint64_t ret_ref = tag_ptr(ret_copy, true);
80910         return ret_ref;
80911 }
80912
80913 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
80914         void* a_ptr = untag_ptr(a);
80915         CHECK_ACCESS(a_ptr);
80916         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
80917         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
80918         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80919         *ret_copy = Event_bump_transaction(a_conv);
80920         uint64_t ret_ref = tag_ptr(ret_copy, true);
80921         return ret_ref;
80922 }
80923
80924 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
80925         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
80926         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
80927         jboolean ret_conv = Event_eq(a_conv, b_conv);
80928         return ret_conv;
80929 }
80930
80931 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
80932         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
80933         LDKCVec_u8Z ret_var = Event_write(obj_conv);
80934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80936         CVec_u8Z_free(ret_var);
80937         return ret_arr;
80938 }
80939
80940 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
80941         LDKu8slice ser_ref;
80942         ser_ref.datalen = ser->arr_len;
80943         ser_ref.data = ser->elems;
80944         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
80945         *ret_conv = Event_read(ser_ref);
80946         FREE(ser);
80947         return tag_ptr(ret_conv, true);
80948 }
80949
80950 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
80951         if (!ptr_is_owned(this_ptr)) return;
80952         void* this_ptr_ptr = untag_ptr(this_ptr);
80953         CHECK_ACCESS(this_ptr_ptr);
80954         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
80955         FREE(untag_ptr(this_ptr));
80956         MessageSendEvent_free(this_ptr_conv);
80957 }
80958
80959 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
80960         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80961         *ret_copy = MessageSendEvent_clone(arg);
80962         uint64_t ret_ref = tag_ptr(ret_copy, true);
80963         return ret_ref;
80964 }
80965 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
80966         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
80967         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
80968         return ret_conv;
80969 }
80970
80971 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
80972         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
80973         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80974         *ret_copy = MessageSendEvent_clone(orig_conv);
80975         uint64_t ret_ref = tag_ptr(ret_copy, true);
80976         return ret_ref;
80977 }
80978
80979 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
80980         LDKPublicKey node_id_ref;
80981         CHECK(node_id->arr_len == 33);
80982         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80983         LDKAcceptChannel msg_conv;
80984         msg_conv.inner = untag_ptr(msg);
80985         msg_conv.is_owned = ptr_is_owned(msg);
80986         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80987         msg_conv = AcceptChannel_clone(&msg_conv);
80988         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80989         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
80990         uint64_t ret_ref = tag_ptr(ret_copy, true);
80991         return ret_ref;
80992 }
80993
80994 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
80995         LDKPublicKey node_id_ref;
80996         CHECK(node_id->arr_len == 33);
80997         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80998         LDKAcceptChannelV2 msg_conv;
80999         msg_conv.inner = untag_ptr(msg);
81000         msg_conv.is_owned = ptr_is_owned(msg);
81001         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81002         msg_conv = AcceptChannelV2_clone(&msg_conv);
81003         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81004         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
81005         uint64_t ret_ref = tag_ptr(ret_copy, true);
81006         return ret_ref;
81007 }
81008
81009 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
81010         LDKPublicKey node_id_ref;
81011         CHECK(node_id->arr_len == 33);
81012         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81013         LDKOpenChannel msg_conv;
81014         msg_conv.inner = untag_ptr(msg);
81015         msg_conv.is_owned = ptr_is_owned(msg);
81016         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81017         msg_conv = OpenChannel_clone(&msg_conv);
81018         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81019         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
81020         uint64_t ret_ref = tag_ptr(ret_copy, true);
81021         return ret_ref;
81022 }
81023
81024 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
81025         LDKPublicKey node_id_ref;
81026         CHECK(node_id->arr_len == 33);
81027         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81028         LDKOpenChannelV2 msg_conv;
81029         msg_conv.inner = untag_ptr(msg);
81030         msg_conv.is_owned = ptr_is_owned(msg);
81031         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81032         msg_conv = OpenChannelV2_clone(&msg_conv);
81033         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81034         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
81035         uint64_t ret_ref = tag_ptr(ret_copy, true);
81036         return ret_ref;
81037 }
81038
81039 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
81040         LDKPublicKey node_id_ref;
81041         CHECK(node_id->arr_len == 33);
81042         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81043         LDKFundingCreated msg_conv;
81044         msg_conv.inner = untag_ptr(msg);
81045         msg_conv.is_owned = ptr_is_owned(msg);
81046         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81047         msg_conv = FundingCreated_clone(&msg_conv);
81048         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81049         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
81050         uint64_t ret_ref = tag_ptr(ret_copy, true);
81051         return ret_ref;
81052 }
81053
81054 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
81055         LDKPublicKey node_id_ref;
81056         CHECK(node_id->arr_len == 33);
81057         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81058         LDKFundingSigned msg_conv;
81059         msg_conv.inner = untag_ptr(msg);
81060         msg_conv.is_owned = ptr_is_owned(msg);
81061         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81062         msg_conv = FundingSigned_clone(&msg_conv);
81063         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81064         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
81065         uint64_t ret_ref = tag_ptr(ret_copy, true);
81066         return ret_ref;
81067 }
81068
81069 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_stfu"))) TS_MessageSendEvent_send_stfu(int8_tArray node_id, uint64_t msg) {
81070         LDKPublicKey node_id_ref;
81071         CHECK(node_id->arr_len == 33);
81072         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81073         LDKStfu msg_conv;
81074         msg_conv.inner = untag_ptr(msg);
81075         msg_conv.is_owned = ptr_is_owned(msg);
81076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81077         msg_conv = Stfu_clone(&msg_conv);
81078         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81079         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
81080         uint64_t ret_ref = tag_ptr(ret_copy, true);
81081         return ret_ref;
81082 }
81083
81084 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice"))) TS_MessageSendEvent_send_splice(int8_tArray node_id, uint64_t msg) {
81085         LDKPublicKey node_id_ref;
81086         CHECK(node_id->arr_len == 33);
81087         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81088         LDKSplice msg_conv;
81089         msg_conv.inner = untag_ptr(msg);
81090         msg_conv.is_owned = ptr_is_owned(msg);
81091         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81092         msg_conv = Splice_clone(&msg_conv);
81093         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81094         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
81095         uint64_t ret_ref = tag_ptr(ret_copy, true);
81096         return ret_ref;
81097 }
81098
81099 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_ack"))) TS_MessageSendEvent_send_splice_ack(int8_tArray node_id, uint64_t msg) {
81100         LDKPublicKey node_id_ref;
81101         CHECK(node_id->arr_len == 33);
81102         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81103         LDKSpliceAck msg_conv;
81104         msg_conv.inner = untag_ptr(msg);
81105         msg_conv.is_owned = ptr_is_owned(msg);
81106         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81107         msg_conv = SpliceAck_clone(&msg_conv);
81108         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81109         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
81110         uint64_t ret_ref = tag_ptr(ret_copy, true);
81111         return ret_ref;
81112 }
81113
81114 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_splice_locked"))) TS_MessageSendEvent_send_splice_locked(int8_tArray node_id, uint64_t msg) {
81115         LDKPublicKey node_id_ref;
81116         CHECK(node_id->arr_len == 33);
81117         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81118         LDKSpliceLocked msg_conv;
81119         msg_conv.inner = untag_ptr(msg);
81120         msg_conv.is_owned = ptr_is_owned(msg);
81121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81122         msg_conv = SpliceLocked_clone(&msg_conv);
81123         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81124         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
81125         uint64_t ret_ref = tag_ptr(ret_copy, true);
81126         return ret_ref;
81127 }
81128
81129 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
81130         LDKPublicKey node_id_ref;
81131         CHECK(node_id->arr_len == 33);
81132         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81133         LDKTxAddInput msg_conv;
81134         msg_conv.inner = untag_ptr(msg);
81135         msg_conv.is_owned = ptr_is_owned(msg);
81136         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81137         msg_conv = TxAddInput_clone(&msg_conv);
81138         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81139         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
81140         uint64_t ret_ref = tag_ptr(ret_copy, true);
81141         return ret_ref;
81142 }
81143
81144 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
81145         LDKPublicKey node_id_ref;
81146         CHECK(node_id->arr_len == 33);
81147         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81148         LDKTxAddOutput msg_conv;
81149         msg_conv.inner = untag_ptr(msg);
81150         msg_conv.is_owned = ptr_is_owned(msg);
81151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81152         msg_conv = TxAddOutput_clone(&msg_conv);
81153         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81154         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
81155         uint64_t ret_ref = tag_ptr(ret_copy, true);
81156         return ret_ref;
81157 }
81158
81159 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
81160         LDKPublicKey node_id_ref;
81161         CHECK(node_id->arr_len == 33);
81162         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81163         LDKTxRemoveInput msg_conv;
81164         msg_conv.inner = untag_ptr(msg);
81165         msg_conv.is_owned = ptr_is_owned(msg);
81166         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81167         msg_conv = TxRemoveInput_clone(&msg_conv);
81168         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81169         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
81170         uint64_t ret_ref = tag_ptr(ret_copy, true);
81171         return ret_ref;
81172 }
81173
81174 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
81175         LDKPublicKey node_id_ref;
81176         CHECK(node_id->arr_len == 33);
81177         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81178         LDKTxRemoveOutput msg_conv;
81179         msg_conv.inner = untag_ptr(msg);
81180         msg_conv.is_owned = ptr_is_owned(msg);
81181         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81182         msg_conv = TxRemoveOutput_clone(&msg_conv);
81183         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81184         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
81185         uint64_t ret_ref = tag_ptr(ret_copy, true);
81186         return ret_ref;
81187 }
81188
81189 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
81190         LDKPublicKey node_id_ref;
81191         CHECK(node_id->arr_len == 33);
81192         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81193         LDKTxComplete msg_conv;
81194         msg_conv.inner = untag_ptr(msg);
81195         msg_conv.is_owned = ptr_is_owned(msg);
81196         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81197         msg_conv = TxComplete_clone(&msg_conv);
81198         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81199         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
81200         uint64_t ret_ref = tag_ptr(ret_copy, true);
81201         return ret_ref;
81202 }
81203
81204 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
81205         LDKPublicKey node_id_ref;
81206         CHECK(node_id->arr_len == 33);
81207         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81208         LDKTxSignatures msg_conv;
81209         msg_conv.inner = untag_ptr(msg);
81210         msg_conv.is_owned = ptr_is_owned(msg);
81211         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81212         msg_conv = TxSignatures_clone(&msg_conv);
81213         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81214         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
81215         uint64_t ret_ref = tag_ptr(ret_copy, true);
81216         return ret_ref;
81217 }
81218
81219 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
81220         LDKPublicKey node_id_ref;
81221         CHECK(node_id->arr_len == 33);
81222         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81223         LDKTxInitRbf msg_conv;
81224         msg_conv.inner = untag_ptr(msg);
81225         msg_conv.is_owned = ptr_is_owned(msg);
81226         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81227         msg_conv = TxInitRbf_clone(&msg_conv);
81228         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81229         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
81230         uint64_t ret_ref = tag_ptr(ret_copy, true);
81231         return ret_ref;
81232 }
81233
81234 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
81235         LDKPublicKey node_id_ref;
81236         CHECK(node_id->arr_len == 33);
81237         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81238         LDKTxAckRbf msg_conv;
81239         msg_conv.inner = untag_ptr(msg);
81240         msg_conv.is_owned = ptr_is_owned(msg);
81241         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81242         msg_conv = TxAckRbf_clone(&msg_conv);
81243         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81244         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
81245         uint64_t ret_ref = tag_ptr(ret_copy, true);
81246         return ret_ref;
81247 }
81248
81249 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
81250         LDKPublicKey node_id_ref;
81251         CHECK(node_id->arr_len == 33);
81252         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81253         LDKTxAbort msg_conv;
81254         msg_conv.inner = untag_ptr(msg);
81255         msg_conv.is_owned = ptr_is_owned(msg);
81256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81257         msg_conv = TxAbort_clone(&msg_conv);
81258         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81259         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
81260         uint64_t ret_ref = tag_ptr(ret_copy, true);
81261         return ret_ref;
81262 }
81263
81264 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
81265         LDKPublicKey node_id_ref;
81266         CHECK(node_id->arr_len == 33);
81267         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81268         LDKChannelReady msg_conv;
81269         msg_conv.inner = untag_ptr(msg);
81270         msg_conv.is_owned = ptr_is_owned(msg);
81271         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81272         msg_conv = ChannelReady_clone(&msg_conv);
81273         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81274         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
81275         uint64_t ret_ref = tag_ptr(ret_copy, true);
81276         return ret_ref;
81277 }
81278
81279 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
81280         LDKPublicKey node_id_ref;
81281         CHECK(node_id->arr_len == 33);
81282         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81283         LDKAnnouncementSignatures msg_conv;
81284         msg_conv.inner = untag_ptr(msg);
81285         msg_conv.is_owned = ptr_is_owned(msg);
81286         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81287         msg_conv = AnnouncementSignatures_clone(&msg_conv);
81288         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81289         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
81290         uint64_t ret_ref = tag_ptr(ret_copy, true);
81291         return ret_ref;
81292 }
81293
81294 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
81295         LDKPublicKey node_id_ref;
81296         CHECK(node_id->arr_len == 33);
81297         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81298         LDKCommitmentUpdate updates_conv;
81299         updates_conv.inner = untag_ptr(updates);
81300         updates_conv.is_owned = ptr_is_owned(updates);
81301         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
81302         updates_conv = CommitmentUpdate_clone(&updates_conv);
81303         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81304         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
81305         uint64_t ret_ref = tag_ptr(ret_copy, true);
81306         return ret_ref;
81307 }
81308
81309 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
81310         LDKPublicKey node_id_ref;
81311         CHECK(node_id->arr_len == 33);
81312         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81313         LDKRevokeAndACK msg_conv;
81314         msg_conv.inner = untag_ptr(msg);
81315         msg_conv.is_owned = ptr_is_owned(msg);
81316         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81317         msg_conv = RevokeAndACK_clone(&msg_conv);
81318         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81319         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
81320         uint64_t ret_ref = tag_ptr(ret_copy, true);
81321         return ret_ref;
81322 }
81323
81324 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
81325         LDKPublicKey node_id_ref;
81326         CHECK(node_id->arr_len == 33);
81327         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81328         LDKClosingSigned msg_conv;
81329         msg_conv.inner = untag_ptr(msg);
81330         msg_conv.is_owned = ptr_is_owned(msg);
81331         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81332         msg_conv = ClosingSigned_clone(&msg_conv);
81333         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81334         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
81335         uint64_t ret_ref = tag_ptr(ret_copy, true);
81336         return ret_ref;
81337 }
81338
81339 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
81340         LDKPublicKey node_id_ref;
81341         CHECK(node_id->arr_len == 33);
81342         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81343         LDKShutdown msg_conv;
81344         msg_conv.inner = untag_ptr(msg);
81345         msg_conv.is_owned = ptr_is_owned(msg);
81346         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81347         msg_conv = Shutdown_clone(&msg_conv);
81348         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81349         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
81350         uint64_t ret_ref = tag_ptr(ret_copy, true);
81351         return ret_ref;
81352 }
81353
81354 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
81355         LDKPublicKey node_id_ref;
81356         CHECK(node_id->arr_len == 33);
81357         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81358         LDKChannelReestablish msg_conv;
81359         msg_conv.inner = untag_ptr(msg);
81360         msg_conv.is_owned = ptr_is_owned(msg);
81361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81362         msg_conv = ChannelReestablish_clone(&msg_conv);
81363         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81364         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
81365         uint64_t ret_ref = tag_ptr(ret_copy, true);
81366         return ret_ref;
81367 }
81368
81369 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) {
81370         LDKPublicKey node_id_ref;
81371         CHECK(node_id->arr_len == 33);
81372         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81373         LDKChannelAnnouncement msg_conv;
81374         msg_conv.inner = untag_ptr(msg);
81375         msg_conv.is_owned = ptr_is_owned(msg);
81376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81377         msg_conv = ChannelAnnouncement_clone(&msg_conv);
81378         LDKChannelUpdate update_msg_conv;
81379         update_msg_conv.inner = untag_ptr(update_msg);
81380         update_msg_conv.is_owned = ptr_is_owned(update_msg);
81381         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
81382         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
81383         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81384         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
81385         uint64_t ret_ref = tag_ptr(ret_copy, true);
81386         return ret_ref;
81387 }
81388
81389 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
81390         LDKChannelAnnouncement msg_conv;
81391         msg_conv.inner = untag_ptr(msg);
81392         msg_conv.is_owned = ptr_is_owned(msg);
81393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81394         msg_conv = ChannelAnnouncement_clone(&msg_conv);
81395         LDKChannelUpdate update_msg_conv;
81396         update_msg_conv.inner = untag_ptr(update_msg);
81397         update_msg_conv.is_owned = ptr_is_owned(update_msg);
81398         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
81399         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
81400         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81401         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
81402         uint64_t ret_ref = tag_ptr(ret_copy, true);
81403         return ret_ref;
81404 }
81405
81406 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
81407         LDKChannelUpdate msg_conv;
81408         msg_conv.inner = untag_ptr(msg);
81409         msg_conv.is_owned = ptr_is_owned(msg);
81410         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81411         msg_conv = ChannelUpdate_clone(&msg_conv);
81412         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81413         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
81414         uint64_t ret_ref = tag_ptr(ret_copy, true);
81415         return ret_ref;
81416 }
81417
81418 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
81419         LDKNodeAnnouncement msg_conv;
81420         msg_conv.inner = untag_ptr(msg);
81421         msg_conv.is_owned = ptr_is_owned(msg);
81422         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81423         msg_conv = NodeAnnouncement_clone(&msg_conv);
81424         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81425         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
81426         uint64_t ret_ref = tag_ptr(ret_copy, true);
81427         return ret_ref;
81428 }
81429
81430 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
81431         LDKPublicKey node_id_ref;
81432         CHECK(node_id->arr_len == 33);
81433         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81434         LDKChannelUpdate msg_conv;
81435         msg_conv.inner = untag_ptr(msg);
81436         msg_conv.is_owned = ptr_is_owned(msg);
81437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81438         msg_conv = ChannelUpdate_clone(&msg_conv);
81439         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81440         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
81441         uint64_t ret_ref = tag_ptr(ret_copy, true);
81442         return ret_ref;
81443 }
81444
81445 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
81446         LDKPublicKey node_id_ref;
81447         CHECK(node_id->arr_len == 33);
81448         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81449         void* action_ptr = untag_ptr(action);
81450         CHECK_ACCESS(action_ptr);
81451         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
81452         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
81453         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81454         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
81455         uint64_t ret_ref = tag_ptr(ret_copy, true);
81456         return ret_ref;
81457 }
81458
81459 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
81460         LDKPublicKey node_id_ref;
81461         CHECK(node_id->arr_len == 33);
81462         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81463         LDKQueryChannelRange msg_conv;
81464         msg_conv.inner = untag_ptr(msg);
81465         msg_conv.is_owned = ptr_is_owned(msg);
81466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81467         msg_conv = QueryChannelRange_clone(&msg_conv);
81468         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81469         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
81470         uint64_t ret_ref = tag_ptr(ret_copy, true);
81471         return ret_ref;
81472 }
81473
81474 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
81475         LDKPublicKey node_id_ref;
81476         CHECK(node_id->arr_len == 33);
81477         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81478         LDKQueryShortChannelIds msg_conv;
81479         msg_conv.inner = untag_ptr(msg);
81480         msg_conv.is_owned = ptr_is_owned(msg);
81481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81482         msg_conv = QueryShortChannelIds_clone(&msg_conv);
81483         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81484         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
81485         uint64_t ret_ref = tag_ptr(ret_copy, true);
81486         return ret_ref;
81487 }
81488
81489 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
81490         LDKPublicKey node_id_ref;
81491         CHECK(node_id->arr_len == 33);
81492         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81493         LDKReplyChannelRange msg_conv;
81494         msg_conv.inner = untag_ptr(msg);
81495         msg_conv.is_owned = ptr_is_owned(msg);
81496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81497         msg_conv = ReplyChannelRange_clone(&msg_conv);
81498         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81499         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
81500         uint64_t ret_ref = tag_ptr(ret_copy, true);
81501         return ret_ref;
81502 }
81503
81504 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
81505         LDKPublicKey node_id_ref;
81506         CHECK(node_id->arr_len == 33);
81507         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81508         LDKGossipTimestampFilter msg_conv;
81509         msg_conv.inner = untag_ptr(msg);
81510         msg_conv.is_owned = ptr_is_owned(msg);
81511         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81512         msg_conv = GossipTimestampFilter_clone(&msg_conv);
81513         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81514         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
81515         uint64_t ret_ref = tag_ptr(ret_copy, true);
81516         return ret_ref;
81517 }
81518
81519 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
81520         if (!ptr_is_owned(this_ptr)) return;
81521         void* this_ptr_ptr = untag_ptr(this_ptr);
81522         CHECK_ACCESS(this_ptr_ptr);
81523         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
81524         FREE(untag_ptr(this_ptr));
81525         MessageSendEventsProvider_free(this_ptr_conv);
81526 }
81527
81528 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
81529         if (!ptr_is_owned(this_ptr)) return;
81530         void* this_ptr_ptr = untag_ptr(this_ptr);
81531         CHECK_ACCESS(this_ptr_ptr);
81532         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
81533         FREE(untag_ptr(this_ptr));
81534         EventsProvider_free(this_ptr_conv);
81535 }
81536
81537 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
81538         if (!ptr_is_owned(this_ptr)) return;
81539         void* this_ptr_ptr = untag_ptr(this_ptr);
81540         CHECK_ACCESS(this_ptr_ptr);
81541         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
81542         FREE(untag_ptr(this_ptr));
81543         EventHandler_free(this_ptr_conv);
81544 }
81545
81546 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
81547         LDKAnchorDescriptor this_obj_conv;
81548         this_obj_conv.inner = untag_ptr(this_obj);
81549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81551         AnchorDescriptor_free(this_obj_conv);
81552 }
81553
81554 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
81555         LDKAnchorDescriptor this_ptr_conv;
81556         this_ptr_conv.inner = untag_ptr(this_ptr);
81557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81559         this_ptr_conv.is_owned = false;
81560         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
81561         uint64_t ret_ref = 0;
81562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81564         return ret_ref;
81565 }
81566
81567 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
81568         LDKAnchorDescriptor this_ptr_conv;
81569         this_ptr_conv.inner = untag_ptr(this_ptr);
81570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81572         this_ptr_conv.is_owned = false;
81573         LDKChannelDerivationParameters val_conv;
81574         val_conv.inner = untag_ptr(val);
81575         val_conv.is_owned = ptr_is_owned(val);
81576         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81577         val_conv = ChannelDerivationParameters_clone(&val_conv);
81578         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
81579 }
81580
81581 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
81582         LDKAnchorDescriptor this_ptr_conv;
81583         this_ptr_conv.inner = untag_ptr(this_ptr);
81584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81586         this_ptr_conv.is_owned = false;
81587         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
81588         uint64_t ret_ref = 0;
81589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81591         return ret_ref;
81592 }
81593
81594 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
81595         LDKAnchorDescriptor this_ptr_conv;
81596         this_ptr_conv.inner = untag_ptr(this_ptr);
81597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81599         this_ptr_conv.is_owned = false;
81600         LDKOutPoint val_conv;
81601         val_conv.inner = untag_ptr(val);
81602         val_conv.is_owned = ptr_is_owned(val);
81603         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81604         val_conv = OutPoint_clone(&val_conv);
81605         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
81606 }
81607
81608 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
81609         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
81610         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
81611         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
81612         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
81613         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
81614         LDKOutPoint outpoint_arg_conv;
81615         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
81616         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
81617         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
81618         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
81619         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
81620         uint64_t ret_ref = 0;
81621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81623         return ret_ref;
81624 }
81625
81626 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
81627         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
81628         uint64_t ret_ref = 0;
81629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81631         return ret_ref;
81632 }
81633 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
81634         LDKAnchorDescriptor arg_conv;
81635         arg_conv.inner = untag_ptr(arg);
81636         arg_conv.is_owned = ptr_is_owned(arg);
81637         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81638         arg_conv.is_owned = false;
81639         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
81640         return ret_conv;
81641 }
81642
81643 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
81644         LDKAnchorDescriptor orig_conv;
81645         orig_conv.inner = untag_ptr(orig);
81646         orig_conv.is_owned = ptr_is_owned(orig);
81647         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81648         orig_conv.is_owned = false;
81649         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
81650         uint64_t ret_ref = 0;
81651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81653         return ret_ref;
81654 }
81655
81656 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
81657         LDKAnchorDescriptor a_conv;
81658         a_conv.inner = untag_ptr(a);
81659         a_conv.is_owned = ptr_is_owned(a);
81660         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81661         a_conv.is_owned = false;
81662         LDKAnchorDescriptor b_conv;
81663         b_conv.inner = untag_ptr(b);
81664         b_conv.is_owned = ptr_is_owned(b);
81665         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81666         b_conv.is_owned = false;
81667         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
81668         return ret_conv;
81669 }
81670
81671 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
81672         LDKAnchorDescriptor this_arg_conv;
81673         this_arg_conv.inner = untag_ptr(this_arg);
81674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81676         this_arg_conv.is_owned = false;
81677         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
81678         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
81679         return tag_ptr(ret_ref, true);
81680 }
81681
81682 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
81683         LDKAnchorDescriptor this_arg_conv;
81684         this_arg_conv.inner = untag_ptr(this_arg);
81685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81687         this_arg_conv.is_owned = false;
81688         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
81689         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
81690         return tag_ptr(ret_ref, true);
81691 }
81692
81693 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
81694         LDKAnchorDescriptor this_arg_conv;
81695         this_arg_conv.inner = untag_ptr(this_arg);
81696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81698         this_arg_conv.is_owned = false;
81699         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
81700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
81701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
81702         CVec_u8Z_free(ret_var);
81703         return ret_arr;
81704 }
81705
81706 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
81707         LDKAnchorDescriptor this_arg_conv;
81708         this_arg_conv.inner = untag_ptr(this_arg);
81709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81711         this_arg_conv.is_owned = false;
81712         LDKECDSASignature signature_ref;
81713         CHECK(signature->arr_len == 64);
81714         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
81715         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
81716         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
81717         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
81718         Witness_free(ret_var);
81719         return ret_arr;
81720 }
81721
81722 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
81723         LDKAnchorDescriptor this_arg_conv;
81724         this_arg_conv.inner = untag_ptr(this_arg);
81725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81727         this_arg_conv.is_owned = false;
81728         void* signer_provider_ptr = untag_ptr(signer_provider);
81729         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
81730         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
81731         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81732         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
81733         return tag_ptr(ret_ret, true);
81734 }
81735
81736 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
81737         if (!ptr_is_owned(this_ptr)) return;
81738         void* this_ptr_ptr = untag_ptr(this_ptr);
81739         CHECK_ACCESS(this_ptr_ptr);
81740         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
81741         FREE(untag_ptr(this_ptr));
81742         BumpTransactionEvent_free(this_ptr_conv);
81743 }
81744
81745 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
81746         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
81747         *ret_copy = BumpTransactionEvent_clone(arg);
81748         uint64_t ret_ref = tag_ptr(ret_copy, true);
81749         return ret_ref;
81750 }
81751 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
81752         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
81753         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
81754         return ret_conv;
81755 }
81756
81757 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
81758         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
81759         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
81760         *ret_copy = BumpTransactionEvent_clone(orig_conv);
81761         uint64_t ret_ref = tag_ptr(ret_copy, true);
81762         return ret_ref;
81763 }
81764
81765 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_channel_close"))) TS_BumpTransactionEvent_channel_close(uint64_t channel_id, int8_tArray counterparty_node_id, 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) {
81766         LDKChannelId channel_id_conv;
81767         channel_id_conv.inner = untag_ptr(channel_id);
81768         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81769         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81770         channel_id_conv = ChannelId_clone(&channel_id_conv);
81771         LDKPublicKey counterparty_node_id_ref;
81772         CHECK(counterparty_node_id->arr_len == 33);
81773         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
81774         LDKThirtyTwoBytes claim_id_ref;
81775         CHECK(claim_id->arr_len == 32);
81776         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
81777         LDKTransaction commitment_tx_ref;
81778         commitment_tx_ref.datalen = commitment_tx->arr_len;
81779         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
81780         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
81781         commitment_tx_ref.data_is_owned = true;
81782         LDKAnchorDescriptor anchor_descriptor_conv;
81783         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
81784         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
81785         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
81786         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
81787         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
81788         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
81789         if (pending_htlcs_constr.datalen > 0)
81790                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
81791         else
81792                 pending_htlcs_constr.data = NULL;
81793         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
81794         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
81795                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
81796                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
81797                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
81798                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
81799                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
81800                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
81801                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
81802         }
81803         FREE(pending_htlcs);
81804         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
81805         *ret_copy = BumpTransactionEvent_channel_close(channel_id_conv, counterparty_node_id_ref, claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
81806         uint64_t ret_ref = tag_ptr(ret_copy, true);
81807         return ret_ref;
81808 }
81809
81810 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_htlcresolution"))) TS_BumpTransactionEvent_htlcresolution(uint64_t channel_id, int8_tArray counterparty_node_id, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, uint64_tArray htlc_descriptors, int32_t tx_lock_time) {
81811         LDKChannelId channel_id_conv;
81812         channel_id_conv.inner = untag_ptr(channel_id);
81813         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81814         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81815         channel_id_conv = ChannelId_clone(&channel_id_conv);
81816         LDKPublicKey counterparty_node_id_ref;
81817         CHECK(counterparty_node_id->arr_len == 33);
81818         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
81819         LDKThirtyTwoBytes claim_id_ref;
81820         CHECK(claim_id->arr_len == 32);
81821         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
81822         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
81823         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
81824         if (htlc_descriptors_constr.datalen > 0)
81825                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
81826         else
81827                 htlc_descriptors_constr.data = NULL;
81828         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
81829         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
81830                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
81831                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
81832                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
81833                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
81834                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
81835                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
81836                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
81837         }
81838         FREE(htlc_descriptors);
81839         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
81840         *ret_copy = BumpTransactionEvent_htlcresolution(channel_id_conv, counterparty_node_id_ref, claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
81841         uint64_t ret_ref = tag_ptr(ret_copy, true);
81842         return ret_ref;
81843 }
81844
81845 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
81846         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
81847         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
81848         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
81849         return ret_conv;
81850 }
81851
81852 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
81853         LDKInput this_obj_conv;
81854         this_obj_conv.inner = untag_ptr(this_obj);
81855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81857         Input_free(this_obj_conv);
81858 }
81859
81860 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
81861         LDKInput this_ptr_conv;
81862         this_ptr_conv.inner = untag_ptr(this_ptr);
81863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81865         this_ptr_conv.is_owned = false;
81866         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
81867         uint64_t ret_ref = 0;
81868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81870         return ret_ref;
81871 }
81872
81873 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
81874         LDKInput this_ptr_conv;
81875         this_ptr_conv.inner = untag_ptr(this_ptr);
81876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81878         this_ptr_conv.is_owned = false;
81879         LDKOutPoint val_conv;
81880         val_conv.inner = untag_ptr(val);
81881         val_conv.is_owned = ptr_is_owned(val);
81882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81883         val_conv = OutPoint_clone(&val_conv);
81884         Input_set_outpoint(&this_ptr_conv, val_conv);
81885 }
81886
81887 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
81888         LDKInput this_ptr_conv;
81889         this_ptr_conv.inner = untag_ptr(this_ptr);
81890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81892         this_ptr_conv.is_owned = false;
81893         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
81894         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
81895         return tag_ptr(ret_ref, true);
81896 }
81897
81898 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
81899         LDKInput this_ptr_conv;
81900         this_ptr_conv.inner = untag_ptr(this_ptr);
81901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81903         this_ptr_conv.is_owned = false;
81904         void* val_ptr = untag_ptr(val);
81905         CHECK_ACCESS(val_ptr);
81906         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
81907         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
81908         Input_set_previous_utxo(&this_ptr_conv, val_conv);
81909 }
81910
81911 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
81912         LDKInput this_ptr_conv;
81913         this_ptr_conv.inner = untag_ptr(this_ptr);
81914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81916         this_ptr_conv.is_owned = false;
81917         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
81918         return ret_conv;
81919 }
81920
81921 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
81922         LDKInput this_ptr_conv;
81923         this_ptr_conv.inner = untag_ptr(this_ptr);
81924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81926         this_ptr_conv.is_owned = false;
81927         Input_set_satisfaction_weight(&this_ptr_conv, val);
81928 }
81929
81930 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) {
81931         LDKOutPoint outpoint_arg_conv;
81932         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
81933         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
81934         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
81935         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
81936         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
81937         CHECK_ACCESS(previous_utxo_arg_ptr);
81938         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
81939         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
81940         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
81941         uint64_t ret_ref = 0;
81942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81944         return ret_ref;
81945 }
81946
81947 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
81948         LDKInput ret_var = Input_clone(arg);
81949         uint64_t ret_ref = 0;
81950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81952         return ret_ref;
81953 }
81954 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
81955         LDKInput arg_conv;
81956         arg_conv.inner = untag_ptr(arg);
81957         arg_conv.is_owned = ptr_is_owned(arg);
81958         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81959         arg_conv.is_owned = false;
81960         int64_t ret_conv = Input_clone_ptr(&arg_conv);
81961         return ret_conv;
81962 }
81963
81964 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
81965         LDKInput orig_conv;
81966         orig_conv.inner = untag_ptr(orig);
81967         orig_conv.is_owned = ptr_is_owned(orig);
81968         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81969         orig_conv.is_owned = false;
81970         LDKInput ret_var = Input_clone(&orig_conv);
81971         uint64_t ret_ref = 0;
81972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81974         return ret_ref;
81975 }
81976
81977 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
81978         LDKInput o_conv;
81979         o_conv.inner = untag_ptr(o);
81980         o_conv.is_owned = ptr_is_owned(o);
81981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81982         o_conv.is_owned = false;
81983         int64_t ret_conv = Input_hash(&o_conv);
81984         return ret_conv;
81985 }
81986
81987 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
81988         LDKInput a_conv;
81989         a_conv.inner = untag_ptr(a);
81990         a_conv.is_owned = ptr_is_owned(a);
81991         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81992         a_conv.is_owned = false;
81993         LDKInput b_conv;
81994         b_conv.inner = untag_ptr(b);
81995         b_conv.is_owned = ptr_is_owned(b);
81996         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81997         b_conv.is_owned = false;
81998         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
81999         return ret_conv;
82000 }
82001
82002 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
82003         LDKUtxo this_obj_conv;
82004         this_obj_conv.inner = untag_ptr(this_obj);
82005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82007         Utxo_free(this_obj_conv);
82008 }
82009
82010 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
82011         LDKUtxo this_ptr_conv;
82012         this_ptr_conv.inner = untag_ptr(this_ptr);
82013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82015         this_ptr_conv.is_owned = false;
82016         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
82017         uint64_t ret_ref = 0;
82018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82020         return ret_ref;
82021 }
82022
82023 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
82024         LDKUtxo this_ptr_conv;
82025         this_ptr_conv.inner = untag_ptr(this_ptr);
82026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82028         this_ptr_conv.is_owned = false;
82029         LDKOutPoint val_conv;
82030         val_conv.inner = untag_ptr(val);
82031         val_conv.is_owned = ptr_is_owned(val);
82032         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82033         val_conv = OutPoint_clone(&val_conv);
82034         Utxo_set_outpoint(&this_ptr_conv, val_conv);
82035 }
82036
82037 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
82038         LDKUtxo this_ptr_conv;
82039         this_ptr_conv.inner = untag_ptr(this_ptr);
82040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82042         this_ptr_conv.is_owned = false;
82043         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
82044         *ret_ref = Utxo_get_output(&this_ptr_conv);
82045         return tag_ptr(ret_ref, true);
82046 }
82047
82048 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
82049         LDKUtxo this_ptr_conv;
82050         this_ptr_conv.inner = untag_ptr(this_ptr);
82051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82053         this_ptr_conv.is_owned = false;
82054         void* val_ptr = untag_ptr(val);
82055         CHECK_ACCESS(val_ptr);
82056         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
82057         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
82058         Utxo_set_output(&this_ptr_conv, val_conv);
82059 }
82060
82061 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
82062         LDKUtxo this_ptr_conv;
82063         this_ptr_conv.inner = untag_ptr(this_ptr);
82064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82066         this_ptr_conv.is_owned = false;
82067         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
82068         return ret_conv;
82069 }
82070
82071 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
82072         LDKUtxo this_ptr_conv;
82073         this_ptr_conv.inner = untag_ptr(this_ptr);
82074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82076         this_ptr_conv.is_owned = false;
82077         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
82078 }
82079
82080 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
82081         LDKOutPoint outpoint_arg_conv;
82082         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
82083         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
82084         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
82085         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
82086         void* output_arg_ptr = untag_ptr(output_arg);
82087         CHECK_ACCESS(output_arg_ptr);
82088         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
82089         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
82090         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
82091         uint64_t ret_ref = 0;
82092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82094         return ret_ref;
82095 }
82096
82097 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
82098         LDKUtxo ret_var = Utxo_clone(arg);
82099         uint64_t ret_ref = 0;
82100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82102         return ret_ref;
82103 }
82104 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
82105         LDKUtxo arg_conv;
82106         arg_conv.inner = untag_ptr(arg);
82107         arg_conv.is_owned = ptr_is_owned(arg);
82108         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82109         arg_conv.is_owned = false;
82110         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
82111         return ret_conv;
82112 }
82113
82114 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
82115         LDKUtxo orig_conv;
82116         orig_conv.inner = untag_ptr(orig);
82117         orig_conv.is_owned = ptr_is_owned(orig);
82118         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82119         orig_conv.is_owned = false;
82120         LDKUtxo ret_var = Utxo_clone(&orig_conv);
82121         uint64_t ret_ref = 0;
82122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82124         return ret_ref;
82125 }
82126
82127 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
82128         LDKUtxo o_conv;
82129         o_conv.inner = untag_ptr(o);
82130         o_conv.is_owned = ptr_is_owned(o);
82131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82132         o_conv.is_owned = false;
82133         int64_t ret_conv = Utxo_hash(&o_conv);
82134         return ret_conv;
82135 }
82136
82137 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
82138         LDKUtxo a_conv;
82139         a_conv.inner = untag_ptr(a);
82140         a_conv.is_owned = ptr_is_owned(a);
82141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82142         a_conv.is_owned = false;
82143         LDKUtxo b_conv;
82144         b_conv.inner = untag_ptr(b);
82145         b_conv.is_owned = ptr_is_owned(b);
82146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82147         b_conv.is_owned = false;
82148         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
82149         return ret_conv;
82150 }
82151
82152 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
82153         LDKOutPoint outpoint_conv;
82154         outpoint_conv.inner = untag_ptr(outpoint);
82155         outpoint_conv.is_owned = ptr_is_owned(outpoint);
82156         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
82157         outpoint_conv = OutPoint_clone(&outpoint_conv);
82158         uint8_t pubkey_hash_arr[20];
82159         CHECK(pubkey_hash->arr_len == 20);
82160         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
82161         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
82162         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
82163         uint64_t ret_ref = 0;
82164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82166         return ret_ref;
82167 }
82168
82169 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
82170         LDKCoinSelection this_obj_conv;
82171         this_obj_conv.inner = untag_ptr(this_obj);
82172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82174         CoinSelection_free(this_obj_conv);
82175 }
82176
82177 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
82178         LDKCoinSelection this_ptr_conv;
82179         this_ptr_conv.inner = untag_ptr(this_ptr);
82180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82182         this_ptr_conv.is_owned = false;
82183         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
82184         uint64_tArray ret_arr = NULL;
82185         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
82186         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
82187         for (size_t g = 0; g < ret_var.datalen; g++) {
82188                 LDKUtxo ret_conv_6_var = ret_var.data[g];
82189                 uint64_t ret_conv_6_ref = 0;
82190                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
82191                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
82192                 ret_arr_ptr[g] = ret_conv_6_ref;
82193         }
82194         
82195         FREE(ret_var.data);
82196         return ret_arr;
82197 }
82198
82199 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
82200         LDKCoinSelection this_ptr_conv;
82201         this_ptr_conv.inner = untag_ptr(this_ptr);
82202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82204         this_ptr_conv.is_owned = false;
82205         LDKCVec_UtxoZ val_constr;
82206         val_constr.datalen = val->arr_len;
82207         if (val_constr.datalen > 0)
82208                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
82209         else
82210                 val_constr.data = NULL;
82211         uint64_t* val_vals = val->elems;
82212         for (size_t g = 0; g < val_constr.datalen; g++) {
82213                 uint64_t val_conv_6 = val_vals[g];
82214                 LDKUtxo val_conv_6_conv;
82215                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
82216                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
82217                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
82218                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
82219                 val_constr.data[g] = val_conv_6_conv;
82220         }
82221         FREE(val);
82222         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
82223 }
82224
82225 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
82226         LDKCoinSelection this_ptr_conv;
82227         this_ptr_conv.inner = untag_ptr(this_ptr);
82228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82230         this_ptr_conv.is_owned = false;
82231         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
82232         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
82233         uint64_t ret_ref = tag_ptr(ret_copy, true);
82234         return ret_ref;
82235 }
82236
82237 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
82238         LDKCoinSelection this_ptr_conv;
82239         this_ptr_conv.inner = untag_ptr(this_ptr);
82240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82242         this_ptr_conv.is_owned = false;
82243         void* val_ptr = untag_ptr(val);
82244         CHECK_ACCESS(val_ptr);
82245         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
82246         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
82247         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
82248 }
82249
82250 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
82251         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
82252         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
82253         if (confirmed_utxos_arg_constr.datalen > 0)
82254                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
82255         else
82256                 confirmed_utxos_arg_constr.data = NULL;
82257         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
82258         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
82259                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
82260                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
82261                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
82262                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
82263                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
82264                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
82265                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
82266         }
82267         FREE(confirmed_utxos_arg);
82268         void* change_output_arg_ptr = untag_ptr(change_output_arg);
82269         CHECK_ACCESS(change_output_arg_ptr);
82270         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
82271         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
82272         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
82273         uint64_t ret_ref = 0;
82274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82276         return ret_ref;
82277 }
82278
82279 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
82280         LDKCoinSelection ret_var = CoinSelection_clone(arg);
82281         uint64_t ret_ref = 0;
82282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82284         return ret_ref;
82285 }
82286 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
82287         LDKCoinSelection arg_conv;
82288         arg_conv.inner = untag_ptr(arg);
82289         arg_conv.is_owned = ptr_is_owned(arg);
82290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82291         arg_conv.is_owned = false;
82292         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
82293         return ret_conv;
82294 }
82295
82296 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
82297         LDKCoinSelection orig_conv;
82298         orig_conv.inner = untag_ptr(orig);
82299         orig_conv.is_owned = ptr_is_owned(orig);
82300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82301         orig_conv.is_owned = false;
82302         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
82303         uint64_t ret_ref = 0;
82304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82306         return ret_ref;
82307 }
82308
82309 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
82310         if (!ptr_is_owned(this_ptr)) return;
82311         void* this_ptr_ptr = untag_ptr(this_ptr);
82312         CHECK_ACCESS(this_ptr_ptr);
82313         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
82314         FREE(untag_ptr(this_ptr));
82315         CoinSelectionSource_free(this_ptr_conv);
82316 }
82317
82318 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
82319         if (!ptr_is_owned(this_ptr)) return;
82320         void* this_ptr_ptr = untag_ptr(this_ptr);
82321         CHECK_ACCESS(this_ptr_ptr);
82322         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
82323         FREE(untag_ptr(this_ptr));
82324         WalletSource_free(this_ptr_conv);
82325 }
82326
82327 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
82328         LDKWallet this_obj_conv;
82329         this_obj_conv.inner = untag_ptr(this_obj);
82330         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82332         Wallet_free(this_obj_conv);
82333 }
82334
82335 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
82336         void* source_ptr = untag_ptr(source);
82337         CHECK_ACCESS(source_ptr);
82338         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
82339         if (source_conv.free == LDKWalletSource_JCalls_free) {
82340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82341                 LDKWalletSource_JCalls_cloned(&source_conv);
82342         }
82343         void* logger_ptr = untag_ptr(logger);
82344         CHECK_ACCESS(logger_ptr);
82345         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82346         if (logger_conv.free == LDKLogger_JCalls_free) {
82347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82348                 LDKLogger_JCalls_cloned(&logger_conv);
82349         }
82350         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
82351         uint64_t ret_ref = 0;
82352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82354         return ret_ref;
82355 }
82356
82357 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
82358         LDKWallet this_arg_conv;
82359         this_arg_conv.inner = untag_ptr(this_arg);
82360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82362         this_arg_conv.is_owned = false;
82363         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
82364         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
82365         return tag_ptr(ret_ret, true);
82366 }
82367
82368 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
82369         LDKBumpTransactionEventHandler this_obj_conv;
82370         this_obj_conv.inner = untag_ptr(this_obj);
82371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82373         BumpTransactionEventHandler_free(this_obj_conv);
82374 }
82375
82376 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) {
82377         void* broadcaster_ptr = untag_ptr(broadcaster);
82378         CHECK_ACCESS(broadcaster_ptr);
82379         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
82380         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
82381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82382                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
82383         }
82384         void* utxo_source_ptr = untag_ptr(utxo_source);
82385         CHECK_ACCESS(utxo_source_ptr);
82386         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
82387         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
82388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82389                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
82390         }
82391         void* signer_provider_ptr = untag_ptr(signer_provider);
82392         CHECK_ACCESS(signer_provider_ptr);
82393         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
82394         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
82395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82396                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
82397         }
82398         void* logger_ptr = untag_ptr(logger);
82399         CHECK_ACCESS(logger_ptr);
82400         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82401         if (logger_conv.free == LDKLogger_JCalls_free) {
82402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82403                 LDKLogger_JCalls_cloned(&logger_conv);
82404         }
82405         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
82406         uint64_t ret_ref = 0;
82407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82409         return ret_ref;
82410 }
82411
82412 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
82413         LDKBumpTransactionEventHandler this_arg_conv;
82414         this_arg_conv.inner = untag_ptr(this_arg);
82415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82417         this_arg_conv.is_owned = false;
82418         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
82419         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
82420 }
82421
82422 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
82423         if (!ptr_is_owned(this_ptr)) return;
82424         void* this_ptr_ptr = untag_ptr(this_ptr);
82425         CHECK_ACCESS(this_ptr_ptr);
82426         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
82427         FREE(untag_ptr(this_ptr));
82428         GossipSync_free(this_ptr_conv);
82429 }
82430
82431 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
82432         LDKP2PGossipSync a_conv;
82433         a_conv.inner = untag_ptr(a);
82434         a_conv.is_owned = ptr_is_owned(a);
82435         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82436         a_conv.is_owned = false;
82437         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
82438         *ret_copy = GossipSync_p2_p(&a_conv);
82439         uint64_t ret_ref = tag_ptr(ret_copy, true);
82440         return ret_ref;
82441 }
82442
82443 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
82444         LDKRapidGossipSync a_conv;
82445         a_conv.inner = untag_ptr(a);
82446         a_conv.is_owned = ptr_is_owned(a);
82447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82448         a_conv.is_owned = false;
82449         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
82450         *ret_copy = GossipSync_rapid(&a_conv);
82451         uint64_t ret_ref = tag_ptr(ret_copy, true);
82452         return ret_ref;
82453 }
82454
82455 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
82456         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
82457         *ret_copy = GossipSync_none();
82458         uint64_t ret_ref = tag_ptr(ret_copy, true);
82459         return ret_ref;
82460 }
82461
82462 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
82463         if (!ptr_is_owned(this_ptr)) return;
82464         void* this_ptr_ptr = untag_ptr(this_ptr);
82465         CHECK_ACCESS(this_ptr_ptr);
82466         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
82467         FREE(untag_ptr(this_ptr));
82468         GraphSyncError_free(this_ptr_conv);
82469 }
82470
82471 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
82472         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82473         *ret_copy = GraphSyncError_clone(arg);
82474         uint64_t ret_ref = tag_ptr(ret_copy, true);
82475         return ret_ref;
82476 }
82477 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
82478         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
82479         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
82480         return ret_conv;
82481 }
82482
82483 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
82484         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
82485         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82486         *ret_copy = GraphSyncError_clone(orig_conv);
82487         uint64_t ret_ref = tag_ptr(ret_copy, true);
82488         return ret_ref;
82489 }
82490
82491 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
82492         void* a_ptr = untag_ptr(a);
82493         CHECK_ACCESS(a_ptr);
82494         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
82495         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
82496         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82497         *ret_copy = GraphSyncError_decode_error(a_conv);
82498         uint64_t ret_ref = tag_ptr(ret_copy, true);
82499         return ret_ref;
82500 }
82501
82502 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
82503         LDKLightningError a_conv;
82504         a_conv.inner = untag_ptr(a);
82505         a_conv.is_owned = ptr_is_owned(a);
82506         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82507         a_conv = LightningError_clone(&a_conv);
82508         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82509         *ret_copy = GraphSyncError_lightning_error(a_conv);
82510         uint64_t ret_ref = tag_ptr(ret_copy, true);
82511         return ret_ref;
82512 }
82513
82514 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
82515         LDKRapidGossipSync this_obj_conv;
82516         this_obj_conv.inner = untag_ptr(this_obj);
82517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82519         RapidGossipSync_free(this_obj_conv);
82520 }
82521
82522 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
82523         LDKNetworkGraph network_graph_conv;
82524         network_graph_conv.inner = untag_ptr(network_graph);
82525         network_graph_conv.is_owned = ptr_is_owned(network_graph);
82526         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
82527         network_graph_conv.is_owned = false;
82528         void* logger_ptr = untag_ptr(logger);
82529         CHECK_ACCESS(logger_ptr);
82530         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82531         if (logger_conv.free == LDKLogger_JCalls_free) {
82532                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82533                 LDKLogger_JCalls_cloned(&logger_conv);
82534         }
82535         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
82536         uint64_t ret_ref = 0;
82537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82539         return ret_ref;
82540 }
82541
82542 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) {
82543         LDKRapidGossipSync this_arg_conv;
82544         this_arg_conv.inner = untag_ptr(this_arg);
82545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82547         this_arg_conv.is_owned = false;
82548         LDKu8slice update_data_ref;
82549         update_data_ref.datalen = update_data->arr_len;
82550         update_data_ref.data = update_data->elems;
82551         void* current_time_unix_ptr = untag_ptr(current_time_unix);
82552         CHECK_ACCESS(current_time_unix_ptr);
82553         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
82554         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
82555         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82556         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
82557         FREE(update_data);
82558         return tag_ptr(ret_conv, true);
82559 }
82560
82561 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
82562         LDKRapidGossipSync this_arg_conv;
82563         this_arg_conv.inner = untag_ptr(this_arg);
82564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82566         this_arg_conv.is_owned = false;
82567         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
82568         return ret_conv;
82569 }
82570
82571 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
82572         if (!ptr_is_owned(this_ptr)) return;
82573         void* this_ptr_ptr = untag_ptr(this_ptr);
82574         CHECK_ACCESS(this_ptr_ptr);
82575         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
82576         FREE(untag_ptr(this_ptr));
82577         Bolt11ParseError_free(this_ptr_conv);
82578 }
82579
82580 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
82581         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82582         *ret_copy = Bolt11ParseError_clone(arg);
82583         uint64_t ret_ref = tag_ptr(ret_copy, true);
82584         return ret_ref;
82585 }
82586 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
82587         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
82588         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
82589         return ret_conv;
82590 }
82591
82592 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
82593         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
82594         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82595         *ret_copy = Bolt11ParseError_clone(orig_conv);
82596         uint64_t ret_ref = tag_ptr(ret_copy, true);
82597         return ret_ref;
82598 }
82599
82600 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
82601         void* a_ptr = untag_ptr(a);
82602         CHECK_ACCESS(a_ptr);
82603         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
82604         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
82605         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82606         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
82607         uint64_t ret_ref = tag_ptr(ret_copy, true);
82608         return ret_ref;
82609 }
82610
82611 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
82612         
82613         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82614         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
82615         uint64_t ret_ref = tag_ptr(ret_copy, true);
82616         return ret_ref;
82617 }
82618
82619 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
82620         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
82621         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82622         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
82623         uint64_t ret_ref = tag_ptr(ret_copy, true);
82624         return ret_ref;
82625 }
82626
82627 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
82628         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82629         *ret_copy = Bolt11ParseError_bad_prefix();
82630         uint64_t ret_ref = tag_ptr(ret_copy, true);
82631         return ret_ref;
82632 }
82633
82634 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
82635         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82636         *ret_copy = Bolt11ParseError_unknown_currency();
82637         uint64_t ret_ref = tag_ptr(ret_copy, true);
82638         return ret_ref;
82639 }
82640
82641 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
82642         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82643         *ret_copy = Bolt11ParseError_unknown_si_prefix();
82644         uint64_t ret_ref = tag_ptr(ret_copy, true);
82645         return ret_ref;
82646 }
82647
82648 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
82649         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82650         *ret_copy = Bolt11ParseError_malformed_hrp();
82651         uint64_t ret_ref = tag_ptr(ret_copy, true);
82652         return ret_ref;
82653 }
82654
82655 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
82656         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82657         *ret_copy = Bolt11ParseError_too_short_data_part();
82658         uint64_t ret_ref = tag_ptr(ret_copy, true);
82659         return ret_ref;
82660 }
82661
82662 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
82663         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82664         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
82665         uint64_t ret_ref = tag_ptr(ret_copy, true);
82666         return ret_ref;
82667 }
82668
82669 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
82670         
82671         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82672         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
82673         uint64_t ret_ref = tag_ptr(ret_copy, true);
82674         return ret_ref;
82675 }
82676
82677 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
82678         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82679         *ret_copy = Bolt11ParseError_padding_error();
82680         uint64_t ret_ref = tag_ptr(ret_copy, true);
82681         return ret_ref;
82682 }
82683
82684 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
82685         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82686         *ret_copy = Bolt11ParseError_integer_overflow_error();
82687         uint64_t ret_ref = tag_ptr(ret_copy, true);
82688         return ret_ref;
82689 }
82690
82691 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
82692         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82693         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
82694         uint64_t ret_ref = tag_ptr(ret_copy, true);
82695         return ret_ref;
82696 }
82697
82698 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
82699         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82700         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
82701         uint64_t ret_ref = tag_ptr(ret_copy, true);
82702         return ret_ref;
82703 }
82704
82705 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
82706         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82707         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
82708         uint64_t ret_ref = tag_ptr(ret_copy, true);
82709         return ret_ref;
82710 }
82711
82712 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
82713         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82714         *ret_copy = Bolt11ParseError_invalid_recovery_id();
82715         uint64_t ret_ref = tag_ptr(ret_copy, true);
82716         return ret_ref;
82717 }
82718
82719 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
82720         LDKStr a_conv = str_ref_to_owned_c(a);
82721         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82722         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
82723         uint64_t ret_ref = tag_ptr(ret_copy, true);
82724         return ret_ref;
82725 }
82726
82727 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
82728         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
82729         *ret_copy = Bolt11ParseError_skip();
82730         uint64_t ret_ref = tag_ptr(ret_copy, true);
82731         return ret_ref;
82732 }
82733
82734 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
82735         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
82736         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
82737         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
82738         return ret_conv;
82739 }
82740
82741 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
82742         if (!ptr_is_owned(this_ptr)) return;
82743         void* this_ptr_ptr = untag_ptr(this_ptr);
82744         CHECK_ACCESS(this_ptr_ptr);
82745         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
82746         FREE(untag_ptr(this_ptr));
82747         ParseOrSemanticError_free(this_ptr_conv);
82748 }
82749
82750 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
82751         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
82752         *ret_copy = ParseOrSemanticError_clone(arg);
82753         uint64_t ret_ref = tag_ptr(ret_copy, true);
82754         return ret_ref;
82755 }
82756 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
82757         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
82758         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
82759         return ret_conv;
82760 }
82761
82762 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
82763         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
82764         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
82765         *ret_copy = ParseOrSemanticError_clone(orig_conv);
82766         uint64_t ret_ref = tag_ptr(ret_copy, true);
82767         return ret_ref;
82768 }
82769
82770 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
82771         void* a_ptr = untag_ptr(a);
82772         CHECK_ACCESS(a_ptr);
82773         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
82774         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
82775         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
82776         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
82777         uint64_t ret_ref = tag_ptr(ret_copy, true);
82778         return ret_ref;
82779 }
82780
82781 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
82782         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
82783         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
82784         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
82785         uint64_t ret_ref = tag_ptr(ret_copy, true);
82786         return ret_ref;
82787 }
82788
82789 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
82790         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
82791         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
82792         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
82793         return ret_conv;
82794 }
82795
82796 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
82797         LDKBolt11Invoice this_obj_conv;
82798         this_obj_conv.inner = untag_ptr(this_obj);
82799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82801         Bolt11Invoice_free(this_obj_conv);
82802 }
82803
82804 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
82805         LDKBolt11Invoice a_conv;
82806         a_conv.inner = untag_ptr(a);
82807         a_conv.is_owned = ptr_is_owned(a);
82808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82809         a_conv.is_owned = false;
82810         LDKBolt11Invoice b_conv;
82811         b_conv.inner = untag_ptr(b);
82812         b_conv.is_owned = ptr_is_owned(b);
82813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82814         b_conv.is_owned = false;
82815         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
82816         return ret_conv;
82817 }
82818
82819 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
82820         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
82821         uint64_t ret_ref = 0;
82822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82824         return ret_ref;
82825 }
82826 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
82827         LDKBolt11Invoice arg_conv;
82828         arg_conv.inner = untag_ptr(arg);
82829         arg_conv.is_owned = ptr_is_owned(arg);
82830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82831         arg_conv.is_owned = false;
82832         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
82833         return ret_conv;
82834 }
82835
82836 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
82837         LDKBolt11Invoice orig_conv;
82838         orig_conv.inner = untag_ptr(orig);
82839         orig_conv.is_owned = ptr_is_owned(orig);
82840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82841         orig_conv.is_owned = false;
82842         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
82843         uint64_t ret_ref = 0;
82844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82846         return ret_ref;
82847 }
82848
82849 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
82850         LDKBolt11Invoice o_conv;
82851         o_conv.inner = untag_ptr(o);
82852         o_conv.is_owned = ptr_is_owned(o);
82853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82854         o_conv.is_owned = false;
82855         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
82856         return ret_conv;
82857 }
82858
82859 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
82860         LDKSignedRawBolt11Invoice this_obj_conv;
82861         this_obj_conv.inner = untag_ptr(this_obj);
82862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82864         SignedRawBolt11Invoice_free(this_obj_conv);
82865 }
82866
82867 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
82868         LDKSignedRawBolt11Invoice a_conv;
82869         a_conv.inner = untag_ptr(a);
82870         a_conv.is_owned = ptr_is_owned(a);
82871         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82872         a_conv.is_owned = false;
82873         LDKSignedRawBolt11Invoice b_conv;
82874         b_conv.inner = untag_ptr(b);
82875         b_conv.is_owned = ptr_is_owned(b);
82876         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82877         b_conv.is_owned = false;
82878         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
82879         return ret_conv;
82880 }
82881
82882 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
82883         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
82884         uint64_t ret_ref = 0;
82885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82887         return ret_ref;
82888 }
82889 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
82890         LDKSignedRawBolt11Invoice arg_conv;
82891         arg_conv.inner = untag_ptr(arg);
82892         arg_conv.is_owned = ptr_is_owned(arg);
82893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82894         arg_conv.is_owned = false;
82895         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
82896         return ret_conv;
82897 }
82898
82899 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
82900         LDKSignedRawBolt11Invoice orig_conv;
82901         orig_conv.inner = untag_ptr(orig);
82902         orig_conv.is_owned = ptr_is_owned(orig);
82903         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82904         orig_conv.is_owned = false;
82905         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
82906         uint64_t ret_ref = 0;
82907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82909         return ret_ref;
82910 }
82911
82912 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
82913         LDKSignedRawBolt11Invoice o_conv;
82914         o_conv.inner = untag_ptr(o);
82915         o_conv.is_owned = ptr_is_owned(o);
82916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82917         o_conv.is_owned = false;
82918         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
82919         return ret_conv;
82920 }
82921
82922 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
82923         LDKRawBolt11Invoice this_obj_conv;
82924         this_obj_conv.inner = untag_ptr(this_obj);
82925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82927         RawBolt11Invoice_free(this_obj_conv);
82928 }
82929
82930 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
82931         LDKRawBolt11Invoice this_ptr_conv;
82932         this_ptr_conv.inner = untag_ptr(this_ptr);
82933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82935         this_ptr_conv.is_owned = false;
82936         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
82937         uint64_t ret_ref = 0;
82938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82940         return ret_ref;
82941 }
82942
82943 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
82944         LDKRawBolt11Invoice this_ptr_conv;
82945         this_ptr_conv.inner = untag_ptr(this_ptr);
82946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82948         this_ptr_conv.is_owned = false;
82949         LDKRawDataPart val_conv;
82950         val_conv.inner = untag_ptr(val);
82951         val_conv.is_owned = ptr_is_owned(val);
82952         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82953         val_conv = RawDataPart_clone(&val_conv);
82954         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
82955 }
82956
82957 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
82958         LDKRawBolt11Invoice a_conv;
82959         a_conv.inner = untag_ptr(a);
82960         a_conv.is_owned = ptr_is_owned(a);
82961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82962         a_conv.is_owned = false;
82963         LDKRawBolt11Invoice b_conv;
82964         b_conv.inner = untag_ptr(b);
82965         b_conv.is_owned = ptr_is_owned(b);
82966         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82967         b_conv.is_owned = false;
82968         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
82969         return ret_conv;
82970 }
82971
82972 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
82973         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
82974         uint64_t ret_ref = 0;
82975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82977         return ret_ref;
82978 }
82979 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
82980         LDKRawBolt11Invoice arg_conv;
82981         arg_conv.inner = untag_ptr(arg);
82982         arg_conv.is_owned = ptr_is_owned(arg);
82983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82984         arg_conv.is_owned = false;
82985         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
82986         return ret_conv;
82987 }
82988
82989 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
82990         LDKRawBolt11Invoice orig_conv;
82991         orig_conv.inner = untag_ptr(orig);
82992         orig_conv.is_owned = ptr_is_owned(orig);
82993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82994         orig_conv.is_owned = false;
82995         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
82996         uint64_t ret_ref = 0;
82997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82999         return ret_ref;
83000 }
83001
83002 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
83003         LDKRawBolt11Invoice o_conv;
83004         o_conv.inner = untag_ptr(o);
83005         o_conv.is_owned = ptr_is_owned(o);
83006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83007         o_conv.is_owned = false;
83008         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
83009         return ret_conv;
83010 }
83011
83012 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
83013         LDKRawDataPart this_obj_conv;
83014         this_obj_conv.inner = untag_ptr(this_obj);
83015         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83017         RawDataPart_free(this_obj_conv);
83018 }
83019
83020 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
83021         LDKRawDataPart this_ptr_conv;
83022         this_ptr_conv.inner = untag_ptr(this_ptr);
83023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83025         this_ptr_conv.is_owned = false;
83026         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
83027         uint64_t ret_ref = 0;
83028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83030         return ret_ref;
83031 }
83032
83033 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
83034         LDKRawDataPart this_ptr_conv;
83035         this_ptr_conv.inner = untag_ptr(this_ptr);
83036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83038         this_ptr_conv.is_owned = false;
83039         LDKPositiveTimestamp val_conv;
83040         val_conv.inner = untag_ptr(val);
83041         val_conv.is_owned = ptr_is_owned(val);
83042         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83043         val_conv = PositiveTimestamp_clone(&val_conv);
83044         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
83045 }
83046
83047 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
83048         LDKRawDataPart a_conv;
83049         a_conv.inner = untag_ptr(a);
83050         a_conv.is_owned = ptr_is_owned(a);
83051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83052         a_conv.is_owned = false;
83053         LDKRawDataPart b_conv;
83054         b_conv.inner = untag_ptr(b);
83055         b_conv.is_owned = ptr_is_owned(b);
83056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83057         b_conv.is_owned = false;
83058         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
83059         return ret_conv;
83060 }
83061
83062 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
83063         LDKRawDataPart ret_var = RawDataPart_clone(arg);
83064         uint64_t ret_ref = 0;
83065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83067         return ret_ref;
83068 }
83069 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
83070         LDKRawDataPart arg_conv;
83071         arg_conv.inner = untag_ptr(arg);
83072         arg_conv.is_owned = ptr_is_owned(arg);
83073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83074         arg_conv.is_owned = false;
83075         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
83076         return ret_conv;
83077 }
83078
83079 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
83080         LDKRawDataPart orig_conv;
83081         orig_conv.inner = untag_ptr(orig);
83082         orig_conv.is_owned = ptr_is_owned(orig);
83083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83084         orig_conv.is_owned = false;
83085         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
83086         uint64_t ret_ref = 0;
83087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83089         return ret_ref;
83090 }
83091
83092 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
83093         LDKRawDataPart o_conv;
83094         o_conv.inner = untag_ptr(o);
83095         o_conv.is_owned = ptr_is_owned(o);
83096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83097         o_conv.is_owned = false;
83098         int64_t ret_conv = RawDataPart_hash(&o_conv);
83099         return ret_conv;
83100 }
83101
83102 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
83103         LDKPositiveTimestamp this_obj_conv;
83104         this_obj_conv.inner = untag_ptr(this_obj);
83105         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83107         PositiveTimestamp_free(this_obj_conv);
83108 }
83109
83110 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
83111         LDKPositiveTimestamp a_conv;
83112         a_conv.inner = untag_ptr(a);
83113         a_conv.is_owned = ptr_is_owned(a);
83114         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83115         a_conv.is_owned = false;
83116         LDKPositiveTimestamp b_conv;
83117         b_conv.inner = untag_ptr(b);
83118         b_conv.is_owned = ptr_is_owned(b);
83119         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83120         b_conv.is_owned = false;
83121         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
83122         return ret_conv;
83123 }
83124
83125 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
83126         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
83127         uint64_t ret_ref = 0;
83128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83130         return ret_ref;
83131 }
83132 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
83133         LDKPositiveTimestamp arg_conv;
83134         arg_conv.inner = untag_ptr(arg);
83135         arg_conv.is_owned = ptr_is_owned(arg);
83136         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83137         arg_conv.is_owned = false;
83138         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
83139         return ret_conv;
83140 }
83141
83142 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
83143         LDKPositiveTimestamp orig_conv;
83144         orig_conv.inner = untag_ptr(orig);
83145         orig_conv.is_owned = ptr_is_owned(orig);
83146         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83147         orig_conv.is_owned = false;
83148         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
83149         uint64_t ret_ref = 0;
83150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83152         return ret_ref;
83153 }
83154
83155 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
83156         LDKPositiveTimestamp o_conv;
83157         o_conv.inner = untag_ptr(o);
83158         o_conv.is_owned = ptr_is_owned(o);
83159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83160         o_conv.is_owned = false;
83161         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
83162         return ret_conv;
83163 }
83164
83165 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
83166         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
83167         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
83168         return ret_conv;
83169 }
83170
83171 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
83172         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
83173         return ret_conv;
83174 }
83175
83176 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
83177         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
83178         return ret_conv;
83179 }
83180
83181 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
83182         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
83183         return ret_conv;
83184 }
83185
83186 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
83187         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
83188         return ret_conv;
83189 }
83190
83191 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
83192         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
83193         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
83194         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
83195         return ret_conv;
83196 }
83197
83198 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
83199         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
83200         int64_t ret_conv = SiPrefix_hash(o_conv);
83201         return ret_conv;
83202 }
83203
83204 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
83205         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
83206         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
83207         return ret_conv;
83208 }
83209
83210 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
83211         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
83212         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
83213         return ret_conv;
83214 }
83215
83216 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
83217         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
83218         return ret_conv;
83219 }
83220
83221 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
83222         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
83223         return ret_conv;
83224 }
83225
83226 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
83227         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
83228         return ret_conv;
83229 }
83230
83231 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
83232         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
83233         return ret_conv;
83234 }
83235
83236 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
83237         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
83238         return ret_conv;
83239 }
83240
83241 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
83242         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
83243         int64_t ret_conv = Currency_hash(o_conv);
83244         return ret_conv;
83245 }
83246
83247 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
83248         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
83249         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
83250         jboolean ret_conv = Currency_eq(a_conv, b_conv);
83251         return ret_conv;
83252 }
83253
83254 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
83255         LDKSha256 this_obj_conv;
83256         this_obj_conv.inner = untag_ptr(this_obj);
83257         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83259         Sha256_free(this_obj_conv);
83260 }
83261
83262 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
83263         LDKSha256 ret_var = Sha256_clone(arg);
83264         uint64_t ret_ref = 0;
83265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83267         return ret_ref;
83268 }
83269 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
83270         LDKSha256 arg_conv;
83271         arg_conv.inner = untag_ptr(arg);
83272         arg_conv.is_owned = ptr_is_owned(arg);
83273         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83274         arg_conv.is_owned = false;
83275         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
83276         return ret_conv;
83277 }
83278
83279 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
83280         LDKSha256 orig_conv;
83281         orig_conv.inner = untag_ptr(orig);
83282         orig_conv.is_owned = ptr_is_owned(orig);
83283         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83284         orig_conv.is_owned = false;
83285         LDKSha256 ret_var = Sha256_clone(&orig_conv);
83286         uint64_t ret_ref = 0;
83287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83289         return ret_ref;
83290 }
83291
83292 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
83293         LDKSha256 o_conv;
83294         o_conv.inner = untag_ptr(o);
83295         o_conv.is_owned = ptr_is_owned(o);
83296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83297         o_conv.is_owned = false;
83298         int64_t ret_conv = Sha256_hash(&o_conv);
83299         return ret_conv;
83300 }
83301
83302 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
83303         LDKSha256 a_conv;
83304         a_conv.inner = untag_ptr(a);
83305         a_conv.is_owned = ptr_is_owned(a);
83306         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83307         a_conv.is_owned = false;
83308         LDKSha256 b_conv;
83309         b_conv.inner = untag_ptr(b);
83310         b_conv.is_owned = ptr_is_owned(b);
83311         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83312         b_conv.is_owned = false;
83313         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
83314         return ret_conv;
83315 }
83316
83317 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
83318         uint8_t bytes_arr[32];
83319         CHECK(bytes->arr_len == 32);
83320         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
83321         uint8_t (*bytes_ref)[32] = &bytes_arr;
83322         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
83323         uint64_t ret_ref = 0;
83324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83326         return ret_ref;
83327 }
83328
83329 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
83330         LDKDescription this_obj_conv;
83331         this_obj_conv.inner = untag_ptr(this_obj);
83332         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83334         Description_free(this_obj_conv);
83335 }
83336
83337 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
83338         LDKDescription ret_var = Description_clone(arg);
83339         uint64_t ret_ref = 0;
83340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83342         return ret_ref;
83343 }
83344 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
83345         LDKDescription arg_conv;
83346         arg_conv.inner = untag_ptr(arg);
83347         arg_conv.is_owned = ptr_is_owned(arg);
83348         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83349         arg_conv.is_owned = false;
83350         int64_t ret_conv = Description_clone_ptr(&arg_conv);
83351         return ret_conv;
83352 }
83353
83354 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
83355         LDKDescription orig_conv;
83356         orig_conv.inner = untag_ptr(orig);
83357         orig_conv.is_owned = ptr_is_owned(orig);
83358         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83359         orig_conv.is_owned = false;
83360         LDKDescription ret_var = Description_clone(&orig_conv);
83361         uint64_t ret_ref = 0;
83362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83364         return ret_ref;
83365 }
83366
83367 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
83368         LDKDescription o_conv;
83369         o_conv.inner = untag_ptr(o);
83370         o_conv.is_owned = ptr_is_owned(o);
83371         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83372         o_conv.is_owned = false;
83373         int64_t ret_conv = Description_hash(&o_conv);
83374         return ret_conv;
83375 }
83376
83377 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
83378         LDKDescription a_conv;
83379         a_conv.inner = untag_ptr(a);
83380         a_conv.is_owned = ptr_is_owned(a);
83381         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83382         a_conv.is_owned = false;
83383         LDKDescription b_conv;
83384         b_conv.inner = untag_ptr(b);
83385         b_conv.is_owned = ptr_is_owned(b);
83386         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83387         b_conv.is_owned = false;
83388         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
83389         return ret_conv;
83390 }
83391
83392 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
83393         LDKPayeePubKey this_obj_conv;
83394         this_obj_conv.inner = untag_ptr(this_obj);
83395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83397         PayeePubKey_free(this_obj_conv);
83398 }
83399
83400 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
83401         LDKPayeePubKey this_ptr_conv;
83402         this_ptr_conv.inner = untag_ptr(this_ptr);
83403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83405         this_ptr_conv.is_owned = false;
83406         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
83407         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
83408         return ret_arr;
83409 }
83410
83411 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
83412         LDKPayeePubKey this_ptr_conv;
83413         this_ptr_conv.inner = untag_ptr(this_ptr);
83414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83416         this_ptr_conv.is_owned = false;
83417         LDKPublicKey val_ref;
83418         CHECK(val->arr_len == 33);
83419         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
83420         PayeePubKey_set_a(&this_ptr_conv, val_ref);
83421 }
83422
83423 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
83424         LDKPublicKey a_arg_ref;
83425         CHECK(a_arg->arr_len == 33);
83426         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
83427         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
83428         uint64_t ret_ref = 0;
83429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83431         return ret_ref;
83432 }
83433
83434 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
83435         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
83436         uint64_t ret_ref = 0;
83437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83439         return ret_ref;
83440 }
83441 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
83442         LDKPayeePubKey arg_conv;
83443         arg_conv.inner = untag_ptr(arg);
83444         arg_conv.is_owned = ptr_is_owned(arg);
83445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83446         arg_conv.is_owned = false;
83447         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
83448         return ret_conv;
83449 }
83450
83451 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
83452         LDKPayeePubKey orig_conv;
83453         orig_conv.inner = untag_ptr(orig);
83454         orig_conv.is_owned = ptr_is_owned(orig);
83455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83456         orig_conv.is_owned = false;
83457         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
83458         uint64_t ret_ref = 0;
83459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83461         return ret_ref;
83462 }
83463
83464 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
83465         LDKPayeePubKey o_conv;
83466         o_conv.inner = untag_ptr(o);
83467         o_conv.is_owned = ptr_is_owned(o);
83468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83469         o_conv.is_owned = false;
83470         int64_t ret_conv = PayeePubKey_hash(&o_conv);
83471         return ret_conv;
83472 }
83473
83474 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
83475         LDKPayeePubKey a_conv;
83476         a_conv.inner = untag_ptr(a);
83477         a_conv.is_owned = ptr_is_owned(a);
83478         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83479         a_conv.is_owned = false;
83480         LDKPayeePubKey b_conv;
83481         b_conv.inner = untag_ptr(b);
83482         b_conv.is_owned = ptr_is_owned(b);
83483         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83484         b_conv.is_owned = false;
83485         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
83486         return ret_conv;
83487 }
83488
83489 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
83490         LDKExpiryTime this_obj_conv;
83491         this_obj_conv.inner = untag_ptr(this_obj);
83492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83494         ExpiryTime_free(this_obj_conv);
83495 }
83496
83497 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
83498         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
83499         uint64_t ret_ref = 0;
83500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83502         return ret_ref;
83503 }
83504 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
83505         LDKExpiryTime arg_conv;
83506         arg_conv.inner = untag_ptr(arg);
83507         arg_conv.is_owned = ptr_is_owned(arg);
83508         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83509         arg_conv.is_owned = false;
83510         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
83511         return ret_conv;
83512 }
83513
83514 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
83515         LDKExpiryTime orig_conv;
83516         orig_conv.inner = untag_ptr(orig);
83517         orig_conv.is_owned = ptr_is_owned(orig);
83518         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83519         orig_conv.is_owned = false;
83520         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
83521         uint64_t ret_ref = 0;
83522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83524         return ret_ref;
83525 }
83526
83527 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
83528         LDKExpiryTime o_conv;
83529         o_conv.inner = untag_ptr(o);
83530         o_conv.is_owned = ptr_is_owned(o);
83531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83532         o_conv.is_owned = false;
83533         int64_t ret_conv = ExpiryTime_hash(&o_conv);
83534         return ret_conv;
83535 }
83536
83537 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
83538         LDKExpiryTime a_conv;
83539         a_conv.inner = untag_ptr(a);
83540         a_conv.is_owned = ptr_is_owned(a);
83541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83542         a_conv.is_owned = false;
83543         LDKExpiryTime b_conv;
83544         b_conv.inner = untag_ptr(b);
83545         b_conv.is_owned = ptr_is_owned(b);
83546         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83547         b_conv.is_owned = false;
83548         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
83549         return ret_conv;
83550 }
83551
83552 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
83553         LDKMinFinalCltvExpiryDelta this_obj_conv;
83554         this_obj_conv.inner = untag_ptr(this_obj);
83555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83557         MinFinalCltvExpiryDelta_free(this_obj_conv);
83558 }
83559
83560 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
83561         LDKMinFinalCltvExpiryDelta this_ptr_conv;
83562         this_ptr_conv.inner = untag_ptr(this_ptr);
83563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83565         this_ptr_conv.is_owned = false;
83566         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
83567         return ret_conv;
83568 }
83569
83570 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
83571         LDKMinFinalCltvExpiryDelta this_ptr_conv;
83572         this_ptr_conv.inner = untag_ptr(this_ptr);
83573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83575         this_ptr_conv.is_owned = false;
83576         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
83577 }
83578
83579 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
83580         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
83581         uint64_t ret_ref = 0;
83582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83584         return ret_ref;
83585 }
83586
83587 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
83588         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
83589         uint64_t ret_ref = 0;
83590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83592         return ret_ref;
83593 }
83594 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
83595         LDKMinFinalCltvExpiryDelta arg_conv;
83596         arg_conv.inner = untag_ptr(arg);
83597         arg_conv.is_owned = ptr_is_owned(arg);
83598         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83599         arg_conv.is_owned = false;
83600         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
83601         return ret_conv;
83602 }
83603
83604 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
83605         LDKMinFinalCltvExpiryDelta orig_conv;
83606         orig_conv.inner = untag_ptr(orig);
83607         orig_conv.is_owned = ptr_is_owned(orig);
83608         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83609         orig_conv.is_owned = false;
83610         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
83611         uint64_t ret_ref = 0;
83612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83614         return ret_ref;
83615 }
83616
83617 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
83618         LDKMinFinalCltvExpiryDelta o_conv;
83619         o_conv.inner = untag_ptr(o);
83620         o_conv.is_owned = ptr_is_owned(o);
83621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83622         o_conv.is_owned = false;
83623         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
83624         return ret_conv;
83625 }
83626
83627 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
83628         LDKMinFinalCltvExpiryDelta a_conv;
83629         a_conv.inner = untag_ptr(a);
83630         a_conv.is_owned = ptr_is_owned(a);
83631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83632         a_conv.is_owned = false;
83633         LDKMinFinalCltvExpiryDelta b_conv;
83634         b_conv.inner = untag_ptr(b);
83635         b_conv.is_owned = ptr_is_owned(b);
83636         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83637         b_conv.is_owned = false;
83638         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
83639         return ret_conv;
83640 }
83641
83642 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
83643         if (!ptr_is_owned(this_ptr)) return;
83644         void* this_ptr_ptr = untag_ptr(this_ptr);
83645         CHECK_ACCESS(this_ptr_ptr);
83646         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
83647         FREE(untag_ptr(this_ptr));
83648         Fallback_free(this_ptr_conv);
83649 }
83650
83651 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
83652         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
83653         *ret_copy = Fallback_clone(arg);
83654         uint64_t ret_ref = tag_ptr(ret_copy, true);
83655         return ret_ref;
83656 }
83657 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
83658         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
83659         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
83660         return ret_conv;
83661 }
83662
83663 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
83664         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
83665         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
83666         *ret_copy = Fallback_clone(orig_conv);
83667         uint64_t ret_ref = tag_ptr(ret_copy, true);
83668         return ret_ref;
83669 }
83670
83671 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
83672         
83673         LDKCVec_u8Z program_ref;
83674         program_ref.datalen = program->arr_len;
83675         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
83676         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
83677         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
83678         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
83679         uint64_t ret_ref = tag_ptr(ret_copy, true);
83680         return ret_ref;
83681 }
83682
83683 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
83684         LDKTwentyBytes a_ref;
83685         CHECK(a->arr_len == 20);
83686         memcpy(a_ref.data, a->elems, 20); FREE(a);
83687         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
83688         *ret_copy = Fallback_pub_key_hash(a_ref);
83689         uint64_t ret_ref = tag_ptr(ret_copy, true);
83690         return ret_ref;
83691 }
83692
83693 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
83694         LDKTwentyBytes a_ref;
83695         CHECK(a->arr_len == 20);
83696         memcpy(a_ref.data, a->elems, 20); FREE(a);
83697         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
83698         *ret_copy = Fallback_script_hash(a_ref);
83699         uint64_t ret_ref = tag_ptr(ret_copy, true);
83700         return ret_ref;
83701 }
83702
83703 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
83704         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
83705         int64_t ret_conv = Fallback_hash(o_conv);
83706         return ret_conv;
83707 }
83708
83709 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
83710         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
83711         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
83712         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
83713         return ret_conv;
83714 }
83715
83716 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
83717         LDKBolt11InvoiceSignature this_obj_conv;
83718         this_obj_conv.inner = untag_ptr(this_obj);
83719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83721         Bolt11InvoiceSignature_free(this_obj_conv);
83722 }
83723
83724 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
83725         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
83726         uint64_t ret_ref = 0;
83727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83729         return ret_ref;
83730 }
83731 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
83732         LDKBolt11InvoiceSignature arg_conv;
83733         arg_conv.inner = untag_ptr(arg);
83734         arg_conv.is_owned = ptr_is_owned(arg);
83735         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83736         arg_conv.is_owned = false;
83737         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
83738         return ret_conv;
83739 }
83740
83741 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
83742         LDKBolt11InvoiceSignature orig_conv;
83743         orig_conv.inner = untag_ptr(orig);
83744         orig_conv.is_owned = ptr_is_owned(orig);
83745         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83746         orig_conv.is_owned = false;
83747         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
83748         uint64_t ret_ref = 0;
83749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83751         return ret_ref;
83752 }
83753
83754 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
83755         LDKBolt11InvoiceSignature o_conv;
83756         o_conv.inner = untag_ptr(o);
83757         o_conv.is_owned = ptr_is_owned(o);
83758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83759         o_conv.is_owned = false;
83760         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
83761         return ret_conv;
83762 }
83763
83764 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
83765         LDKBolt11InvoiceSignature a_conv;
83766         a_conv.inner = untag_ptr(a);
83767         a_conv.is_owned = ptr_is_owned(a);
83768         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83769         a_conv.is_owned = false;
83770         LDKBolt11InvoiceSignature b_conv;
83771         b_conv.inner = untag_ptr(b);
83772         b_conv.is_owned = ptr_is_owned(b);
83773         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83774         b_conv.is_owned = false;
83775         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
83776         return ret_conv;
83777 }
83778
83779 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
83780         LDKPrivateRoute this_obj_conv;
83781         this_obj_conv.inner = untag_ptr(this_obj);
83782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83784         PrivateRoute_free(this_obj_conv);
83785 }
83786
83787 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
83788         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
83789         uint64_t ret_ref = 0;
83790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83792         return ret_ref;
83793 }
83794 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
83795         LDKPrivateRoute arg_conv;
83796         arg_conv.inner = untag_ptr(arg);
83797         arg_conv.is_owned = ptr_is_owned(arg);
83798         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83799         arg_conv.is_owned = false;
83800         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
83801         return ret_conv;
83802 }
83803
83804 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
83805         LDKPrivateRoute orig_conv;
83806         orig_conv.inner = untag_ptr(orig);
83807         orig_conv.is_owned = ptr_is_owned(orig);
83808         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83809         orig_conv.is_owned = false;
83810         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
83811         uint64_t ret_ref = 0;
83812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83814         return ret_ref;
83815 }
83816
83817 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
83818         LDKPrivateRoute o_conv;
83819         o_conv.inner = untag_ptr(o);
83820         o_conv.is_owned = ptr_is_owned(o);
83821         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83822         o_conv.is_owned = false;
83823         int64_t ret_conv = PrivateRoute_hash(&o_conv);
83824         return ret_conv;
83825 }
83826
83827 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
83828         LDKPrivateRoute a_conv;
83829         a_conv.inner = untag_ptr(a);
83830         a_conv.is_owned = ptr_is_owned(a);
83831         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83832         a_conv.is_owned = false;
83833         LDKPrivateRoute b_conv;
83834         b_conv.inner = untag_ptr(b);
83835         b_conv.is_owned = ptr_is_owned(b);
83836         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83837         b_conv.is_owned = false;
83838         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
83839         return ret_conv;
83840 }
83841
83842 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
83843         LDKSignedRawBolt11Invoice this_arg_conv;
83844         this_arg_conv.inner = untag_ptr(this_arg);
83845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83847         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
83848         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
83849         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
83850         return tag_ptr(ret_conv, true);
83851 }
83852
83853 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
83854         LDKSignedRawBolt11Invoice this_arg_conv;
83855         this_arg_conv.inner = untag_ptr(this_arg);
83856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83858         this_arg_conv.is_owned = false;
83859         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
83860         uint64_t ret_ref = 0;
83861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83863         return ret_ref;
83864 }
83865
83866 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
83867         LDKSignedRawBolt11Invoice this_arg_conv;
83868         this_arg_conv.inner = untag_ptr(this_arg);
83869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83871         this_arg_conv.is_owned = false;
83872         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
83873         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
83874         return ret_arr;
83875 }
83876
83877 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
83878         LDKSignedRawBolt11Invoice this_arg_conv;
83879         this_arg_conv.inner = untag_ptr(this_arg);
83880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83882         this_arg_conv.is_owned = false;
83883         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
83884         uint64_t ret_ref = 0;
83885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83887         return ret_ref;
83888 }
83889
83890 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
83891         LDKSignedRawBolt11Invoice this_arg_conv;
83892         this_arg_conv.inner = untag_ptr(this_arg);
83893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83895         this_arg_conv.is_owned = false;
83896         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
83897         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
83898         return tag_ptr(ret_conv, true);
83899 }
83900
83901 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
83902         LDKSignedRawBolt11Invoice this_arg_conv;
83903         this_arg_conv.inner = untag_ptr(this_arg);
83904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83906         this_arg_conv.is_owned = false;
83907         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
83908         return ret_conv;
83909 }
83910
83911 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
83912         LDKRawBolt11Invoice this_arg_conv;
83913         this_arg_conv.inner = untag_ptr(this_arg);
83914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83916         this_arg_conv.is_owned = false;
83917         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
83918         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
83919         return ret_arr;
83920 }
83921
83922 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
83923         LDKRawBolt11Invoice this_arg_conv;
83924         this_arg_conv.inner = untag_ptr(this_arg);
83925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83927         this_arg_conv.is_owned = false;
83928         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
83929         uint64_t ret_ref = 0;
83930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83932         return ret_ref;
83933 }
83934
83935 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
83936         LDKRawBolt11Invoice this_arg_conv;
83937         this_arg_conv.inner = untag_ptr(this_arg);
83938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83940         this_arg_conv.is_owned = false;
83941         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
83942         uint64_t ret_ref = 0;
83943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83945         return ret_ref;
83946 }
83947
83948 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
83949         LDKRawBolt11Invoice this_arg_conv;
83950         this_arg_conv.inner = untag_ptr(this_arg);
83951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83953         this_arg_conv.is_owned = false;
83954         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
83955         uint64_t ret_ref = 0;
83956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83958         return ret_ref;
83959 }
83960
83961 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
83962         LDKRawBolt11Invoice this_arg_conv;
83963         this_arg_conv.inner = untag_ptr(this_arg);
83964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83966         this_arg_conv.is_owned = false;
83967         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
83968         uint64_t ret_ref = 0;
83969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83971         return ret_ref;
83972 }
83973
83974 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
83975         LDKRawBolt11Invoice this_arg_conv;
83976         this_arg_conv.inner = untag_ptr(this_arg);
83977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83979         this_arg_conv.is_owned = false;
83980         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
83981         uint64_t ret_ref = 0;
83982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83984         return ret_ref;
83985 }
83986
83987 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
83988         LDKRawBolt11Invoice this_arg_conv;
83989         this_arg_conv.inner = untag_ptr(this_arg);
83990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83992         this_arg_conv.is_owned = false;
83993         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
83994         uint64_t ret_ref = 0;
83995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83997         return ret_ref;
83998 }
83999
84000 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
84001         LDKRawBolt11Invoice this_arg_conv;
84002         this_arg_conv.inner = untag_ptr(this_arg);
84003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84005         this_arg_conv.is_owned = false;
84006         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
84007         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
84008         uint64_t ret_ref = tag_ptr(ret_copy, true);
84009         return ret_ref;
84010 }
84011
84012 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
84013         LDKRawBolt11Invoice this_arg_conv;
84014         this_arg_conv.inner = untag_ptr(this_arg);
84015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84017         this_arg_conv.is_owned = false;
84018         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
84019         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
84020         uint64_t ret_ref = tag_ptr(ret_copy, true);
84021         return ret_ref;
84022 }
84023
84024 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
84025         LDKRawBolt11Invoice this_arg_conv;
84026         this_arg_conv.inner = untag_ptr(this_arg);
84027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84029         this_arg_conv.is_owned = false;
84030         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
84031         uint64_t ret_ref = 0;
84032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84034         return ret_ref;
84035 }
84036
84037 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
84038         LDKRawBolt11Invoice this_arg_conv;
84039         this_arg_conv.inner = untag_ptr(this_arg);
84040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84042         this_arg_conv.is_owned = false;
84043         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
84044         uint64_tArray ret_arr = NULL;
84045         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
84046         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
84047         for (size_t o = 0; o < ret_var.datalen; o++) {
84048                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
84049                 uint64_t ret_conv_14_ref = 0;
84050                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
84051                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
84052                 ret_arr_ptr[o] = ret_conv_14_ref;
84053         }
84054         
84055         FREE(ret_var.data);
84056         return ret_arr;
84057 }
84058
84059 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
84060         LDKRawBolt11Invoice this_arg_conv;
84061         this_arg_conv.inner = untag_ptr(this_arg);
84062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84064         this_arg_conv.is_owned = false;
84065         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
84066         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
84067         uint64_t ret_ref = tag_ptr(ret_copy, true);
84068         return ret_ref;
84069 }
84070
84071 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
84072         LDKRawBolt11Invoice this_arg_conv;
84073         this_arg_conv.inner = untag_ptr(this_arg);
84074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84076         this_arg_conv.is_owned = false;
84077         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
84078         return ret_conv;
84079 }
84080
84081 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
84082         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
84083         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
84084         return tag_ptr(ret_conv, true);
84085 }
84086
84087 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
84088         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
84089         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
84090         return tag_ptr(ret_conv, true);
84091 }
84092
84093 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
84094         LDKPositiveTimestamp this_arg_conv;
84095         this_arg_conv.inner = untag_ptr(this_arg);
84096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84098         this_arg_conv.is_owned = false;
84099         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
84100         return ret_conv;
84101 }
84102
84103 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
84104         LDKPositiveTimestamp this_arg_conv;
84105         this_arg_conv.inner = untag_ptr(this_arg);
84106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84108         this_arg_conv.is_owned = false;
84109         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
84110         return ret_conv;
84111 }
84112
84113 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
84114         LDKBolt11Invoice this_arg_conv;
84115         this_arg_conv.inner = untag_ptr(this_arg);
84116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84118         this_arg_conv.is_owned = false;
84119         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84120         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
84121         return ret_arr;
84122 }
84123
84124 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
84125         LDKBolt11Invoice this_arg_conv;
84126         this_arg_conv.inner = untag_ptr(this_arg);
84127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84129         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
84130         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
84131         uint64_t ret_ref = 0;
84132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84134         return ret_ref;
84135 }
84136
84137 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
84138         LDKBolt11Invoice this_arg_conv;
84139         this_arg_conv.inner = untag_ptr(this_arg);
84140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84142         this_arg_conv.is_owned = false;
84143         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
84144         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
84145         return tag_ptr(ret_conv, true);
84146 }
84147
84148 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
84149         LDKSignedRawBolt11Invoice signed_invoice_conv;
84150         signed_invoice_conv.inner = untag_ptr(signed_invoice);
84151         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
84152         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
84153         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
84154         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
84155         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
84156         return tag_ptr(ret_conv, true);
84157 }
84158
84159 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
84160         LDKBolt11Invoice this_arg_conv;
84161         this_arg_conv.inner = untag_ptr(this_arg);
84162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84164         this_arg_conv.is_owned = false;
84165         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
84166         return ret_conv;
84167 }
84168
84169 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
84170         LDKBolt11Invoice this_arg_conv;
84171         this_arg_conv.inner = untag_ptr(this_arg);
84172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84174         this_arg_conv.is_owned = false;
84175         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84176         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
84177         return ret_arr;
84178 }
84179
84180 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
84181         LDKBolt11Invoice this_arg_conv;
84182         this_arg_conv.inner = untag_ptr(this_arg);
84183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84185         this_arg_conv.is_owned = false;
84186         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
84187         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
84188         return ret_arr;
84189 }
84190
84191 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
84192         LDKBolt11Invoice this_arg_conv;
84193         this_arg_conv.inner = untag_ptr(this_arg);
84194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84196         this_arg_conv.is_owned = false;
84197         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84198         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
84199         return ret_arr;
84200 }
84201
84202 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
84203         LDKBolt11Invoice this_arg_conv;
84204         this_arg_conv.inner = untag_ptr(this_arg);
84205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84207         this_arg_conv.is_owned = false;
84208         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
84209         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
84210         uint64_t ret_ref = tag_ptr(ret_copy, true);
84211         return ret_ref;
84212 }
84213
84214 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
84215         LDKBolt11Invoice this_arg_conv;
84216         this_arg_conv.inner = untag_ptr(this_arg);
84217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84219         this_arg_conv.is_owned = false;
84220         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
84221         uint64_t ret_ref = 0;
84222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84224         return ret_ref;
84225 }
84226
84227 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
84228         LDKBolt11Invoice this_arg_conv;
84229         this_arg_conv.inner = untag_ptr(this_arg);
84230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84232         this_arg_conv.is_owned = false;
84233         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
84234         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
84235         return ret_arr;
84236 }
84237
84238 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_get_payee_pub_key"))) TS_Bolt11Invoice_get_payee_pub_key(uint64_t this_arg) {
84239         LDKBolt11Invoice this_arg_conv;
84240         this_arg_conv.inner = untag_ptr(this_arg);
84241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84243         this_arg_conv.is_owned = false;
84244         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
84245         memcpy(ret_arr->elems, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form, 33);
84246         return ret_arr;
84247 }
84248
84249 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
84250         LDKBolt11Invoice this_arg_conv;
84251         this_arg_conv.inner = untag_ptr(this_arg);
84252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84254         this_arg_conv.is_owned = false;
84255         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
84256         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
84257         uint64_t ret_ref = tag_ptr(ret_copy, true);
84258         return ret_ref;
84259 }
84260
84261 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
84262         LDKBolt11Invoice this_arg_conv;
84263         this_arg_conv.inner = untag_ptr(this_arg);
84264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84266         this_arg_conv.is_owned = false;
84267         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
84268         return ret_conv;
84269 }
84270
84271 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
84272         LDKBolt11Invoice this_arg_conv;
84273         this_arg_conv.inner = untag_ptr(this_arg);
84274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84276         this_arg_conv.is_owned = false;
84277         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
84278         return ret_conv;
84279 }
84280
84281 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
84282         LDKBolt11Invoice this_arg_conv;
84283         this_arg_conv.inner = untag_ptr(this_arg);
84284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84286         this_arg_conv.is_owned = false;
84287         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
84288         return ret_conv;
84289 }
84290
84291 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
84292         LDKBolt11Invoice this_arg_conv;
84293         this_arg_conv.inner = untag_ptr(this_arg);
84294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84296         this_arg_conv.is_owned = false;
84297         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
84298         return ret_conv;
84299 }
84300
84301 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
84302         LDKBolt11Invoice this_arg_conv;
84303         this_arg_conv.inner = untag_ptr(this_arg);
84304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84306         this_arg_conv.is_owned = false;
84307         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
84308         ptrArray ret_arr = NULL;
84309         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
84310         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
84311         for (size_t i = 0; i < ret_var.datalen; i++) {
84312                 LDKStr ret_conv_8_str = ret_var.data[i];
84313                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
84314                 Str_free(ret_conv_8_str);
84315                 ret_arr_ptr[i] = ret_conv_8_conv;
84316         }
84317         
84318         FREE(ret_var.data);
84319         return ret_arr;
84320 }
84321
84322 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
84323         LDKBolt11Invoice this_arg_conv;
84324         this_arg_conv.inner = untag_ptr(this_arg);
84325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84327         this_arg_conv.is_owned = false;
84328         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
84329         uint64_tArray ret_arr = NULL;
84330         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
84331         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
84332         for (size_t o = 0; o < ret_var.datalen; o++) {
84333                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
84334                 uint64_t ret_conv_14_ref = 0;
84335                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
84336                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
84337                 ret_arr_ptr[o] = ret_conv_14_ref;
84338         }
84339         
84340         FREE(ret_var.data);
84341         return ret_arr;
84342 }
84343
84344 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
84345         LDKBolt11Invoice this_arg_conv;
84346         this_arg_conv.inner = untag_ptr(this_arg);
84347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84349         this_arg_conv.is_owned = false;
84350         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
84351         uint64_tArray ret_arr = NULL;
84352         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
84353         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
84354         for (size_t l = 0; l < ret_var.datalen; l++) {
84355                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
84356                 uint64_t ret_conv_11_ref = 0;
84357                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
84358                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
84359                 ret_arr_ptr[l] = ret_conv_11_ref;
84360         }
84361         
84362         FREE(ret_var.data);
84363         return ret_arr;
84364 }
84365
84366 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
84367         LDKBolt11Invoice this_arg_conv;
84368         this_arg_conv.inner = untag_ptr(this_arg);
84369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84371         this_arg_conv.is_owned = false;
84372         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
84373         return ret_conv;
84374 }
84375
84376 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
84377         LDKBolt11Invoice this_arg_conv;
84378         this_arg_conv.inner = untag_ptr(this_arg);
84379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84381         this_arg_conv.is_owned = false;
84382         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
84383         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
84384         uint64_t ret_ref = tag_ptr(ret_copy, true);
84385         return ret_ref;
84386 }
84387
84388 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
84389         LDKStr description_conv = str_ref_to_owned_c(description);
84390         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
84391         *ret_conv = Description_new(description_conv);
84392         return tag_ptr(ret_conv, true);
84393 }
84394
84395 uint64_t  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
84396         LDKDescription this_arg_conv;
84397         this_arg_conv.inner = untag_ptr(this_arg);
84398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84400         this_arg_conv = Description_clone(&this_arg_conv);
84401         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
84402         uint64_t ret_ref = 0;
84403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84405         return ret_ref;
84406 }
84407
84408 jstring  __attribute__((export_name("TS_Description_to_str"))) TS_Description_to_str(uint64_t o) {
84409         LDKDescription o_conv;
84410         o_conv.inner = untag_ptr(o);
84411         o_conv.is_owned = ptr_is_owned(o);
84412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84413         o_conv.is_owned = false;
84414         LDKStr ret_str = Description_to_str(&o_conv);
84415         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84416         Str_free(ret_str);
84417         return ret_conv;
84418 }
84419
84420 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
84421         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
84422         uint64_t ret_ref = 0;
84423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84425         return ret_ref;
84426 }
84427
84428 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
84429         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
84430         uint64_t ret_ref = 0;
84431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84433         return ret_ref;
84434 }
84435
84436 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
84437         LDKExpiryTime this_arg_conv;
84438         this_arg_conv.inner = untag_ptr(this_arg);
84439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84441         this_arg_conv.is_owned = false;
84442         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
84443         return ret_conv;
84444 }
84445
84446 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
84447         LDKExpiryTime this_arg_conv;
84448         this_arg_conv.inner = untag_ptr(this_arg);
84449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84451         this_arg_conv.is_owned = false;
84452         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
84453         return ret_conv;
84454 }
84455
84456 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
84457         LDKRouteHint hops_conv;
84458         hops_conv.inner = untag_ptr(hops);
84459         hops_conv.is_owned = ptr_is_owned(hops);
84460         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
84461         hops_conv = RouteHint_clone(&hops_conv);
84462         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
84463         *ret_conv = PrivateRoute_new(hops_conv);
84464         return tag_ptr(ret_conv, true);
84465 }
84466
84467 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
84468         LDKPrivateRoute this_arg_conv;
84469         this_arg_conv.inner = untag_ptr(this_arg);
84470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84472         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
84473         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
84474         uint64_t ret_ref = 0;
84475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84477         return ret_ref;
84478 }
84479
84480 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
84481         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
84482         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
84483         return ret_conv;
84484 }
84485
84486 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
84487         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
84488         return ret_conv;
84489 }
84490
84491 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
84492         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
84493         return ret_conv;
84494 }
84495
84496 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
84497         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
84498         return ret_conv;
84499 }
84500
84501 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
84502         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
84503         return ret_conv;
84504 }
84505
84506 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
84507         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
84508         return ret_conv;
84509 }
84510
84511 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
84512         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
84513         return ret_conv;
84514 }
84515
84516 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
84517         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
84518         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
84519         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
84520         return ret_conv;
84521 }
84522
84523 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
84524         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
84525         LDKStr ret_str = CreationError_to_str(o_conv);
84526         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84527         Str_free(ret_str);
84528         return ret_conv;
84529 }
84530
84531 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
84532         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
84533         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
84534         return ret_conv;
84535 }
84536
84537 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
84538         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
84539         return ret_conv;
84540 }
84541
84542 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
84543         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
84544         return ret_conv;
84545 }
84546
84547 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
84548         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
84549         return ret_conv;
84550 }
84551
84552 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
84553         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
84554         return ret_conv;
84555 }
84556
84557 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
84558         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
84559         return ret_conv;
84560 }
84561
84562 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
84563         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
84564         return ret_conv;
84565 }
84566
84567 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
84568         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
84569         return ret_conv;
84570 }
84571
84572 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
84573         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
84574         return ret_conv;
84575 }
84576
84577 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
84578         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
84579         return ret_conv;
84580 }
84581
84582 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
84583         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
84584         return ret_conv;
84585 }
84586
84587 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
84588         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
84589         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
84590         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
84591         return ret_conv;
84592 }
84593
84594 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
84595         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
84596         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
84597         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84598         Str_free(ret_str);
84599         return ret_conv;
84600 }
84601
84602 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
84603         if (!ptr_is_owned(this_ptr)) return;
84604         void* this_ptr_ptr = untag_ptr(this_ptr);
84605         CHECK_ACCESS(this_ptr_ptr);
84606         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
84607         FREE(untag_ptr(this_ptr));
84608         SignOrCreationError_free(this_ptr_conv);
84609 }
84610
84611 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
84612         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
84613         *ret_copy = SignOrCreationError_clone(arg);
84614         uint64_t ret_ref = tag_ptr(ret_copy, true);
84615         return ret_ref;
84616 }
84617 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
84618         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
84619         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
84620         return ret_conv;
84621 }
84622
84623 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
84624         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
84625         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
84626         *ret_copy = SignOrCreationError_clone(orig_conv);
84627         uint64_t ret_ref = tag_ptr(ret_copy, true);
84628         return ret_ref;
84629 }
84630
84631 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
84632         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
84633         *ret_copy = SignOrCreationError_sign_error();
84634         uint64_t ret_ref = tag_ptr(ret_copy, true);
84635         return ret_ref;
84636 }
84637
84638 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
84639         LDKCreationError a_conv = LDKCreationError_from_js(a);
84640         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
84641         *ret_copy = SignOrCreationError_creation_error(a_conv);
84642         uint64_t ret_ref = tag_ptr(ret_copy, true);
84643         return ret_ref;
84644 }
84645
84646 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
84647         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
84648         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
84649         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
84650         return ret_conv;
84651 }
84652
84653 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
84654         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
84655         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
84656         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84657         Str_free(ret_str);
84658         return ret_conv;
84659 }
84660
84661 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) {
84662         LDKBolt11Invoice invoice_conv;
84663         invoice_conv.inner = untag_ptr(invoice);
84664         invoice_conv.is_owned = ptr_is_owned(invoice);
84665         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
84666         invoice_conv.is_owned = false;
84667         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
84668         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
84669         return tag_ptr(ret_conv, true);
84670 }
84671
84672 uint64_t  __attribute__((export_name("TS_payment_parameters_from_invoice"))) TS_payment_parameters_from_invoice(uint64_t invoice) {
84673         LDKBolt11Invoice invoice_conv;
84674         invoice_conv.inner = untag_ptr(invoice);
84675         invoice_conv.is_owned = ptr_is_owned(invoice);
84676         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
84677         invoice_conv.is_owned = false;
84678         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
84679         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
84680         return tag_ptr(ret_conv, true);
84681 }
84682
84683 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) {
84684         void* amt_msat_ptr = untag_ptr(amt_msat);
84685         CHECK_ACCESS(amt_msat_ptr);
84686         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84687         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84688         void* payment_hash_ptr = untag_ptr(payment_hash);
84689         CHECK_ACCESS(payment_hash_ptr);
84690         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
84691         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
84692         LDKStr description_conv = str_ref_to_owned_c(description);
84693         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
84694         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
84695         if (phantom_route_hints_constr.datalen > 0)
84696                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
84697         else
84698                 phantom_route_hints_constr.data = NULL;
84699         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
84700         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
84701                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
84702                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
84703                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
84704                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
84705                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
84706                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
84707                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
84708         }
84709         FREE(phantom_route_hints);
84710         void* entropy_source_ptr = untag_ptr(entropy_source);
84711         CHECK_ACCESS(entropy_source_ptr);
84712         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
84713         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
84714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84715                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
84716         }
84717         void* node_signer_ptr = untag_ptr(node_signer);
84718         CHECK_ACCESS(node_signer_ptr);
84719         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84720         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84722                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84723         }
84724         void* logger_ptr = untag_ptr(logger);
84725         CHECK_ACCESS(logger_ptr);
84726         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84727         if (logger_conv.free == LDKLogger_JCalls_free) {
84728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84729                 LDKLogger_JCalls_cloned(&logger_conv);
84730         }
84731         LDKCurrency network_conv = LDKCurrency_from_js(network);
84732         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84733         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84734         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84735         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84736         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84737         *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);
84738         return tag_ptr(ret_conv, true);
84739 }
84740
84741 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) {
84742         void* amt_msat_ptr = untag_ptr(amt_msat);
84743         CHECK_ACCESS(amt_msat_ptr);
84744         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84745         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84746         void* payment_hash_ptr = untag_ptr(payment_hash);
84747         CHECK_ACCESS(payment_hash_ptr);
84748         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
84749         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
84750         LDKSha256 description_hash_conv;
84751         description_hash_conv.inner = untag_ptr(description_hash);
84752         description_hash_conv.is_owned = ptr_is_owned(description_hash);
84753         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
84754         description_hash_conv = Sha256_clone(&description_hash_conv);
84755         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
84756         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
84757         if (phantom_route_hints_constr.datalen > 0)
84758                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
84759         else
84760                 phantom_route_hints_constr.data = NULL;
84761         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
84762         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
84763                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
84764                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
84765                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
84766                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
84767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
84768                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
84769                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
84770         }
84771         FREE(phantom_route_hints);
84772         void* entropy_source_ptr = untag_ptr(entropy_source);
84773         CHECK_ACCESS(entropy_source_ptr);
84774         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
84775         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
84776                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84777                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
84778         }
84779         void* node_signer_ptr = untag_ptr(node_signer);
84780         CHECK_ACCESS(node_signer_ptr);
84781         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84782         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84783                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84784                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84785         }
84786         void* logger_ptr = untag_ptr(logger);
84787         CHECK_ACCESS(logger_ptr);
84788         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84789         if (logger_conv.free == LDKLogger_JCalls_free) {
84790                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84791                 LDKLogger_JCalls_cloned(&logger_conv);
84792         }
84793         LDKCurrency network_conv = LDKCurrency_from_js(network);
84794         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84795         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84796         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84797         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84798         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84799         *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);
84800         return tag_ptr(ret_conv, true);
84801 }
84802
84803 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) {
84804         LDKChannelManager channelmanager_conv;
84805         channelmanager_conv.inner = untag_ptr(channelmanager);
84806         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
84807         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
84808         channelmanager_conv.is_owned = false;
84809         void* node_signer_ptr = untag_ptr(node_signer);
84810         CHECK_ACCESS(node_signer_ptr);
84811         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84812         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84814                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84815         }
84816         void* logger_ptr = untag_ptr(logger);
84817         CHECK_ACCESS(logger_ptr);
84818         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84819         if (logger_conv.free == LDKLogger_JCalls_free) {
84820                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84821                 LDKLogger_JCalls_cloned(&logger_conv);
84822         }
84823         LDKCurrency network_conv = LDKCurrency_from_js(network);
84824         void* amt_msat_ptr = untag_ptr(amt_msat);
84825         CHECK_ACCESS(amt_msat_ptr);
84826         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84827         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84828         LDKSha256 description_hash_conv;
84829         description_hash_conv.inner = untag_ptr(description_hash);
84830         description_hash_conv.is_owned = ptr_is_owned(description_hash);
84831         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
84832         description_hash_conv = Sha256_clone(&description_hash_conv);
84833         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84834         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84835         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84836         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84837         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84838         *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);
84839         return tag_ptr(ret_conv, true);
84840 }
84841
84842 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) {
84843         LDKChannelManager channelmanager_conv;
84844         channelmanager_conv.inner = untag_ptr(channelmanager);
84845         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
84846         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
84847         channelmanager_conv.is_owned = false;
84848         void* node_signer_ptr = untag_ptr(node_signer);
84849         CHECK_ACCESS(node_signer_ptr);
84850         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84851         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84852                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84853                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84854         }
84855         void* logger_ptr = untag_ptr(logger);
84856         CHECK_ACCESS(logger_ptr);
84857         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84858         if (logger_conv.free == LDKLogger_JCalls_free) {
84859                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84860                 LDKLogger_JCalls_cloned(&logger_conv);
84861         }
84862         LDKCurrency network_conv = LDKCurrency_from_js(network);
84863         void* amt_msat_ptr = untag_ptr(amt_msat);
84864         CHECK_ACCESS(amt_msat_ptr);
84865         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84866         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84867         LDKStr description_conv = str_ref_to_owned_c(description);
84868         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84869         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84870         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84871         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84872         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84873         *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);
84874         return tag_ptr(ret_conv, true);
84875 }
84876
84877 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) {
84878         LDKChannelManager channelmanager_conv;
84879         channelmanager_conv.inner = untag_ptr(channelmanager);
84880         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
84881         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
84882         channelmanager_conv.is_owned = false;
84883         void* node_signer_ptr = untag_ptr(node_signer);
84884         CHECK_ACCESS(node_signer_ptr);
84885         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84886         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84888                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84889         }
84890         void* logger_ptr = untag_ptr(logger);
84891         CHECK_ACCESS(logger_ptr);
84892         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84893         if (logger_conv.free == LDKLogger_JCalls_free) {
84894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84895                 LDKLogger_JCalls_cloned(&logger_conv);
84896         }
84897         LDKCurrency network_conv = LDKCurrency_from_js(network);
84898         void* amt_msat_ptr = untag_ptr(amt_msat);
84899         CHECK_ACCESS(amt_msat_ptr);
84900         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84901         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84902         LDKStr description_conv = str_ref_to_owned_c(description);
84903         LDKThirtyTwoBytes payment_hash_ref;
84904         CHECK(payment_hash->arr_len == 32);
84905         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
84906         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84907         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84908         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84909         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84910         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84911         *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);
84912         return tag_ptr(ret_conv, true);
84913 }
84914
84915 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
84916         LDKStr s_conv = str_ref_to_owned_c(s);
84917         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
84918         *ret_conv = SiPrefix_from_str(s_conv);
84919         return tag_ptr(ret_conv, true);
84920 }
84921
84922 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
84923         LDKStr s_conv = str_ref_to_owned_c(s);
84924         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
84925         *ret_conv = Bolt11Invoice_from_str(s_conv);
84926         return tag_ptr(ret_conv, true);
84927 }
84928
84929 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
84930         LDKStr s_conv = str_ref_to_owned_c(s);
84931         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
84932         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
84933         return tag_ptr(ret_conv, true);
84934 }
84935
84936 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
84937         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
84938         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
84939         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84940         Str_free(ret_str);
84941         return ret_conv;
84942 }
84943
84944 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
84945         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
84946         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
84947         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84948         Str_free(ret_str);
84949         return ret_conv;
84950 }
84951
84952 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
84953         LDKBolt11Invoice o_conv;
84954         o_conv.inner = untag_ptr(o);
84955         o_conv.is_owned = ptr_is_owned(o);
84956         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84957         o_conv.is_owned = false;
84958         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
84959         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84960         Str_free(ret_str);
84961         return ret_conv;
84962 }
84963
84964 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
84965         LDKSignedRawBolt11Invoice o_conv;
84966         o_conv.inner = untag_ptr(o);
84967         o_conv.is_owned = ptr_is_owned(o);
84968         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84969         o_conv.is_owned = false;
84970         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
84971         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84972         Str_free(ret_str);
84973         return ret_conv;
84974 }
84975
84976 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
84977         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
84978         LDKStr ret_str = Currency_to_str(o_conv);
84979         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84980         Str_free(ret_str);
84981         return ret_conv;
84982 }
84983
84984 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
84985         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
84986         LDKStr ret_str = SiPrefix_to_str(o_conv);
84987         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
84988         Str_free(ret_str);
84989         return ret_conv;
84990 }
84991